Intel® System Debugger User Guide

ID Date Version Classification
648476 10/17/2024 Confidential
Document Table of Contents

Break at the Initialization of a Linux* Kernel Module

Follow the steps below to break at the initialization of an out-of-tree (separately compiled) Linux* kernel module.

Prerequisites:

  • Target connection is successfully established.

  1. Halt the target.

  2. Load Linux* kernel symbols. Follow the instructions above.

  3. Set a function breakpoint on the kernel initialization function:

    • In the Breakoints view, click view_menu View Menu and select Add Function Breakpoint.

    • In the opened dialog box, select the Regular breakpoint type and specify do_​init_​module as the function name.

    • Click Apply and Close to save changes.

    do_init_module_dialog

  4. On the target system, launch the shell and execute the following command to insert an out-of-tree module:

sudo insmod <module>

where <module> is the target out-of-tree module (.ko file)

  1. Return to the Intel(R) System Debugger running on the host system, resume the target, and wait for the breakpoint to get hit.

do_init_module_hit

  1. Once the target is halted, inspect the mod parameter of the function in any of the following ways:

  • In the Variables view, expand the mod node, locate the init row, and copy its address from the Value column.

    mod_variables

  • In the Expressions view, add the following expression: mod->init

    mod_init_expressions

  1. Set a breakpoint at the address obtained in the previous step:

  • In the Breakpoints view, click add Add Breakpoint.

  • In the opened dialog box, select the Instruction Breakpoint type and insert the address.

  • Click OK.

  1. Resume the target.

  2. Once the breakpoint is hit at the module initialization step, you can load the module’s symbols using the Load Linux Kernel Modules from folder button (see instructions in the previous topic).

You can automate the described process using the sample script.