Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [dsdp-dd-dev] local variables view modes

On Fri, Jun 09, 2006 at 01:43:31PM -0500, John Cortell wrote:
> You brought up a valid point, but it's not unique to the feature I've 
> described. Some symbolics formats don't track the transitional nature 
> of a variable. At some point in a function, the variable might be 
> stored in the stack frame, at another point it's being stored and 
> manipulated in registers. But throughout the entire function call, 
> the sym format says the variable is x bytes into the stack frame. So, 
> the debugger provides, effectively, a misleading representation of 
> the variables depending on where you are in the function.
> 
> So, the rule is: when you're dealing with optimized code, you need to 
> be a little skeptical of what the debugger tells you.

... Unless you have a good debugger and a good compiler!  A little
skepticism never hurt anyone, but we can do far better than this
given DWARF.

For instance, recent versions of GCC will be glad to give you
reasonably accurate live range information; if the variable is dead, it
will show up as unavailable.  Of course there's times where modifying
the copy the debugger knows about will have unpredictable effects
because of another copy, but in general this works well.

I'd highly recommend that if your debugger can provide out of scope
variables, it indicate them clearly.

-- 
Daniel Jacobowitz
CodeSourcery


Back to the top