From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23953 invoked by alias); 7 May 2013 18:50:12 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 23942 invoked by uid 89); 7 May 2013 18:50:12 -0000 X-Spam-SWARE-Status: No, score=-4.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-ie0-f179.google.com (HELO mail-ie0-f179.google.com) (209.85.223.179) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 07 May 2013 18:50:11 +0000 Received: by mail-ie0-f179.google.com with SMTP id c13so1585950ieb.24 for ; Tue, 07 May 2013 11:50:09 -0700 (PDT) X-Received: by 10.42.40.11 with SMTP id j11mr992986ice.50.1367952609821; Tue, 07 May 2013 11:50:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.147.2 with HTTP; Tue, 7 May 2013 11:49:39 -0700 (PDT) In-Reply-To: <5188AE42.50308@codesourcery.com> References: <1367868074.5194.19.camel@station15.dorsal.polymtl.ca> <5188AE42.50308@codesourcery.com> From: Simon Marchi Date: Tue, 07 May 2013 18:50:00 -0000 Message-ID: Subject: Re: Debugging agent library To: Yao Qi Cc: Suchakra Sharma , gdb@sourceware.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2013-05/txt/msg00040.txt.bz2 Hi Yao, On 7 May 2013 03:33, Yao Qi 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. T= he > session below shows how to install fast tracepoint through dagent. > > In one console, start the program in GDBserver, > > $ LD_PRELOAD=3D/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=3D/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/libdagen= t.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=3D, argv=3D, envp=3D) 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 (=E9=BD=90=E5=B0=A7) 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