From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15524 invoked by alias); 1 Jul 2010 05:02:59 -0000 Received: (qmail 15453 invoked by uid 22791); 1 Jul 2010 05:02:57 -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,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-qy0-f169.google.com (HELO mail-qy0-f169.google.com) (209.85.216.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Jul 2010 05:02:49 +0000 Received: by qyk12 with SMTP id 12so144389qyk.0 for ; Wed, 30 Jun 2010 22:02:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.26.165 with SMTP id e37mr7177371qac.186.1277960567357; Wed, 30 Jun 2010 22:02:47 -0700 (PDT) Received: by 10.229.99.201 with HTTP; Wed, 30 Jun 2010 22:02:47 -0700 (PDT) In-Reply-To: References: <1277470068.10416.4.camel@e102319-lin.cambridge.arm.com> Date: Thu, 01 Jul 2010 05:02: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-07/txt/msg00000.txt.bz2 Can anyone give us a direction here? pointers to related code in gdb would also be fine. On Fri, Jun 25, 2010 at 8:47 PM, karthikeyan.s wr= ote: > 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 > =A0# (gdb) set sysroot > =A0# (gdb) target remote 10.0.0.3:10000 > =A0# (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 >> >> > > > > -- > --- > S. Karthikeyan | +919980814745 > --- > --=20 --- S. Karthikeyan | +919980814745 ---