This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

KGTP (Linux Kernel debugger and tracer that use GDB) 201100601 release


KGTP is a realtime and lightweight Linux Kernel GDB debugger and
tracer that uses Kprobe.

It makes Linux Kernel supply a GDB remote debug interface. Then GDB in
current machine or remote machine (see HOWTO#Make_GDB_connect_to_gtp")
can debug Linux through GDB tracepoint without stopping the Linux
Kernel.
And even if the board doesn't have GDB on it and doesn't have
interface for remote debug. It can debug the Linux Kernel using
offline debug (See HOWTO#Offline_debug).
Now, it supports X86-32, X86-64, MIPS and ARM.
http://www.tudou.com/programs/view/_p6VTgxmCRA/ This is a video(in
Chinese) to show how to use it.

Now, KGTP 20110601 release.
You can get the package for it from
http://kgtp.googlecode.com/files/kgtp_20110601.tar.bz2
or
svn co https://kgtp.googlecode.com/svn/tags/20110601

The main change of is:
Change frame to use ring buffer.
Add gtpframe_pipe.

Then user can get the trace frame info even if tracepoint is running.

 /sys/kernel/debug/gtpframe_pipe
This interface supplies same format trace frame with "gtpframe". But
it can work when KGTP is running. And it is a consumer like
"trace_pipe".

Get the frame info with cat
sudo cat /sys/kernel/debug/gtpframe_pipe > g
Then all the trace frame will be saved in file "g".

Get the frame info with getframe
KGTP package include a program "getframe" can help you save the trace
frame to files.
Following part is the help of it:
getframe -h
Get the trace frame of KGTP and save them in current
directory with tfile format.
Usage: ./getframe [option]
 -g n    Set the minimum free size limit to n G.
         When free size of current disk is smaller than n G,
         ./getframe will exit (-q) or wait some seconds (-w).
         The default value of it is 2 G.
 -q      Quit when current disk is smaller than
         minimum free size limit (-g).
 -w n    Wait n seconds when current disk is smaller
         than minimum free size limit (-g).
 -e n    Set the entry number of each tfile to n.
         The default value of it is 1000.
 -h      Display this information.


Get the frame info with GDB
#connect to the interface
(gdb) target tfile /sys/kernel/debug/gtpframe_pipe
#Get one trace frame entry
(gdb) tfind 0
Found trace frame 0, tracepoint 1
#Get the next one
(gdb) tfind
Target failed to find requested trace frame.
(gdb) tfind 0
Found trace frame 0, tracepoint 1
This way is better to work with python to parse Kernel. I will
introduce them in example.

I will post some example later to show howto use GDB+python to trace
the kernel.

The Linux Kernel patch is too big for this list.  So I didn't post it.

Thanks,
Hui


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]