stap make check - process_test and sched_test failure

Li Guanglei guanglei@cn.ibm.com
Tue Jul 25 10:26:00 GMT 2006


Roland McGrath ??:
>> I tried and found the trouble is that the compiler will optimize some 
>> functions e.g. handle_signal as inline. And currently we can't fetch 
>> the arguments of an inline function.
> 
> Please look into why it's not working.  In theory it ought to work.
> Is the compiler producing the location info?

I use "readelf -w" to get the DWARF info of my kernel:
...
  <1><671e1>: Abbrev Number: 77 (DW_TAG_subprogram)
      DW_AT_sibling     : <67316>
      DW_AT_name        : (indirect string, offset: 0x5525): handle_signal
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 1008
      DW_AT_prototyped  : 1
      DW_AT_type        : <5e0be>
      DW_AT_inline      : 1      (inlined)
  <2><671f3>: Abbrev Number: 78 (DW_TAG_formal_parameter)
      DW_AT_name        : sig
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 1005
      DW_AT_type        : <5e0ab>
  <2><671ff>: Abbrev Number: 78 (DW_TAG_formal_parameter)
      DW_AT_name        : ka
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 1005
      DW_AT_type        : <64fd0>
...

You can see that no location info is generated.

I wrote a simple program to check how the gcc generate the DWARF info:

inline int foo(int foo_a, int foo_b)
{
         int a;
         printf("in foo\n");
         a=100;
         return foo_a+foo_b+a;
}

int main(void)
{
         printf("%dn", foo(3,5));
         return 0;
}

It shows me that gcc without any optimization option will generate 
location info for arguments of an inline function:

  <1><4f>: Abbrev Number: 2 (DW_TAG_subprogram)
      DW_AT_sibling     : <b1>
      DW_AT_external    : 1
      DW_AT_name        : foo
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 2
      DW_AT_prototyped  : 1
      DW_AT_type        : <b1>
      DW_AT_low_pc      : 0x10000418
      DW_AT_high_pc     : 0x1000047c
      DW_AT_frame_base  : 0      (location list)
  <2><6c>: Abbrev Number: 3 (DW_TAG_formal_parameter)
      DW_AT_name        : foo_a
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 1
      DW_AT_type        : <b1>
      DW_AT_location    : 2 byte block: 91 68    (DW_OP_fbreg: -24)
  <2><7c>: Abbrev Number: 3 (DW_TAG_formal_parameter)
      DW_AT_name        : foo_b
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 1
      DW_AT_type        : <b1>
      DW_AT_location    : 2 byte block: 91 6c    (DW_OP_fbreg: -20)


While gcc with -O2 or -Os option will not generate the location info:

  <1><25>: Abbrev Number: 2 (DW_TAG_subprogram)
      DW_AT_sibling     : <6c>
      DW_AT_external    : 1
      DW_AT_name        : foo
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 2
      DW_AT_prototyped  : 1
      DW_AT_type        : <6c>
      DW_AT_inline      : 3      (declared as inline and inlined)
  <2><37>: Abbrev Number: 3 (DW_TAG_formal_parameter)
      DW_AT_name        : (indirect string, offset: 0x38): foo_a
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 1
      DW_AT_type        : <6c>
  <2><42>: Abbrev Number: 3 (DW_TAG_formal_parameter)
      DW_AT_name        : (indirect string, offset: 0x0): foo_b
      DW_AT_decl_file   : 1
      DW_AT_decl_line   : 1
      DW_AT_type        : <6c>

  Is this a bug of GCC?



More information about the Systemtap mailing list