Reputation: 1185
I recently set up my system for kernel debug using qemu+gdb. At present, I can set breakpoints at, for example, __do_page_fault()
and trace the call via gdb
(with win
command). Now I want the following task: A simple C
program having a "hello world
" printf
statement. Trace the call sequence starting from the userspace down to the write()
system call ( or anything in the kernel space that is invoked during the execution of that particular userspace program). I want to learn how userspace program traps into system call w.r.t Linux kernel specifically.
Now my doubt is where to set the breakpoint? We have kernel code as well as the C
code of the program. How to go about this situation ? Please give us an explanation with example.
Thank You !
Upvotes: 3
Views: 1496
Reputation: 3935
The most easiest way in my opinion is to separate this into two pieces.
P.S. If your kernel will continuously hit breakpoint (f.e. write syscall is definitely used widely), you can use a conditional breakpoint to hit a breakpoint only with a certain parameters passed.
Upvotes: 2