From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28850 invoked by alias); 8 May 2013 02:16:32 -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 28834 invoked by uid 89); 8 May 2013 02:16:30 -0000 X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 08 May 2013 02:16:29 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UZtvf-0007bn-Lr from Yao_Qi@mentor.com ; Tue, 07 May 2013 19:16:27 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 7 May 2013 19:16:27 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.2.247.3; Tue, 7 May 2013 19:16:26 -0700 Message-ID: <5189B577.6070006@codesourcery.com> Date: Wed, 08 May 2013 02:16:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Simon Marchi CC: Suchakra Sharma , Subject: Re: Debugging agent library References: <1367868074.5194.19.camel@station15.dorsal.polymtl.ca> <5188AE42.50308@codesourcery.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2013-05/txt/msg00041.txt.bz2 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 (齐尧)