This is the mail archive of the mailing list for the Archer project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix for gdb.python/python-value with gcc-4.3.1


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)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
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:
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


Paul Pluzhnikov

2008-10-14  Paul Pluzhnikov  <>

	* 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
 main (int argc, char *argv[])
+  char *cp = argv[0]; /* Prevent gcc from optimizing argv[] out.  */
   struct s s;
   union u u;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]