How to use tracing in gdb

In the documentation for gdb :

The trace object is currently only available for remote purposes. See the section “Defining the Debug Purpose”. In addition, your remote target should know how to collect trace data. This functionality is implemented in a remote stub; however, none of the stubs distributed using GDB support points at the time of writing .

The emphasis is mine. Where can I get such a stub (for C / C ++ code compiled from GCC on Debian x86 or x64)? Or how do I do this? The documentation for writing stubs only mentions implementation functions for communicating with serial ports. Thanks!

+6
source share
1 answer

I don’t know much about the remote, but some targets in gdb now support trace points, maybe I can get it using the “normal” information about gdb or show, I couldn’t find it. in the output below, trace points are supported due to "supported = 1", this may not be limited to the gdb stub, but also to the kernel on which the stub works.

$ gdbserver/gdbserver :12345 ~/tests/test & $ gdb -quiet (gdb) file ~/tests/test Reading symbols from /home/ratmice/tests/test...done. (gdb) target remote :12345 Remote debugging using :12345 Remote debugging from host 127.0.0.1 Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done. Loaded symbols for /lib64/ld-linux-x86-64.so.2 0x00000035dd600b20 in _start () from /lib64/ld-linux-x86-64.so.2 Created trace state variable $trace_timestamp for target variable 1. Missing separate debuginfos, use: debuginfo-install glibc-2.13-2.x86_64 (gdb) interpreter-exec mi2 -trace-status ^done,supported="1",running="0",frames="0",frames-created="0",buffer-size="5242880",buffer-free="5242880",disconnected="0",circular="0" 
+1
source

Source: https://habr.com/ru/post/895734/


All Articles