[Dwarf-Discuss] Lexical block address ranges when nesting

Ron Brender ron.brender at charter.net
Mon Nov 10 04:56:28 PST 2008


Martin Day wrote:
> Thanks for all the replies on this issue...

 >I guess the question is : can the debugger just rely on the address 
ranges to determine which variables are in scope or should it just use 
the scope block types (subroutine, lexical block, inlined subroutine, 
etc.) or must it use both?

I guess the answer is: the debugger *definitely* must use the scope 
block types *as well as* the address ranges. The several distinct DIE 
scope types are defined by DWARF for the simple reason that they are 
necessary for a producer to accurately describe the compiled code and 
for the consumer to accurately reconstruct the program state for a user.

Which is not to say that DWARF provides all the tools that might 
possibly be needed. There are any number of optimizations that cannot 
yet be properly described (for example, code merging that destroys scope 
nesting, many/most dependence analysis based optimizations, and lots of 
others). Indeed, in many cases it is not clear that a "proper" 
description is even feasible! We are always open to ideas and proposals 
for how to improve DWARF for optimized code--especially based on real 
implementation experience.

Conversely, my take is that few compiler/debugger products today even 
come close to exploiting the full descriptive capability that is already 
available in DWARF.

> I agree with Ron's email too. I think it would probably be helpful to explicitly
state this in the standard.

At the risk of stating what seems like it should be obvious, we might 
add a sentence to the end of third paragraph of 3.4 that reads something 
like

     "The addresses associated with a lexical block necessarily include
     the addresses associated with any nested lexical block."

Does that address (boo, hiss!) your concern?






More information about the Dwarf-Discuss mailing list