From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7405 invoked by alias); 17 Jul 2003 20:01:16 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 7398 invoked from network); 17 Jul 2003 20:01:16 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by sources.redhat.com with SMTP; 17 Jul 2003 20:01:16 -0000 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19dEvF-0004Cw-00 for ; Thu, 17 Jul 2003 22:00:13 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: gdb@sources.redhat.com Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 19dEuF-00046c-00 for ; Thu, 17 Jul 2003 21:59:11 +0200 From: David Wuertele Subject: cross-debugging with gdbserver, why can't gdb find breakpoint function? Date: Thu, 17 Jul 2003 20:01:00 -0000 Organization: Berkeley Fluent Network Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@main.gmane.org User-Agent: Gnus/5.090018 (Oort Gnus v0.18) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:/MNUghsYtm4wVbeYDRsrWiyEnmc= Cc: gdb@gnu.org X-SW-Source: 2003-07/txt/msg00221.txt.bz2 I'm trying to debug a simple test program using gdbserver. The test program: #include int main (int argc, char **argv) { printf ("hello, world!\n"); return 0; } The target architecture is mipsel. The hello.c program was compiled as follows: mipsel-linux-gcc -g -o hello hello.c On the target, I run gdbserver-5.3 like this: # /usr/local/bin/gdbserver 0:8888 hello Process hello created; pid = 478 When I run gdb-5.0.91 on the dev host and try to connect, this is what I get: # mipsel-linux-gdb Current directory is /nfsroot/root/ GNU gdb 5.0.91-2001-10-15-cvs (MI_OUT) Copyright 2001 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=mipsel-linux". (gdb) file hello Reading symbols from hello...done. (gdb) target remote 192.168.0.159:8888 Remote debugging using 192.168.0.159:8888 0x2aaa9c90 in ?? () warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. I tried upgrading the host gdb, and got a different problem: # ./gdb Current directory is /nfsroot/root/ GNU gdb 2003-07-16-cvs Copyright 2003 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i386-pc-linux --target=mipsel-pc-linux". (gdb) file hello Reading symbols from hello...done. (gdb) target remote 192.168.0.159:8888 Remote debugging using 192.168.0.159:8888 remote.c:3440: internal-error: Attempt to fetch a non G-packet register when this remote.c does not support the p-packet. A problem internal to GDB has been detected, further debugging may prove unreliable. That's weird that the gdb from the same source as gdbserver doesn't know how to talk to gdbserver! Looks like gdb-5.0.91 at least understands the packets gdbserver-5.3 sends. So I went and ran strace on gdb-5.0.91 to see what it was trying to open. Here is a snippet: open("/lib/ld.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "warning: ", 9warning: ) = 9 write(2, "Unable to find dynamic linker br"..., 148Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code.) = 148 Why is gdb trying to open /lib/ld.so.1? That /lib directory has nothing to do with the target libs. The target libs can be found in /nfsroot/lib. How do I tell gdb to look there instead of /lib? Dave