This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

Re: [RFC/RFA] gdb.cp/classes.exp: Don't try to print local variableout of scope



>BTW, my proposed replacement is woefully inaccurate, which I should
>have realized before posting.  I do not have a good solution to this
>problem without actually turning back time :)


I'm wondering what the 3.4 wierdness MichaelC's refering to is.


I dunno.  But the problem here appears to be that there is a lexical
block which ends before the epilogue, containing the local variables.
Unlike the inner scope blocks, this one ends before they are destroyed.
Maybe that's a bug after all.

GDB can't tell the difference - for a variable that has gone out of scope, gdb can't tell if it has or hasn't been destroyed -- it has to trust GCC.


However [to play sick mind games] there's nothing in the rule book saying that GDB/GCC need to follow the language rules. It should be possible for GCC to manipulate things such that a variable remains visible until its location has been reused.

Now consider this example:


>>> 10 0x10 <stuff>: ret		stuff(int) { }
>>> 11 0x20 <main>: push		main() {
>>> 12 0x21 <main+1>: push			{
>>> 13 0x22 <main+2>: move arg1, i			stuff(i)
>>> 14 0x23 <main+3>: call stuff			  "
>>> 15                  			}
>>> 16 0x25 <main+5>: pop  2; ret	}


Andrew



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