This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cross-debugging with gdbserver, why can't gdb find breakpointfunction?


I'm trying to debug a simple test program using gdbserver.  The test
program:

  #include <stdio.h>
  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]