|
Stopping kernel execution
To stop kernel execution, press Ctrl + C on the gdb
terminal. GDB will send a stop message to KGDB stub, which will take
control of the kernel and contact GDB. GDB will then present a command
prompt and wait for user input. At this point all processors will be
controlled by KGDB and no other part of the kernel will be executing.
You can now use any GDB commands. GDB will present and prompt and wait
for a command till you tell it to continue execution.
Continuing kernel execution
To continue kernel execution, use GDB command continue.
gdb will tell the KGDB stub to continue kernel execution. Kernel
execution will continue after this point. GDB will not expect a user
command till the user either breaks execution using Ctrl + C,
or KGDB stub gives control to it because of a breakpoint or some other
reason.
Breakpoints
Use gdb break command to stop kernel execution at a
function or a source code line. The command accepts a function name or
a source code file name appended with a : and a line number as
an argument.
Stepping through code
To step a code statement, use gdb command step. This
command will run the kernel for one statement and again hand over the
control to GDB. This command will step into function calls also. If you
want to skip stepping into function calls, use gdb command next.
With both the commands kgdb continues kernel execution on all the
processors. With the step command, gdb causes kgdb to do a one
instruction at a time stepping till next code statement is reached.
kgdb has to catch all processors and release them on every instruction
step. If a code statement is a loop, a step may take a long time. For
example stepping into copy_to_user function for copying a large buffer
will usually require a few minutes. The same issue is also present with
the next command also.
|