* Problem with debugging ld.so
@ 2001-10-02 12:30 H . J . Lu
2001-10-02 13:39 ` Andrew Cagney
2001-10-02 14:11 ` Kevin Buettner
0 siblings, 2 replies; 4+ messages in thread
From: H . J . Lu @ 2001-10-02 12:30 UTC (permalink / raw)
To: GDB
Under Linux,
# gdb /lib/ld-linux.so.2
...
(gdb) b dl_main
Breakpoint 1 at 0x2567: file rtld.c, line 397.
(gdb) r
Starting program: /lib/ld-linux.so.2
Breakpoint 1 at 0x80002567: file rtld.c, line 397.
Breakpoint 1, dl_main (phdr=0x80000034, phnum=3, user_entry=0xbffff2e8)
at rtld.c:397
warning: Source file is more recent than executable.
397 char *file;
(gdb)
# gdb /lib/ld-linux.so.2
...
(gdb) r
...
(gdb) b dl_main
Cannot access memory at address 0x80002550
It looks like after ld.so is run, I can no longer set breakpoints
in ld.so.
H.J.
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Problem with debugging ld.so
2001-10-02 12:30 Problem with debugging ld.so H . J . Lu
@ 2001-10-02 13:39 ` Andrew Cagney
2001-10-02 13:41 ` H . J . Lu
2001-10-02 14:11 ` Kevin Buettner
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2001-10-02 13:39 UTC (permalink / raw)
To: H . J . Lu; +Cc: GDB
Under which Linux?
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Problem with debugging ld.so
2001-10-02 12:30 Problem with debugging ld.so H . J . Lu
2001-10-02 13:39 ` Andrew Cagney
@ 2001-10-02 14:11 ` Kevin Buettner
1 sibling, 0 replies; 4+ messages in thread
From: Kevin Buettner @ 2001-10-02 14:11 UTC (permalink / raw)
To: H . J . Lu, GDB
On Oct 2, 12:30pm, H . J . Lu wrote:
> # gdb /lib/ld-linux.so.2
> ...
> (gdb) r
> ...
> (gdb) b dl_main
> Cannot access memory at address 0x80002550
>
> It looks like after ld.so is run, I can no longer set breakpoints
> in ld.so.
BTW, this doesn't only happen when debugging ld.so - which is a rather
arcane situation for many of us. GDB has problems setting
breakpoints on functions in shared libraries (after the inferior has
exited) for ordinary programs too. It's worked this way for as long
as I can remember.
Here's an example similar to H.J.'s, but using a "Hello, world" program
instead:
[kev@mesquite ctests]$ ../sourceware-solib-bld/gdb/gdb ./hello
GNU gdb 2001-09-26-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 "i686-pc-linux-gnu"...
(gdb) b printf
Breakpoint 1 at 0x804833c
(gdb) r
Starting program: /home/kev/ctests/./hello
Breakpoint 1 at 0x4008c5e6: file printf.c, line 32.
Breakpoint 1, printf (format=0x80484e8 "Hello, world!\n") at printf.c:32
32 printf.c: No such file or directory.
in printf.c
(gdb) c
Continuing.
Hello, world!
Program exited normally.
(gdb) quit
[kev@mesquite ctests]$ ../sourceware-solib-bld/gdb/gdb ./hello
GNU gdb 2001-09-26-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 "i686-pc-linux-gnu"...
(gdb) r
Starting program: /home/kev/ctests/./hello
Hello, world!
Program exited normally.
(gdb) b printf
Cannot access memory at address 0x4008c5d4
I think GDB is correct in stating that it can't access memory at the
given address. (It can't because the program has exited and the
memory is truly no longer accessible.) What this suggests to me is
that we need to have GDB clean things up a bit more after the program
exits so that we have roughly the same state as before execution. If
this were done, we'd be able to set a breakpoint on printf(). The
initial breakpoint would be set on the PLT entry and would then later
be moved to the actual function once the shared library has been
loaded. (There may be other ways to do it too.)
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-10-02 14:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-02 12:30 Problem with debugging ld.so H . J . Lu
2001-10-02 13:39 ` Andrew Cagney
2001-10-02 13:41 ` H . J . Lu
2001-10-02 14:11 ` Kevin Buettner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox