This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[patch] Fix for gdb.python/python-value with gcc-4.3.1
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: archer at sourceware dot org
- Date: Tue, 14 Oct 2008 12:55:21 -0700 (PDT)
- Subject: [patch] Fix for gdb.python/python-value with gcc-4.3.1
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1224014123; bh=4C9xPZck23o6P5M6SH47WgggP2c=;h=DomainKey-Signature:To:Subject:Message-Id:Date:From; b=tXX36AKQFWllyXe8Oxi8nWS7qrvUgmcJaGiXSQKGJ7U8OuvCUnhP7M/ge/smCIUJC/BHXdjyGzDR5NDa6YXQnQ==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=to:subject:message-id:date:from;b=XljW8CqnbUh+z4q4YITBqe4jYldMTGYHZtKWxyd/AoKitCNsh8BV0RPd51TJcwlbTrfm3wEMBUf6yj3R2vzd+Q==
Greetings,
Another obvious one:
With gcc-4.{1,2,3} in 32-bit mode, I get:
FAIL: gdb.python/python-value.exp: print argv
FAIL: gdb.python/python-value.exp: verify dereferenced value
This is happening because gcc optimizes out unused argv[]:
$ gdb64-cvs gdb.python/python-value
GNU gdb (GDB) 6.8.50.20081010-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Warning: /usr/local/google/ppluzhnikov/Archive/archer/obj.32/gdb/testsuite/../READONLY/google3: No such file or directory.
(gdb) b main
Breakpoint 1 at 0x8048459: file ../../../gdb/testsuite/gdb.python/python-value.c, line 37.
(gdb) r
Breakpoint 1, main (argc=<value optimized out>, argv=<value optimized out>) at ../../../gdb/testsuite/gdb.python/python-value.c:37
37 s.a = 3;
(gdb) p argv
$1 = <value optimized out>
(gdb) q
OK?
--
Paul Pluzhnikov
2008-10-14 Paul Pluzhnikov <ppluzhnikov@google.com>
* gdb.python/python-value.c: Prevent gcc from optimizing argv[] out.
diff --git a/gdb/testsuite/gdb.python/python-value.c b/gdb/testsuite/gdb.python/python-value.c
index 82cfd9a..0180ed5 100644
--- a/gdb/testsuite/gdb.python/python-value.c
+++ b/gdb/testsuite/gdb.python/python-value.c
@@ -30,6 +30,7 @@ union u
int
main (int argc, char *argv[])
{
+ char *cp = argv[0]; /* Prevent gcc from optimizing argv[] out. */
struct s s;
union u u;