* Debugging agent library
@ 2013-05-06 19:21 Suchakra Sharma
[not found] ` <5188AE42.50308@codesourcery.com>
0 siblings, 1 reply; 5+ messages in thread
From: Suchakra Sharma @ 2013-05-06 19:21 UTC (permalink / raw)
To: gdb; +Cc: yao, simon.marchi
Hi,
We tried to find out how to use the debugging agent library here [1] but
were unsuccessful. As of now, we have built a test app linked to dagent
which creates a socket file and expects commands. We wish to use it with
GDB as well as other applications to primarily objective of tracing
using GDB's fast tracepoint infra. Any help in this regard will be
appreciated.
[1] https://github.com/MentorEmbedded/Debug-Agent-Library/wiki
Regards,
Suchakra & Simon
--
Suchakrapani Datt Sharma
Laboratorie DORSAL
Ãcole Polytechnique de Montréal
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <5188AE42.50308@codesourcery.com>]
* Re: Debugging agent library [not found] ` <5188AE42.50308@codesourcery.com> @ 2013-05-07 18:50 ` Simon Marchi 2013-05-08 2:16 ` Yao Qi 0 siblings, 1 reply; 5+ messages in thread From: Simon Marchi @ 2013-05-07 18:50 UTC (permalink / raw) To: Yao Qi; +Cc: Suchakra Sharma, gdb Hi Yao, On 7 May 2013 03:33, Yao Qi <yao@codesourcery.com> wrote: > Hello, > Suchakra, > > > On 05/07/2013 03:21 AM, Suchakra Sharma wrote: >> >> Hi, >> >> We tried to find out how to use the debugging agent library here [1] but >> were unsuccessful. As of now, we have built a test app linked to dagent > > > It would be nice if you post some details about how you use dagent and the > error message you got. > > >> which creates a socket file and expects commands. We wish to use it with >> GDB as well as other applications to primarily objective of tracing >> using GDB's fast tracepoint infra. Any help in this regard will be >> appreciated. >> >> [1] https://github.com/MentorEmbedded/Debug-Agent-Library/wiki >> > > I checked out the wiki and realize that the existing documentation has an > assumption that readers are much familiar with GDB and GDB tracepoint. The > session below shows how to install fast tracepoint through dagent. > > In one console, start the program in GDBserver, > > $ LD_PRELOAD=/install/lib/libdagent.so ./gdbserver/gdbserver :1234 > ./testsuite/gdb.base/break > > In the other console, start GDB and connect to GDBserver, > > $ ./gdb ./testsuite/gdb.base/break > (gdb) target remote :1234 > (gdb) b main > (gdb) c > > (gdb) b marker4 // set breakpoint to make sure program doesn't exit > (gdb) ftrace *0x0804851e // set fast tracepoint at certain address > (gdb) set agent on // enable agent > (gdb) tstart // start tracing tstart here gives me the error: (gdb) tstart Target returns error code '.In-process agent library not loaded in process. Fast and static tracepoints unavailable.' I compiled my small app using (libdagent.so is already in my ld search path): $ gcc test.c -Wall -g -ldagent -O0 I run the gdbserver using: $ LD_PRELOAD=/usr/local/lib/libdagent.so gdbserver :1234 ./a.out Then I use the same commands as you have shown in your example. info sharedlibrary shows that the agent is loaded: (gdb) info sharedlibrary From To Syms Read Shared Object Library 0x00007ffff7dddb00 0x00007ffff7df685b Yes (*) /lib64/ld-linux-x86-64.so.2 0x00007ffff7bd38c0 0x00007ffff7bd8e38 Yes /usr/local/lib/libdagent.so 0x00007ffff785ba20 0x00007ffff797c72c Yes (*) /lib64/libc.so.6 0x00007ffff7625660 0x00007ffff7630eb8 Yes (*) /lib64/libpthread.so.0 Is there something I am missing here? > (gdb) c > (gdb) tstop // stop tracing > (gdb) tfind // examine the trace frames tracepoint collects > Found trace frame 0, tracepoint 3 > #0 main (argc=<unavailable>, argv=<unavailable>, envp=<unavailable>) at > ../../../../git/gdb/testsuite/gdb.base/break.c:94 > 94 marker1 (); /* set breakpoint 11 here */ > > Let me know if you get something else or obviously wrong. > > -- > Yao (齐尧) Also, is it possible to write our own application to control tracing, instead of using GDB? I guess we would need to talk to the agent using the IPA protocol, is that right? Thanks ! Simon ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Debugging agent library 2013-05-07 18:50 ` Simon Marchi @ 2013-05-08 2:16 ` Yao Qi 2013-05-08 19:42 ` Suchakra Sharma 0 siblings, 1 reply; 5+ messages in thread From: Yao Qi @ 2013-05-08 2:16 UTC (permalink / raw) To: Simon Marchi; +Cc: Suchakra Sharma, gdb On 05/08/2013 02:49 AM, Simon Marchi wrote: > tstart here gives me the error: > > (gdb) tstart > Target returns error code '.In-process agent library not loaded in > process. Fast and static tracepoints unavailable.' > > I compiled my small app using (libdagent.so is already in my ld search path): > $ gcc test.c -Wall -g -ldagent -O0 > > I run the gdbserver using: > $ LD_PRELOAD=/usr/local/lib/libdagent.so gdbserver :1234 ./a.out If libdagent is linked to your program explicitly, LD_PRELOAD is not needed any more. You have to either compile your program without -ldagent and use LD_PRELOAD on run or compile your program with -ldagent and run your program normally. > > Then I use the same commands as you have shown in your example. info > sharedlibrary shows that the agent is loaded: > > (gdb) info sharedlibrary > From To Syms Read Shared Object Library > 0x00007ffff7dddb00 0x00007ffff7df685b Yes (*) /lib64/ld-linux-x86-64.so.2 > 0x00007ffff7bd38c0 0x00007ffff7bd8e38 Yes /usr/local/lib/libdagent.so > 0x00007ffff785ba20 0x00007ffff797c72c Yes (*) /lib64/libc.so.6 > 0x00007ffff7625660 0x00007ffff7630eb8 Yes (*) /lib64/libpthread.so.0 > > Is there something I am missing here? > If the suggestions above don't work for you, you probably have to turn on some debugging outputs. You can start gdbserver with option "--debug", and further, hack the variable "debug_agent" to 1 in gdb/common/agent.c. > Also, is it possible to write our own application to control tracing, > instead of using GDB? I guess we would need to talk to the agent using > the IPA protocol, is that right? Tracing control involves two sides, GDB and the agent. IPA protocol is used to control the agent, however, in order to finish/control tracing, GDB side should be controlled as well. Your tool can get the trace data from agent, but these data needs GDB interpretation, map the address to a symbol, for example. I am afraid you can't use your own application to do tracing with agent. On the other hand, I am curious on the reasons to write your own tool to control tracing instead of using GDB. Tracing is interesting to GDB, and you can see how much progress GDB made on tracing in the past several years. GDB is extensible on both its c code and python script, and you can extend it for your purpose. Last by not least, contributions are always welcome, and people here are friendly and nice to answer questions, AFAICS. -- Yao (é½å°§) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Debugging agent library 2013-05-08 2:16 ` Yao Qi @ 2013-05-08 19:42 ` Suchakra Sharma 2013-05-09 1:01 ` Yao Qi 0 siblings, 1 reply; 5+ messages in thread From: Suchakra Sharma @ 2013-05-08 19:42 UTC (permalink / raw) To: Yao Qi; +Cc: Simon Marchi, gdb Hi Yao, > If the suggestions above don't work for you, you probably have to turn > on some debugging outputs. You can start gdbserver with option > "--debug", and further, hack the variable "debug_agent" to 1 in > gdb/common/agent.c. Thanks for your detailed reply. We were able to rectify the issue. We tried with a clean install of gdb and libdagent on another machine which did not show any issue. The problem was probably because we tinkered around the dagent code a bit before using it. All works well now. > > Also, is it possible to write our own application to control tracing, > > instead of using GDB? I guess we would need to talk to the agent using > > the IPA protocol, is that right? > > Tracing control involves two sides, GDB and the agent. IPA protocol is > used to control the agent, however, in order to finish/control tracing, > GDB side should be controlled as well. Your tool can get the trace data > from agent, but these data needs GDB interpretation, map the address to > a symbol, for example. I am afraid you can't use your own application > to do tracing with agent. > > On the other hand, I am curious on the reasons to write your own tool to > control tracing instead of using GDB. Tracing is interesting to GDB, > and you can see how much progress GDB made on tracing in the past > several years. GDB is extensible on both its c code and python script, > and you can extend it for your purpose. Last by not least, > contributions are always welcome, and people here are friendly and nice > to answer questions, AFAICS. Indeed, dynamic tracing with GDB is getting more awesome day by day (this view is reinforced by some tests I ran in-house which really show how powerful and fast it is) A you know LTTng/UST already has quite fast static tracing features, so our main aim is to get dynamic tracing infrastructure of GDB in LTTng/UST for fast dynamic user space tracing in an elegant way. We are not 100% clear how it shall be achieved at this moment but we are exploring all avenues for now. At first glance it looked as if we could do it using this library coupled with GDB (controlled through LTTng/UST acting as our tool). Your ideas are welcome and we surely shall contribute once we get a good knack of how to extend GDB's functionality for our use. Regards, Suchakra & Simom -- Suchakrapani Datt Sharma Laboratorie DORSAL Ãcole Polytechnique de Montréal ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Debugging agent library 2013-05-08 19:42 ` Suchakra Sharma @ 2013-05-09 1:01 ` Yao Qi 0 siblings, 0 replies; 5+ messages in thread From: Yao Qi @ 2013-05-09 1:01 UTC (permalink / raw) To: Suchakra Sharma; +Cc: Simon Marchi, gdb On 05/09/2013 03:41 AM, Suchakra Sharma wrote: > Thanks for your detailed reply. We were able to rectify the issue. We > tried with a clean install of gdb and libdagent on another machine which > did not show any issue. The problem was probably because we tinkered > around the dagent code a bit before using it. All works well now. > Good. > Indeed, dynamic tracing with GDB is getting more awesome day by day > (this view is reinforced by some tests I ran in-house which really show > how powerful and fast it is) A you know LTTng/UST already has quite fast > static tracing features, so our main aim is to get dynamic tracing > infrastructure of GDB in LTTng/UST for fast dynamic user space tracing > in an elegant way. We are not 100% clear how it shall be achieved at > this moment but we are exploring all avenues for now. At first glance it > looked as if we could do it using this library coupled with GDB > (controlled through LTTng/UST acting as our tool). Your ideas are > welcome and we surely shall contribute once we get a good knack of how > to extend GDB's functionality for our use. GDB/GDBserver is able to control UST static tracepoint through agent, but UST is 0.11 and URCU is 0.5.3, which is a little bit old. In UST 0.12 release, the GDB support is removed unfortunately. Probably you can have a look at testsuite/gdb.trace/strace.exp to see how GDB/GDBserver interact with UST static tracepoints. -- Yao (é½å°§) ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-09 1:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-06 19:21 Debugging agent library Suchakra Sharma
[not found] ` <5188AE42.50308@codesourcery.com>
2013-05-07 18:50 ` Simon Marchi
2013-05-08 2:16 ` Yao Qi
2013-05-08 19:42 ` Suchakra Sharma
2013-05-09 1:01 ` Yao Qi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox