This is the mail archive of the 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 12 Apr 2002, Martin Baulig wrote:

> Hi,
> I was recently working a bit on debugging support for C# (using Mono)
> and I need a way to tell GDB about the lifetime of local variables. In
> C#, the JIT engine may decide to store two different variables at the
> same stack offset if they aren't used throughout the whole function.
> Now I was wondering how to do this - DWARF 2 already has a
> `DW_AT_begin_scope' but unfortunately no `DW_AT_end_scope' - can we
> add this or something similar as a GNU extension ?
> After looking at the code, I found out that `struct symbol' contains a
> `ranges' field which seems to do exactly what I want - but this field
> isn't used anywhere.

And the reason ranges isn't use anywhere is because it was part of a 
hackish extension to STABS for live range support.
The code to produce the live range extensions to STABS was never 
added to gcc in any public release.

If you are using DWARF2, you already can describe variable 
lifetimes/changing locations using location lists. 

While it would seem GDB has no support for them at current, rest assured 
1. Patches to support location expressions, which is what location lists 
are made up of, have been submitted.
2. Location lists are a trivial extension of #1.

In fact, I already have support for them sitting in a patch on my 
harddrive, i'm waiting for the location expression support to be approved 
before i submit location list support.

GCC's cfg-branch will now produce location lists for optimized code, and I 
added support to readelf for reading them.

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