[Dwarf-Discuss] location-list ranges [Dwarf-Discuss Digest, Vol 34, Issue 2]

Bishop, John E john.e.bishop@intel.com
Wed Mar 24 19:43:11 GMT 2010

First, the "full" info isn't that much larger than the "reduced" info.

Second, I'm not sure that a lexical scope is always required.  E.g., once
there's a DW_TAG_subprogram entry, variables can "live" inside it without
having a DW_TAG_lexical_block entry between the subprogram and the variable.

Third, as a consumer, if you say:

   12 .. 35 DW_OP_reg1

Then I'm going to assume that the value is in reg1 in that range, I won't
try to adjust based on ranges of the parent.  The DWARF says what's true;
if it's not true, don't say it in DWARF!

As you say, if the debuggee is stopped at an instruction which is not in one
of the ranges of the subprogram, then when the user says "p x" my debugger
will look at the PC and find what source scope it should start the name search
from.  So it might be the case that the debugger will say "Can't find any x",
and the effect of a range adjustment will happen.

But if the variable is visible in the scope named by that instruction
or in one of the enclosing scopes, etc., then reg1 will be where my debugger
will look.  And why not?  We assume the user has a bug and wants to know
what's going on, even if language rules would "hide" things.  So the
debugger lets the user see private variables and file-level statics in other
files and so on.  The current value of a live variable which for other reasons
is not source-wise visible is exactly the kind of thing which might help the
user fix the bug!


More information about the Dwarf-discuss mailing list