This is the mail archive of the gdb@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: Lifetime of local variables


On Sat, Apr 13, 2002 at 01:31:05PM +0200, Martin Baulig wrote:
> Daniel Jacobowitz <drow@mvista.com> writes:
> > Also, I believe that this should be entirely subsumed by .debug_loc. 
> > The first variable's value may no longer be available, but it has not
> > actually gone out of scope, has it?  We should list it but claim that
> > its value is unavailable.
> 
> It has actually gone out of scope. I want to use this to debug machine
> generated IL code and the JIT may want to create local variables
> on-the-fly. For variables which have actually been defined by a human
> programmer, listing them and claiming that their value is no longer
> available is IMHO the right thing to do - but I'd like to tell the
> debugger to make a machine-generated variable disappear when it's no
> longer used, otherwise you'd get a large number of automatic variables
> (having numbers, not names, which makes it even more confusing to the
> user) and only a very few of them are actually used.

What business does the JIT have actually creating local variables
(rather than temporaries, which don't get names)?  I don't understand.

> Btw. are there any plans to implement .debug_loc anytime soon, I need
> this for something else ?

I believe it's in progress.

On Sat, Apr 13, 2002 at 02:42:14PM +0200, Martin Baulig wrote:
> Momchil Velikov <velco@fadata.bg> writes:
> > One can use DT_AT_artificial to distinguish machine generated
> > temporaries and the .debug_loc ranges to decide whether to display the
> > variable.
> 
> What happens if you're outside any of the ranges listed in .debug_loc -
> will the variable be listed or not or will this depend on DW_AT_artificial ?
> 
> IMHO variables which have been created by a human should always be
> listed, but machine generated ones (since there can be a large number
> of them) should only be listed withing their lifetime ranges.

We don't know yet, since DW_AT_artificial is currently only used for
method arguments (and methods, but that patch is pending).  Once we've
got .debug_loc we can decide, but this seems reasonable to me.


-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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