From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29349 invoked by alias); 25 Jun 2010 15:18:00 -0000 Received: (qmail 29335 invoked by uid 22791); 25 Jun 2010 15:17:58 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM X-Spam-Check-By: sourceware.org Received: from mail-gx0-f169.google.com (HELO mail-gx0-f169.google.com) (209.85.161.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Jun 2010 15:17:53 +0000 Received: by gxk24 with SMTP id 24so722591gxk.0 for ; Fri, 25 Jun 2010 08:17:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.248.2 with SMTP id me2mr558955qcb.44.1277479071517; Fri, 25 Jun 2010 08:17:51 -0700 (PDT) Received: by 10.229.86.72 with HTTP; Fri, 25 Jun 2010 08:17:51 -0700 (PDT) In-Reply-To: <1277470068.10416.4.camel@e102319-lin.cambridge.arm.com> References: <1277470068.10416.4.camel@e102319-lin.cambridge.arm.com> Date: Fri, 25 Jun 2010 15:18:00 -0000 Message-ID: Subject: Re: [ARM] dlopen and remote debugging From: "karthikeyan.s" To: Matthew Gretton-Dann Cc: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2010-06/txt/msg00124.txt.bz2 Sorry I did not mention that we do start gdb with the binary app X. So in the host we start with: $ arm-none-linux-gnueabi-gdb /usr/bin/X and then # (gdb) set sysroot # (gdb) target remote 10.0.0.3:10000 # (gdb) continue I think one does not need to specify the source binary again. 1) One difference I see in the working and non-working case is that other libraries that X depends on are stripped in the failing case. So if X depends on x.so,y.so,our_driver.so. In the failing case, case x.so,y.so are stripped. Not that this is the reason for the failure, but just a difference in the conditions in succeeding and failing case. And X is stripped in both the cases. 2) Also, with the above method, I could manually specify the .text address (along with values of variables too by specifying other section addresses) of the library using add-file-symbol. And then was able to hit breakpoints disassemble the library. add-symbol-file /usr/lib/xorg/driver.so =3D library load address + text offset in the library. -Karthik On Fri, Jun 25, 2010 at 6:17 PM, Matthew Gretton-Dann wrote: > Karthik, > > On Thu, 2010-06-24 at 23:42 +0530, karthikeyan.s wrote: >> Hi, >> We recently encountered an issue with gdb wherein it does not get the >> symbols from a shared library when loaded with dlopen. The following >> steps does not give us the shared library's symbols. The binary is >> Xorg. >> >> 1) >> gdbserver :10000 /usr/bin/X -ac >> set sysroot >> target remote 10.0.0.3:10000 >> continue >> cntrl-C >> We do not get the library's symbols here. But with cat >> /proc/{x_pid}/maps we can see the library is loaded in memory. >> >> 2) But with the following steps, the libraries get loaded >> =A0/usr/bin/X -ac & >> gdbserver :10000 --attach >> set sysroot >> target remote 10.0.0.3:10000 >> >> We can see the library's symbols and hit breakpoint, debug etc. etc. >> > > Section 20.3.2 of the gdb manual says that you need to load the symbols > for your application using the file command before you connect (see > http://sourceware.org/gdb/download/onlinedocs/gdb/Server.html#Server). > Can you try this, and report back if you are still having problems? > > I would imagine the commands to your host gdb would be something like: > (gdb) set sysroot > (gdb) file > (gdb) target remote 10.0.0.3:10000 > (gdb) continue > > Thanks, > > Matt > > -- > Matthew Gretton-Dann > Principal Engineer - PDSW Tools > ARM Ltd > > --=20 --- S. Karthikeyan | +919980814745 ---