Date: Thu, 6 Jan 2000 12:05:06 +0100 From: Pascal Hofstee <daeron@shadowmere.student.utwente.nl> To: freebsd-current@freebsd.org Subject: GDB Problems ! Message-ID: <20000106120506.A31489@shadowmere.student.utwente.nl>
next in thread | raw e-mail | index | archive | help
Hello, I think i already mentioned the following issue several months ago ... but just noticed this again. And considering 4.0 is coming up soon, I really think this ought to be fixed. see the following testcase: #include <stdio.h> int main(int argc, char **argv) { int i = 0; for (i = 0; i < 10; i++) fprintf(stderr, "i = %d\n", i); return 0; } Compiling this program with -ggdb will give normal results (a list of i = 0, upto i = 9). However when running the program through gdb Every Value you can print is completely Bogus, which makes debugging impossible. Things like the following will happen: (gdb) break main Breakpoint 1 at 0x804841e: file gdbtest.c, line 6. (gdb) run Starting program: /home/daeron/./gdbtest Breakpoint 1, main (argc=-1077937360, argv=0x2805e100) at gdbtest.c:6 6 int i = 0; (gdb) (gdb) next 8 for (i = 0; i < 10; i++) (gdb) 9 fprintf(stderr, "i = %d\n", i); (gdb) print i $1 = -1077937368 Notice the completely bogus value of argc, and the same goes for i. the program still outputs the correct values, just requesting them from gdb is broken. Fortunately you can compile it with -g only and GDB Will work properly ... but -ggdb is a flag i encounter quite often for debugging purposes. -- -------------------- Pascal Hofstee - daeron@shadowmere.student.utwente.nl -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GCS d- s+: a-- C++ UB++++ P+ L- E--- W- N+ o? K- w--- O? M V? PS+ PE Y-- PGP-- t+ 5 X-- R tv+ b+ DI D- G e* h+ r- y+ ------END GEEK CODE BLOCK------ 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?20000106120506.A31489>