[RFA] [gdb.threads/testsuite] failure while checking backtrace into main

Denis PILAT denis.pilat@st.com
Fri Feb 2 15:18:00 GMT 2007


Daniel Jacobowitz wrote:
> On Fri, Feb 02, 2007 at 03:26:13PM +0100, Denis PILAT wrote:
>> We can also just remove the testing of argc and argv from the 
>> pthreads.exp file, that would be better I think.
>
> I like this better.  But, before I approve it, could you show me what
> the output looks like from your compiler - both the backtrace and the
> output of "readelf -wi" for main, argc, and argv?  I bet it's a bug
> that we don't show argc and argv at least as argc=<value optimized out>.
>
>> 2007-02-02  Denis Pilat  <denis.pilat@st.com>
>>
>> 	* gdb.threads/pthreads.exp: remove checking of unused argc and argv
>> 	since they can be removed by a compiler optiisation.
>
> This would be:
>
> 	* gdb.threads/pthreads.exp (check_backtraces): Remove checking
> 	of unused argc and argv.
>
The backtrace is:

thread apply 1 backtrace

Thread 1 (Thread -1218551680 (LWP 2236)):
#0  0x00560aec in nanosleep () from /lib/tls/libc.so.6
#1  0x0056090f in sleep () from /lib/tls/libc.so.6
#2  0x0804891f in main () at 
/project/flexdbug/user/pd10/gdb/sts-gdb-repository/vendor/gdb/gdb/testsuite/gdb.threads/pthreads.c:166 

53      if (verbose) printf("common_routine (%d)\n", arg);
(gdb) FAIL: gdb.threads/pthreads.exp: check backtrace from main thread



The readelf for a gcc4.1.1 is:

 <1><423>: Abbrev Number: 14 (DW_TAG_subprogram)
     DW_AT_sibling     : <4ad>   
     DW_AT_external    : 1   
     DW_AT_name        : main   
     DW_AT_decl_file   : 1   
     DW_AT_decl_line   : 118   
     DW_AT_type        : <f5>   
     DW_AT_low_pc      : 0x804876b   
     DW_AT_high_pc     : 0x804893d   
     DW_AT_frame_base  : 0xb0    (location list)
 <2><440>: Abbrev Number: 15 (DW_TAG_formal_parameter)
     DW_AT_name        : argc   
     DW_AT_decl_file   : 1   
     DW_AT_decl_line   : 116   
     DW_AT_type        : <f5>   
 <2><44c>: Abbrev Number: 15 (DW_TAG_formal_parameter)
     DW_AT_name        : argv   
     DW_AT_decl_file   : 1   
     DW_AT_decl_line   : 117   
     DW_AT_type        : <4ad>   

There is no location for argc and argv. It might be a gcc4.1.1 bug, I 
don't know how much it can optimize the code, argc and argv are not used.

For gcc3.3 there are DW_AT_location for both argc and argv.

-- 
Denis



More information about the Gdb-patches mailing list