From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27322 invoked by alias); 15 Mar 2006 14:25:51 -0000 Received: (qmail 27295 invoked by uid 22791); 15 Mar 2006 14:25:50 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 15 Mar 2006 14:25:49 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FJWwc-0003Ia-7C; Wed, 15 Mar 2006 09:25:46 -0500 Date: Wed, 15 Mar 2006 16:17:00 -0000 From: Daniel Jacobowitz To: Nai-Hsien Cc: gdb@sourceware.org Subject: Re: Debugging a shared library through gdbserver Message-ID: <20060315142546.GC12258@nevyn.them.org> Mail-Followup-To: Nai-Hsien , gdb@sourceware.org References: <063201c647e2$b2c39160$0102000a@loop.com.tw> <20060315034555.GA1813@nevyn.them.org> <064501c647f8$39e135c0$0102000a@loop.com.tw> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <064501c647f8$39e135c0$0102000a@loop.com.tw> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00077.txt.bz2 On Wed, Mar 15, 2006 at 02:18:06PM +0800, Nai-Hsien wrote: > Nobody told me to do this. I just learned add-symbol-file from u-boot > document to relocate > program base. I tried some commands in gdb user's manual then I think this > command has result most > close to my expectation. Anyway, this is totally my fault. You don't need to relocate the program by hand when you're debugging in userspace. > I tried to follow your hint, shown as blow. Now, I can set a breakpoint in > the shared library and make > the program stop there. However, I still can not see the source code. (I am > using DDD with gdb.) > Am I still doing something wrong? > > Thank you > Dennis > > # my shared library is in lib/ > (gdb) set solib-absolute-prefix lib That's not what solib-absolute-prefix is for. You need to point it at the root of a filesystem image that matches the one running on your target, so that GDB can open /lib/ld.so.1 and /usr/lib/libfoo.so. I usually use NFS for this. If you do that... > (gdb) file console > (gdb) target remote 10.0.2.3:2001 > 0x0fd39fac in ?? () > warning: Unable to find dynamic linker breakpoint function. > GDB will be unable to debug shared library initializers > and track explicitly loaded dynamic code. This message will go away. -- Daniel Jacobowitz CodeSourcery