[Dwarf-Discuss] Lexical block address ranges when nesting

Daniel Jacobowitz drow at false.org
Mon Nov 10 06:53:54 PST 2008


On Mon, Nov 10, 2008 at 11:20:54AM -0000, Martin Day wrote:
> One slight variation on this is would you expect a parent lexical
> block to include the address ranges of the code of an inlined
> subroutine block? If a debugger user single stepped onto an
> instruction from the inlined subroutine then the debugger may well
> show them located on the source code of the subroutine and it may
> confuse them to show them variables from the enclosing blocks which
> aren't actually in scope. 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?

My conclusion, when adding inlined function support to GDB, was that
it must use both to have any sensible behavior.  The PC ranges should
include any lexically nested blocks that are not called out-of-line
(meaning yes to standard lexical blocks, no to nested functions even
though their DIEs are children of the containing lexical scope).  They
should also include any physically nested blocks, (meaning inlined
functions).

My conclusions were partly to accomodate GCC's behavior, but of the
several interpretations I can see this was also the most useful.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Dwarf-Discuss mailing list