Date: Fri, 25 Aug 2000 00:42:31 -0400 From: John DeBoskey <jwd@unx.sas.com> To: freebsd-current@freebsd.org Subject: gdb bug w/ dlopen()ed images Message-ID: <20000825004231.A89090@unx.sas.com>
next in thread | raw e-mail | index | archive | help
Hi, There appears to be a problem with gdb when debugging dynamically loaded images. On 5.0-current with sources current and built as of this evenning and a 4.1-STABLE system, the following incorrect result is seen: %gdb ./testmain GNU gdb 4.18 (gdb) b main Breakpoint 1 at 0x804853f: file testmain.c, line 11. (gdb) run Starting program: /usr/home/jwd/src/ldt/./testmain Breakpoint 1, main () at testmain.c:11 11 addr = dlopen("./first", RTLD_LAZY); (gdb) n 13 if (!addr) { (gdb) n 18 fp = dlsym(addr, "first"); (gdb) n 20 (*fp)(); (gdb) s 0x280f85b7 in first () at first.c:24 24 } built with gcc version 2.95.2 19991024 (release) The same test program run under gcb on 4.0-20000313-SNAP and 4.0-STABLE systems yield the correct result: %gdb ./testmain GNU gdb 4.18 (gdb) b main Breakpoint 1 at 0x80484ff: file testmain.c, line 11. (gdb) run Starting program: /usr00/home/jwd/ldt/./testmain Breakpoint 1, main () at testmain.c:11 11 addr = dlopen("./first", RTLD_LAZY); (gdb) n 13 if (!addr) { (gdb) n 18 fp = dlsym(addr, "first"); (gdb) n 20 (*fp)(); (gdb) s first () at first.c:10 10 addr = dlopen("./second", RTLD_LAZY); built with gcc version 2.95.2 19991024 (release). In looking at the stabs information, for the working version, we find: STABS> name=first:F(0,1), type=24, desc=6, value=896 STABS> name=, type=44, desc=6, value=0 STABS> name=, type=44, desc=7, value=7 STABS> name=, type=44, desc=10, value=7 STABS> name=, type=44, desc=12, value=30 STABS> name=, type=44, desc=13, value=36 STABS> name=, type=44, desc=14, value=60 STABS> name=, type=44, desc=17, value=76 STABS> name=, type=44, desc=19, value=99 STABS> name=, type=44, desc=21, value=104 STABS> name=, type=44, desc=23, value=119 STABS> name=, type=44, desc=24, value=123 STABS> name=, type=44, desc=24, value=123 STABS> name=first:F(0,1), type=24, desc=6, value=896 and the non-working stabs: STABS> name=first:F(0,1), type=24, desc=6, value=0 STABS> name=, type=44, desc=6, value=0 STABS> name=, type=44, desc=7, value=7 STABS> name=, type=44, desc=10, value=7 STABS> name=, type=44, desc=12, value=30 STABS> name=, type=44, desc=13, value=36 STABS> name=, type=44, desc=14, value=60 STABS> name=, type=44, desc=17, value=76 STABS> name=, type=44, desc=19, value=99 STABS> name=, type=44, desc=21, value=104 STABS> name=, type=44, desc=23, value=119 STABS> name=, type=44, desc=24, value=123 STABS> name=, type=44, desc=24, value=123 STABS> name=first:F(0,1), type=24, desc=6, value=0 Note that in the non-working version, the only difference is the value of 896 vs 0. 896 should be the start address of the function. There is a possibly relative commment in section G.2 of 'The "stabs" debug format' put out by Cygnus Support: http://sources.redhat.com/cygwin/stabs.html#SEC89 It seems to imply that a value=0 field should be a linker relocated stab. The test program(s) are simple and can be found at: http://people.freebsd.org/~jwd/ldt/ I've searched through the PR database but I can't find any entries that seem related (but then I'm not a GNATS expert either). If anyone knows anything or has any ideas on this, please let me know. Thanks! John -- FreeBSD... The choice of those who know how to choose... (anon) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000825004231.A89090>