public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Sami Wagiaalla <swagiaal@redhat.com>
To: Sami Wagiaalla <swagiaal@redhat.com>
Cc: frysk <frysk@sourceware.org>
Subject: Re: Dwarf expertise needed
Date: Tue, 19 Jun 2007 21:11:00 -0000	[thread overview]
Message-ID: <46783F81.3090906@redhat.com> (raw)
In-Reply-To: <4677FA4B.8000600@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1017 bytes --]

This is a run of the above test-case with more details:

There are two issues:
get_addrdie() does not return the correct die:

calling get_addrdie() with address 0x8048369
returned die: DW_TAG_compile_unit name: 
/to/scratch/swagiaal/frysks/frysk.patches/frysk-core/frysk/pkglibdir/funit-scopes.c

But it can be seen from the attached relevenat debug info that the 
address actually falls within the expanded instance of the inlined function.

The other issue is that in the test case where it works the complete 
hierarchy of scopes is not returned. Is there a bug or what is the 
correct way of getting the hierarchy of scopes that a die belongs to ? 
Frysk uses dwarf_getscopes()
>>   
>> ------------------------------------------------------------------------
>>
>> #include <stdlib.h>
>>
>> void crash(int param1){
>>   int* a = 0;
>>   a[0] = param1;
>> }
>>
>> inline void second(int w){
>>   crash(0);
>> }
>>
>> void first(){
>>   second(0);
>> }
>>
>> int main(){
>>
>>   first(0);
>>
>>   return 0;
>> }


[-- Attachment #2: debug_info --]
[-- Type: text/plain, Size: 1406 bytes --]


The section .debug_info contains:

  Compilation Unit @ offset 0x0:
   Length:        227
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
     DW_AT_stmt_list   : 0	
     DW_AT_high_pc     : 0x80483aa	
     DW_AT_low_pc      : 0x8048344	
     DW_AT_producer    : (indirect string, offset: 0xbc): GNU C 4.1.1 20070105 (Red Hat 4.1.1-51)	
     DW_AT_language    : 1	(ANSI C)
     DW_AT_name        : (indirect string, offset: 0x62): /to/scratch/swagiaal/frysks/frysk.patches/frysk-core/frysk/pkglibdir/funit-scopes.c	
[...]

 <1><9d>: Abbrev Number: 7 (DW_TAG_subprogram)
     DW_AT_external    : 1	
     DW_AT_name        : (indirect string, offset: 0x5b): second	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 8	
     DW_AT_inline      : 3	(declared as inline and inlined)
 <1><a6>: Abbrev Number: 4 (DW_TAG_subprogram)
     DW_AT_sibling     : <ce>	
     DW_AT_external    : 1	
     DW_AT_name        : (indirect string, offset: 0xb6): first	
     DW_AT_decl_file   : 1	
     DW_AT_decl_line   : 12	
     DW_AT_low_pc      : 0x8048353	
     DW_AT_high_pc     : 0x8048370	
     DW_AT_frame_base  : 0x2c	(location list)
 <2><be>: Abbrev Number: 8 (DW_TAG_inlined_subroutine)
     DW_AT_abstract_origin: <9d>	
     DW_AT_low_pc      : 0x8048365	
     DW_AT_high_pc     : 0x804836a	
     DW_AT_call_file   : 1	
     DW_AT_call_line   : 13	


  reply	other threads:[~2007-06-19 20:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19 15:22 Sami Wagiaalla
2007-06-19 15:46 ` Sami Wagiaalla
2007-06-19 18:28   ` Sami Wagiaalla
2007-06-19 21:11     ` Sami Wagiaalla [this message]
2007-06-19 21:27       ` Roland McGrath
2007-06-19 21:31         ` Sami Wagiaalla
2007-06-19 21:31           ` Roland McGrath
2007-07-17 17:07             ` Sami Wagiaalla
2007-07-18  9:03               ` Roland McGrath
2007-07-18 15:38                 ` Sami Wagiaalla
2007-07-18 22:43                   ` Roland McGrath
2007-07-19 15:31                     ` Sami Wagiaalla
2007-07-21  0:29                       ` Roland McGrath
2007-07-26 15:42                         ` Sami Wagiaalla
2007-08-07  9:04                           ` Roland McGrath
2007-08-09 17:06                             ` Sami Wagiaalla
2007-07-19 15:40                 ` Sami Wagiaalla
2007-06-19 21:38           ` Sami Wagiaalla
2007-06-19 21:58         ` Sami Wagiaalla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46783F81.3090906@redhat.com \
    --to=swagiaal@redhat.com \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).