This is the mail archive of the dwarf2@corp.sgi.com mailing list for the dwarf2 project.


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

Re: PROPOSAL: augmentation for "thin" inlines


> 
> What gets put in DW_AT_call_line in a nested-2-deep inlined
> subroutine?  The DW_AT_call_line of the non-inlined-code or
> the line of the inlined-caller?
> I don't find this question answered in the proposal... did I miss something?
> 

   I covered that case in the discussion part.  It's the call-site that
   actually has a textual call to the innermost inline expansion.  With my
   example:

       1: extern int func();
       2: extern void eat(int x);
       3:
       4: inline int triple(int x)     { return x * 3; }
       5: inline int tripleplus(int x) { return triple(x) + 1; }
       6:
       7: int main() {
       8:    int  i = func();
       9:    int  j = tripleplus(i);
      10:    eat(j);
      11: }

   We get:

      DW_TAG_inlined_subroutine
      DW_AT_abstract_origin(DW_FORM_ref_addr) -> DIE for tripleplus
      DW_AT_low_pc(DW_FORM_addr)              ..inline.tripleplus_start
      DW_AT_high_pc(DW_FORM_addr)             ..inline.tripleplus_end
      DW_AT_call_line(DW_FORM_udata)          9
         :
         DW_TAG_inlined_subroutine
         DW_AT_abstract_origin(DW_FORM_ref_addr) -> DIE for triple
         DW_AT_low_pc(DW_FORM_addr)              ..inline.triple_start
         DW_AT_high_pc(DW_FORM_addr)             ..inline.triple_end
         DW_AT_call_line(DW_FORM_udata)          5

   If a debugger cares to know the call site of the outermost inline
   expansion, it's always possible for it to traverse up to the outermost
   DW_TAG_inlined_subroutine and use its DW_AT_call_* attributes.  So,
   there's no loss of information doing it this way, and there's certainly a
   gain, since we can present the user at line 5 in the virtual frame for
   tripleplus().

   I could try clarifying the wording in the proposal like this:

   An inlined subroutine entry may also have DW_AT_call_file,
   DW_AT_call_line, DW_AT_call_column attributes, each of whose value is an
   integer constant.  These attributes represent the source file, source
   line number, and source column number, respectively, of the first
   character of the statement or expression that caused the inline expansion.
   They should not refer to declaration coordinates of the original
   declaration, but rather to those of the point at which it was inlined.
 | In the case of an inline expansion within another inline expansion, they
 | should refer to the location of the call within the immediately containing
 | inline expansion which caused the inner inline expansion.
   The DW_AT_call_file attribute corresponds to a file number from the
   statement information table for the compilation unit containing the
   debugging information entry, just as the DW_AT_decl_file attribute does.

-- 
Todd Allen
Concurrent Computer Corporation


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