Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] [gdb.threads/testsuite] failure while checking backtrace into main
@ 2007-01-31 19:36 Denis PILAT
  2007-02-02 14:28 ` Denis PILAT
  0 siblings, 1 reply; 5+ messages in thread
From: Denis PILAT @ 2007-01-31 19:36 UTC (permalink / raw)
  To: gdb-patches

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

While checking for non-regression in the gdb.threads part of the 
testsuite, I noticed one test fails with gcc4 since the argument of the 
main are removed by the compiler so don't appear when printing backtrace:
FAIL: gdb.threads/pthreads.exp: check backtrace from main thread

Either we can change the .exp file to avoid checking these arguments, or 
we can ensure compiler keeps them as proposed hereby.

-- 
Denis Pilat
STMicroelectronics

[-- Attachment #2: pthreads.c.patch --]
[-- Type: text/plain, Size: 532 bytes --]

2007-01-31  Denis Pilat  <denis.pilat@st.com>

	* gdb.threads/pthreads.c: ensure argc and argv won't be removed by
	a compiler optimization.

Index: testsuite/gdb.threads/pthreads.c
===================================================================
--- testsuite/gdb.threads/pthreads.c	(revision 553)
+++ testsuite/gdb.threads/pthreads.c	(working copy)
@@ -122,6 +122,8 @@ main(argc, argv)
   void (*xxx) ();
   pthread_attr_t attr;
 
+  if (argv);
+  j = argc;
   if (verbose) printf ("pid = %d\n", getpid());
 
   foo (1, 2, 3);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] [gdb.threads/testsuite] failure while checking backtrace into main
  2007-01-31 19:36 [RFA] [gdb.threads/testsuite] failure while checking backtrace into main Denis PILAT
@ 2007-02-02 14:28 ` Denis PILAT
  2007-02-02 14:36   ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Denis PILAT @ 2007-02-02 14:28 UTC (permalink / raw)
  To: gdb-patches

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


> While checking for non-regression in the gdb.threads part of the 
> testsuite, I noticed one test fails with gcc4 since the argument of 
> the main are removed by the compiler so don't appear when printing 
> backtrace:
> FAIL: gdb.threads/pthreads.exp: check backtrace from main thread
>
> Either we can change the .exp file to avoid checking these arguments, 
> or we can ensure compiler keeps them as proposed hereby.

We can also just remove the testing of argc and argv from the 
pthreads.exp file, that would be better I think.

-- 
Denis


[-- Attachment #2: pthreads.exp.patch --]
[-- Type: text/plain, Size: 743 bytes --]

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.

Index: testsuite/gdb.threads/pthreads.exp
===================================================================
--- testsuite/gdb.threads/pthreads.exp	(revision 553)
+++ testsuite/gdb.threads/pthreads.exp	(working copy)
@@ -261,7 +261,7 @@
     # Check that the "thread apply N backtrace" command works
 
     gdb_test "thread apply $main_id backtrace" \
-	    ".* in main \\(argc=.*, argv=.*\\).*" \
+	    ".* in main \\(.*\\).*" \
 	    "check backtrace from main thread"
     gdb_test "thread apply $thread1_id backtrace" \
 	    ".* in thread1 \\(arg=0xfeedface\\).*" \

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] [gdb.threads/testsuite] failure while checking backtrace into main
  2007-02-02 14:28 ` Denis PILAT
@ 2007-02-02 14:36   ` Daniel Jacobowitz
  2007-02-02 15:18     ` Denis PILAT
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-02-02 14:36 UTC (permalink / raw)
  To: Denis PILAT; +Cc: gdb-patches

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.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] [gdb.threads/testsuite] failure while checking backtrace into main
  2007-02-02 14:36   ` Daniel Jacobowitz
@ 2007-02-02 15:18     ` Denis PILAT
  2007-02-03  1:35       ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Denis PILAT @ 2007-02-02 15:18 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] [gdb.threads/testsuite] failure while checking backtrace into main
  2007-02-02 15:18     ` Denis PILAT
@ 2007-02-03  1:35       ` Daniel Jacobowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-02-03  1:35 UTC (permalink / raw)
  To: gdb-patches

On Fri, Feb 02, 2007 at 04:10:18PM +0100, Denis PILAT wrote:
> 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.

The missing location is strange, since you're compiling without
optimization; that's probably a bug.  But it's a separate bug that
they don't show up in the list; I'd rather fix dwarf2read.c than the
test.

IIRC the problem is that we use different LOC_* values for function
arguments.  I have a patch somewhere that used a different mechanism,
so that we could mark arguments as LOC_OPTIMIZED_OUT.  I'll try to port
it to the current GDB next week.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-02-03  1:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-31 19:36 [RFA] [gdb.threads/testsuite] failure while checking backtrace into main Denis PILAT
2007-02-02 14:28 ` Denis PILAT
2007-02-02 14:36   ` Daniel Jacobowitz
2007-02-02 15:18     ` Denis PILAT
2007-02-03  1:35       ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox