|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
strange gdb behaviorHi,
Who could help understand this: `--> cat 1.c int main(int argc, char **argv) { return 0; } `--> cc -ggdb -o 1 1.c `--> gdb 1 GNU gdb 6.1.1 [FreeBSD] Copyright 2004 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 "i386-marcel-freebsd"... (gdb) set args test (gdb) b main Breakpoint 1 at 0x80483d0: file 1.c, line 3. (gdb) r Starting program: /tmp/1 test Breakpoint 1, main () at 1.c:3 3 { (gdb) print argc Error accessing memory address 0x0: Bad address. (gdb) list 1 int 2 main(int argc, char **argv) 3 { 4 return 0; 5 } checked on 9.0-CURRENT, 8.0-BETA3 -- // Max N. Boyarov _______________________________________________ freebsd-hackers@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..." |
|
|
Re: strange gdb behaviorOn Mon, Nov 02, 2009 at 03:52:33PM +0200, Max Boyarov wrote:
> Hi, > > Who could help understand this: > > `--> cat 1.c > int > main(int argc, char **argv) > { > return 0; > } > > [snip] > > (gdb) set args test > (gdb) b main > Breakpoint 1 at 0x80483d0: file 1.c, line 3. > (gdb) r > Starting program: /tmp/1 test > > Breakpoint 1, main () at 1.c:3 > 3 { > (gdb) print argc > Error accessing memory address 0x0: Bad address. > (gdb) list > 1 int > 2 main(int argc, char **argv) > 3 { > 4 return 0; > 5 } > > checked on 9.0-CURRENT, 8.0-BETA3 > FreeBSD wep4035 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r198671: Fri Oct 30 16:12:10 CET 2009 root@wep4035:/usr/obj/usr/src/sys/GENERIC amd64 I have the following: (gdb) set args test (gdb) b main Breakpoint 1 at 0x40052b: file 1.c, line 4. (gdb) r Starting program: /home/lexx/1 test Breakpoint 1, main (argc=2, argv=0x7fffffffe790) at 1.c:4 4 return 0; (gdb) list 1 int 2 main(int argc, char **argv) 3 { 4 return 0; 5 } (gdb) print argc $1 = 2 (gdb) Note that the breakpoint is set to line 4, not line 3 as in your case. There was a series of changes to the linker recently. Update to the latest CURRENT might help. HTH, Alexey. _______________________________________________ freebsd-hackers@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..." |
|
|
Re: strange gdb behaviorOn Mon, Nov 02, 2009 at 03:52:33PM +0200, Max Boyarov wrote:
> Hi, > > Who could help understand this: > > `--> cat 1.c > int > main(int argc, char **argv) > { > return 0; > } > > > `--> cc -ggdb -o 1 1.c > > > `--> gdb 1 > GNU gdb 6.1.1 [FreeBSD] > Copyright 2004 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 "i386-marcel-freebsd"... > (gdb) set args test > (gdb) b main > Breakpoint 1 at 0x80483d0: file 1.c, line 3. > (gdb) r > Starting program: /tmp/1 test > > Breakpoint 1, main () at 1.c:3 > 3 { > (gdb) print argc > Error accessing memory address 0x0: Bad address. > (gdb) list > 1 int > 2 main(int argc, char **argv) > 3 { > 4 return 0; > 5 } > > checked on 9.0-CURRENT, 8.0-BETA3 With gdb 7.0, (gdb) b main Breakpoint 1 at 0x8048414: file hello.c, line 8. (gdb) r Starting program: /usr/home/kostik/build/bsd/6/stuff/hello1 Breakpoint 1, main (argc=1, argv=0xbfbfe53c) at hello.c:8 8 for (i = 0; i < argc; i++) while in-tree gdb shows me the same behaviour as yours. |
|
|
Re: strange gdb behaviorKostik Belousov <kostikbel@...> writes:
> On Mon, Nov 02, 2009 at 03:52:33PM +0200, Max Boyarov wrote: >> Hi, [cut] > > Can you check it on RELENG_7 ? It seems to be another old gdb bug. > With gdb 7.0, > (gdb) b main > Breakpoint 1 at 0x8048414: file hello.c, line 8. > (gdb) r > Starting program: /usr/home/kostik/build/bsd/6/stuff/hello1 > > Breakpoint 1, main (argc=1, argv=0xbfbfe53c) at hello.c:8 > 8 for (i = 0; i < argc; i++) > > while in-tree gdb shows me the same behaviour as yours. $ cat gdbt.c #include <unistd.h> int main(int argc, char **argv) { int t; t = getopt(argc, argv, "f:"); return t; } $ cat gdbt.gdb b main run print &argc next print &argc list quit $ cat gdbt.sh #!/bin/sh uname -mr cc -O0 -ggdb -o gdbt gdbt.c && gdb -nx -quiet -x gdbt.gdb gdbt 9.0-CURRENT i386 / r198846 Breakpoint 1 at 0x80483f0: file gdbt.c, line 5. Breakpoint 1, main (argc=Error accessing memory address 0x2: Bad address. ) at gdbt.c:5 5 { $1 = (int *) 0x2 main (argc=1, argv=0xbfbfe7e0) at gdbt.c:8 8 t = getopt(argc, argv, "f:"); $2 = (int *) 0xbfbfe7c0 3 int 4 main(int argc, char **argv) 5 { 6 int t; 7 8 t = getopt(argc, argv, "f:"); 9 10 return t; 11 } 9.0-CURRENT amd64 /r198480 Breakpoint 1 at 0x40057f: file gdbt.c, line 8. Breakpoint 1, main (argc=1, argv=0x7fffffffeac0) at gdbt.c:8 8 t = getopt(argc, argv, "f:"); $1 = (int *) 0x7fffffffea5c 10 return t; $2 = (int *) 0x7fffffffea5c 5 { 6 int t; 7 8 t = getopt(argc, argv, "f:"); 9 10 return t; 11 } 7.2-RELEASE-p1 i386 Breakpoint 1 at 0x8048400: file gdbt.c, line 5. Breakpoint 1, main (argc=Error accessing memory address 0x2: Bad address. ) at gdbt.c:5 5 { $1 = (int *) 0x2 main (argc=1, argv=0xbfbfeca4) at gdbt.c:8 8 t = getopt(argc, argv, "f:"); $2 = (int *) 0xbfbfec80 3 int 4 main(int argc, char **argv) 5 { 6 int t; 7 8 t = getopt(argc, argv, "f:"); 9 10 return t; 11 } 7.2-RELEASE-p4 amd64 Breakpoint 1 at 0x40057f: file gdbt.c, line 8. Breakpoint 1, main (argc=1, argv=0x7fffffffebc8) at gdbt.c:8 8 t = getopt(argc, argv, "f:"); $1 = (int *) 0x7fffffffeb5c 10 return t; $2 = (int *) 0x7fffffffeb5c 5 { 6 int t; 7 8 t = getopt(argc, argv, "f:"); 9 10 return t; 11 } -- Max N. Boyarov xmpp:zotrix@... _______________________________________________ freebsd-hackers@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..." |
|
|
Re: strange gdb behaviorm.boyarov@... (Max N. Boyarov) writes:
> 9.0-CURRENT i386 / r198846 > [broken] > 9.0-CURRENT amd64 /r198480 > [works] > 7.2-RELEASE-p1 i386 > [broken] > 7.2-RELEASE-p4 amd64 > [works] See a pattern? DES -- Dag-Erling Smørgrav - des@... _______________________________________________ freebsd-hackers@... mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@..." |
| Free embeddable forum powered by Nabble | Forum Help |