Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* any expression to tell whether a variable was optimized out?
@ 2009-03-10  9:48 Alexandre Oliva
  2009-03-10 12:59 ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Alexandre Oliva @ 2009-03-10  9:48 UTC (permalink / raw)
  To: gdb

Hi,

I'm working on a debug info quality testsuite for GCC, and I've been
having some trouble telling, in gdb macros, a variable for which no
location expression is available at a certain point in the program (but
for which we do have locations at other points), from one that evaluates
to zero (lifetime constant, or stored in register or memory).

Consider:

(gdb) p x
$1 = <value optimized out>
(gdb) p y
$2 = 0
(gdb) p x == y
1
(gdb) p &x
Can't take address of "x" which isn't an lvalue.
(gdb) p &y
Address requested for identifier "y" which is in register $r12

(gdb) set $temp1 = x
(gdb) set $temp2 = y
(gdb) set z = $temp1 == $temp2
(gdb) p z
1

(gdb) set $temp1 = x + 1
(gdb) set $temp2 = y + 1
(gdb) set z = $temp1 == $temp2
(gdb) p z
1



Is there really no way to set a gdb variable to something equivalent to
the boolean result of valprint.c:value_optimized_out()?  Any reason for
that, other than that nobody needed it before?

Thanks in advance,

-- 
Alexandre Oliva           http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-17 21:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-10  9:48 any expression to tell whether a variable was optimized out? Alexandre Oliva
2009-03-10 12:59 ` Daniel Jacobowitz
2009-03-10 15:48   ` Thiago Jung Bauermann
2009-03-10 16:45     ` Alexandre Oliva
2009-03-10 18:45       ` Thiago Jung Bauermann
2009-03-10 18:48         ` Thiago Jung Bauermann
2009-03-17 21:07         ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox