Bug 847497 - semantic error: dwarf_getlocation_addr failed, invalid DWARF: identifier...
semantic error: dwarf_getlocation_addr failed, invalid DWARF: identifier...
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jakub Jelinek
Fedora Extras Quality Assurance
Depends On:
Blocks: 847510
  Show dependency treegraph
Reported: 2012-08-12 05:19 EDT by Roman Rakus
Modified: 2014-01-12 19:14 EST (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 847510 (view as bug list)
Last Closed: 2013-07-31 20:59:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Roman Rakus 2012-08-12 05:19:58 EDT
Description of problem:
Systemtap poorly parses dwarf and says "$SUMMARY".

Version-Release number of selected component (if applicable):
$ rpm -q bash bash-debuginfo systemtap

How reproducible:

Steps to Reproduce:
1. stap -e 'probe process("bash").function("execute_builtin"){print("%p\n", $words)}'
Actual results:
$ stap -e 'probe process("bash").function("execute_builtin"){print("%p\n", $words)}'
semantic error: dwarf_getlocation_addr failed, invalid DWARF: identifier '$words' at <input>:1:65
        source: probe process("bash").function("execute_builtin"){print("%p\n", $words)}

Expected results:
semantic error: not accessible at this address (?)
The best would be if systemtap says the variable is optimized out, like GDB.

Additional info:
Comment 1 Jan Kratochvil 2012-08-12 06:50:50 EDT
GNU C 4.7.0 20120507 (Red Hat 4.7.0-5) -m64 -mtune=generic -march=x86-64 -g -O2 -fexceptions -fstack-protector --param ssp-buffer-size=4

GCC used DW_OP_GNU_parameter_ref at the callee but DW_OP_reg4 (rsi) at the caller.  Caller is inlined function.

(gdb) bt
#0  execute_builtin (..., words=<optimized out>) at execute_cmd.c:4047
#1  0x0000000000431873 in execute_builtin_or_function (words=0x6fb260)
                       at execute_cmd.c:4546
#2  execute_simple_command (...) at execute_cmd.c:3956
(gdb) set debug entry-values 1
(gdb) p words
Cannot find matching parameter at DW_TAG_GNU_call_site 0x431873 at execute_simple_command
$2 = <optimized out>

 <1><1c2c4>: Abbrev Number: 68 (DW_TAG_subprogram)
    <1c2c5>   DW_AT_abstract_origin: <0x1b17a>
         <1><1b17a>: Abbrev Number: 38 (DW_TAG_subprogram)
            <1b17b>   DW_AT_name        : execute_builtin
 <2><1c2fa>: Abbrev Number: 73 (DW_TAG_formal_parameter)
    <1c2fb>   DW_AT_abstract_origin: <0x1b197>
         <2><1b197>: Abbrev Number: 36 (DW_TAG_formal_parameter)
            <1b198>   DW_AT_name        : words
    <1c2ff>   DW_AT_location    : 6 byte block: fa d 18 0 0 9f
                         (DW_OP_GNU_parameter_ref: <0x1b197>; DW_OP_stack_value)
 <4><1eb7f>: Abbrev Number: 55 (DW_TAG_GNU_call_site)
    <1eb80>   DW_AT_low_pc      : 0x431873
 <5><1eb96>: Abbrev Number: 56 (DW_TAG_GNU_call_site_parameter)
    <1eb97>   DW_AT_location    : 1 byte block: 54      (DW_OP_reg4 (rsi))
    <1eb99>   DW_AT_GNU_call_site_value: 2 byte block: 73 0
                                                       (DW_OP_breg3 (rbx): 0)
        = it is really 'words'
Comment 2 Jakub Jelinek 2012-08-14 10:01:01 EDT
Short testcase for -g -O2:

struct A { struct A *a; void *b; };
typedef int FN (struct A *);
extern void *v;

foo (struct A *x, FN *y, int z)
  baz (x, y, z);

static int
bar (FN *x, struct A *y, int z, int w)
  if (v)
    undef (8, v);
  (*x) (y->a);

baz (struct A *x, FN *y, int z)
  bar (y, x, z, 0);
  return 0;

I don't think this is a GCC bug, the thing is that ISRA changes the argument from struct A * into struct A ** and the y->a read into *ISRA.xxx read.
Comment 3 Jakub Jelinek 2012-08-14 11:19:56 EDT
Even better testcase:

struct A
#ifdef PAD
  void *c;
  struct A *a;
  void *b;
typedef int FN (struct A *);
extern void *v;
struct A *fn (void);

foo (FN *y, int z)
  struct A *x = fn ();
  baz (x, y, z);

static int
bar (FN *x, struct A *y, int z, int w)
  if (v)
    undef (8, v);
  (*x) (y->a);

baz (struct A *x, FN *y, int z)
  bar (y, x, z, 0);
  return 0;

The reason IPA-SRA does this transformation is that it hopes it could then scalarize the structure in the caller.  If it does, then usually there is no way to reconstruct the original argument, if it doesn't, then yes, one could in the callee reconstruct the argument by adding some constant (0 in this case) to the magic ISRA.NNN argument.  But is it worth it?  It could be done only if all callers have the argument not scalarized.
Comment 4 Fedora End Of Life 2013-07-03 18:50:04 EDT
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '17'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 17's end of life.

Bug Reporter:  Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 17 is end of life. If you 
would still like  to see this bug fixed and are able to reproduce it 
against a later version  of Fedora, you are encouraged  change the 
'version' to a later Fedora version prior to Fedora 17's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 5 Fedora End Of Life 2013-07-31 20:59:57 EDT
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.