Note that there are some explanatory texts on larger screens.

plurals
  1. PODWARF info seem to be wrong for DW_AT_high_pc with gcc 4.8.2
    primarykey
    data
    text
    <p>As a newbie to DWARF, I tried the code presented <a href="http://eli.thegreenplace.net/2011/02/07/how-debuggers-work-part-3-debugging-information/" rel="nofollow">in this page</a> (code is <a href="http://eli.thegreenplace.net/files/prog_code/articles_code/debugger/dwarf_get_func_addr.c" rel="nofollow">here</a>) but when I launch it I get:</p> <pre><code>$&gt; ./dwarf_get_func_addr tracedprog DW_TAG_subprogram: 'do_stuff' abort() in libdwarf. No error argument, no handler. zsh: abort (core dumped) ./dwarf_get_func_addr tracedprog </code></pre> <p>After a debugging session, the problem appears to come from line 78:</p> <pre><code> else if (attrcode == DW_AT_high_pc) dwarf_formaddr(attrs[i], &amp;highpc, 0); </code></pre> <p>The problem is, the <code>form</code> of <code>attrs[i]</code> shows <code>attrs[i]</code> is not an address (it is set to 7 instead of 1). Exploring <code>tracedprog</code> with <code>objdump</code> it gives, for <code>do_stuff</code> function:</p> <pre><code>&lt;1&gt;&lt;73&gt;: Numéro d'abréviation: 4 (DW_TAG_subprogram) &lt;74&gt; DW_AT_external : 1 &lt;74&gt; DW_AT_name : (chaîne indirecte, décalage: 0x55): do_stuff &lt;78&gt; DW_AT_decl_file : 1 &lt;79&gt; DW_AT_decl_line : 4 &lt;7a&gt; DW_AT_prototyped : 1 &lt;7a&gt; DW_AT_low_pc : 0x400500 &lt;82&gt; DW_AT_high_pc : 0x3f &lt;8a&gt; DW_AT_frame_base : 1 bloc d'octets: 9c (DW_OP_call_frame_cfa) &lt;8c&gt; DW_AT_GNU_all_tail_call_sites: 1 &lt;8c&gt; DW_AT_sibling : &lt;0xb9&gt; </code></pre> <p>In this output, <code>DW_AT_high_pc</code> doesn't seem correct to me as it is only two octets long.</p> <p>For your reference, I compiled <code>tracedprog</code> with:</p> <pre><code>$&gt; gcc -g tracedprog2.c -o tracedprog </code></pre> <p><strong>Edit</strong> it seems to be a <code>gcc</code> issue as there is no issue on another machine. I am using <code>gcc 4.8.2</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload