From owner-freebsd-current Thu Jan 6 3: 5:14 2000 Delivered-To: freebsd-current@freebsd.org Received: from shadowmere.student.utwente.nl (wit401305.student.utwente.nl [130.89.236.145]) by hub.freebsd.org (Postfix) with ESMTP id 1D3D714C05 for ; Thu, 6 Jan 2000 03:05:11 -0800 (PST) (envelope-from daeron@Wit401305.student.utwente.nl) Received: by shadowmere.student.utwente.nl (Postfix, from userid 1000) id CBF761F8B; Thu, 6 Jan 2000 12:05:06 +0100 (CET) Date: Thu, 6 Jan 2000 12:05:06 +0100 From: Pascal Hofstee To: freebsd-current@freebsd.org Subject: GDB Problems ! Message-ID: <20000106120506.A31489@shadowmere.student.utwente.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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