Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Outwit compiler dead code elimination in break.exp test
@ 2003-11-29 23:05 Fred Fish
  2003-11-30  1:04 ` Fred Fish
  2003-12-01 17:52 ` Andrew Cagney
  0 siblings, 2 replies; 20+ messages in thread
From: Fred Fish @ 2003-11-29 23:05 UTC (permalink / raw)
  To: gdb-patches; +Cc: fnf

2003-11-29  Fred Fish  <fnf@redhat.com>

	* gdb.base/break.c (globalvar): Add.
	(marker1, marker2, marker3, marker4): Set globalvar.

Index: gdb.base/break.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/break.c,v
retrieving revision 1.3
diff -c -p -r1.3 break.c
*** gdb.base/break.c	13 Nov 2003 15:34:39 -0000	1.3
--- gdb.base/break.c	29 Nov 2003 22:57:41 -0000
*************** char *arg;
*** 37,54 ****
   * as places to try setting breakpoints at.  They are explicitly
   * "one-line functions" to verify that this case works (some versions
   * of gcc have or have had problems with this).
   */
  
  #ifdef PROTOTYPES
! int marker1 (void) { return (0); }
! int marker2 (int a) { return (1); } /* set breakpoint 8 here */
! void marker3 (char *a, char *b) {}
! void marker4 (long d) {} /* set breakpoint 14 here */
  #else
! int marker1 () { return (0); }
! int marker2 (a) int a; { return (1); } /* set breakpoint 9 here */
! void marker3 (a, b) char *a, *b; {}
! void marker4 (d) long d; {}  /* set breakpoint 13 here */
  #endif
  
  /*
--- 37,58 ----
   * as places to try setting breakpoints at.  They are explicitly
   * "one-line functions" to verify that this case works (some versions
   * of gcc have or have had problems with this).
+  * Recent versions of gcc have gotten smart enough that they will not
+  * call functions that have no use or visible side effect, so use
+  * globalvar to outwit the compiler for a while longer.
   */
  
+ int globalvar;
  #ifdef PROTOTYPES
! int marker1 (void) { globalvar = 1; return (0); }
! int marker2 (int a) { globalvar = 2; return (1); } /* set breakpoint 8 here */
! void marker3 (char *a, char *b) {globalvar = 3;}
! void marker4 (long d) {globalvar = 4;} /* set breakpoint 14 here */
  #else
! int marker1 () { globalvar = 1; return (0); }
! int marker2 (a) int a; { globalvar = 2; return (1); } /* set breakpoint 9 here */
! void marker3 (a, b) char *a, *b; {globalvar = 3;}
! void marker4 (d) long d; {globalvar = 4;}  /* set breakpoint 13 here */
  #endif
  
  /*


^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [PATCH] Outwit compiler dead code elimination in break.exp test
@ 2003-12-01 16:55 Michael Elizabeth Chastain
  0 siblings, 0 replies; 20+ messages in thread
From: Michael Elizabeth Chastain @ 2003-12-01 16:55 UTC (permalink / raw)
  To: fnf; +Cc: ezannoni, gdb-patches

ff> The messages will now be something like:
ff>   PASS: gdb.base/break.exp: set to-be-silent break bp_location1
ff> instead of:
ff>   PASS: gdb.base/break.exp: set to-be-silent break 83

Mmmmm, a test suite discussion.  Can I throw two cents in?  :)

Either message looks fine to me.  It's important that the message
be unique within the test script, and either message would be unique
within the test script.  And it's important that the message not change
from run to run, and "break 83" does not change from run to run
unless someone actually changes the test script.

So "break 83" wasn't a big problem but "break bp_location1" appeals
more to me esthetically.

Michael C


^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [PATCH] Outwit compiler dead code elimination in break.exp test (revised patch)
@ 2003-12-08 23:49 Andrew Cagney
  2003-12-09  5:06 ` [PATCH] Outwit compiler dead code elimination in break.exp test Fred Fish
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew Cagney @ 2003-12-08 23:49 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: fnf, gdb-patches


> ---
> 
> break.c and break1.c need copyright notices.
> Andrew C can provide a list of years for break.c,
>   covering the time before it was moved to sourceware.

Fred, in case you're wondering, one of the Red Hat chores is to, on 
demand, track down the pre-history of files with no copyright status.

The history:

gdb/testsuite/gdb.base/break.c:
date: 2003/11/13 15:34:39;  author: ezannoni;  state: Exp;  lines: +14 -14
date: 2002/01/07 19:21:26;  author: law;  state: Exp;  lines: +52 -2
date: 1999/04/16 01:34:30;  author: shebs;  state: Exp;

The "pre-history":

gdb/testsuite/gdb.base/break.c:
date: 1999/10/02 00:24:35;  author: kevinb;  state: Exp;  lines: +2 -1
date: 1999/09/08 18:18:56;  author: shebs;  state: Exp;  lines: +1 -1
date: 1999/06/25 23:44:28;  author: shebs;  state: Exp;  lines: +19 -0
date: 1995/04/17 19:55:19;  author: kingdon;  state: Exp;  lines: +2 -2
date: 1995/03/24 22:06:03;  author: kung;  state: Exp;  lines: +4 -0
date: 1995/03/16 00:06:48;  author: grossman;  state: Exp;  lines: +3 -3
date: 1994/06/07 01:56:04;  author: shebs;  state: Exp;

gdb/testsuite/gdb.t06/gdbme.c (yep!):
date: 1994/06/07 22:51:18;  author: shebs;  state: dead;  lines: +0 -0
date: 1993/02/25 18:51:37;  author: ian;  state: Exp;

gdb/testsuite/gdb.t06/in-gdb.c (I kid you not!):
date: 1993/02/25 18:51:38;  author: ian;  state: dead;  lines: +0 -0
date: 1993/02/21 20:01:14;  author: mtw;  state: Exp;
         * gdb/testsuite: Initial creation of gdb/testsuite.
         Migrated dejagnu testcases and support files for testing nm to
         gdb/testsuite from deja-gnu.  These files were moved "as is"
         with no modifications.  This migration is part of a major overhaul
         of dejagnu.  The modifications to these testcases, etc., which
         will allow them to work with the new version of dejagnu will be
         made in a future update.

deja-gnu/deja-gnu/gdb.t06/in-gdbme.c (I kid you not!):
date: 1993/10/14 00:10:57;  author: rich;  state: dead;  lines: +0 -0
date: 1992/11/04 22:31:42;  author: ian;  state: Exp;  lines: +13 -0
date: 1992/10/23 18:57:46;  author: ian;  state: Exp;  lines: +18 -4
date: 1992/08/09 05:03:10;  author: rob;  state: Exp;  lines: +6 -1
date: 1992/07/18 03:22:58;  author: rob;  state: Exp;

So not a bad list of copyright years!

Andrew

PS: In case no one believes me, this is the original code:

#include <stdio.h>

/*
  * The following functions do nothing useful.  They are included simply
  * as places to try setting breakpoints at.  They are explicitly
  * "one-line functions" to verify that this case works (some versions
  * of gcc have or have had problems with this).
  */

int marker1 () { return (0); }
int marker2 (a) int a; { return (1); }
void marker3 (a, b) char *a, *b; {}
void marker4 (d) long d; {}

/*
  *      This simple classical example of recursion is useful for
  *      testing stack backtraces and such.
  */

main (argc, argv, envp)
int argc;
char *argv[], **envp;
{
     if (argc != 2) {
         fprintf (stderr, "usage:  factorial <number>\n");
         exit (1);
     } else {
         printf ("%d\n", factorial (atoi (argv[1])));
     }
     marker1 ();
     marker2 (43);
     marker3 ("stack", "trace");
     marker4 (177601976L);
     exit (0);
}

int factorial (value)
int value;
{
     if (value > 1) {
         value *= factorial (value - 1);
     }
     return (value);
}



^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [PATCH] Outwit compiler dead code elimination in break.exp test
@ 2003-12-09  6:52 Michael Elizabeth Chastain
  2003-12-29 20:20 ` Elena Zannoni
  0 siblings, 1 reply; 20+ messages in thread
From: Michael Elizabeth Chastain @ 2003-12-09  6:52 UTC (permalink / raw)
  To: fnf; +Cc: ac131313, gdb-patches

It works for me.  My before-and-after tests came out clean again; all
the copyright dates look good; and the comment about the separate file
is exactly what I wanted.

Endorsed for approval.

(I'm trying to come up with some word that means "I don't have approval
authority but I'll vouch for this patch" ... "endorsed"?  "recommended"?)

Michael C

===

2003-12-07  Fred Fish  <fnf@redhat.com>

	* gdb.base/break.c (marker1, marker2, marker3, marker4): Move
	functions to break1.c and leave prototypes behind.  Add more
	"set breakpoint NN here" comments.
	* gdb.base/break1.c: New file.

	* gdb.base/break.exp: Handle compiling test case from multiple
	source files and change source file references as needed.
	* gdb.base/completion.exp: Ditto.
	* gdb.base/condbreak.exp: Ditto.
	* gdb.base/define.exp: Ditto.
	* gdb.base/ena-dis-br.exp: Ditto.
	* gdb.base/info-proc.exp: Ditto.
	* gdb.base/maint.exp: Ditto.
	* gdb.base/until.exp: Ditto.

	* gdb.base/condbreak.exp: Use bp_locationNN variables instead of
	hardcoded line numbers.
	* gdb.base/define.exp: Ditto.
	* gdb.base/ena-dis-br.exp: Ditto.
	* gdb.base/maint.exp: Ditto.
	* gdb.base/until.exp: Ditto.

	* gdb.base/completion.exp: Use "break1" for completion tests since
	"break" is no longer a unique prefix.


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

end of thread, other threads:[~2003-12-29 20:20 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-29 23:05 [PATCH] Outwit compiler dead code elimination in break.exp test Fred Fish
2003-11-30  1:04 ` Fred Fish
2003-11-30  1:07   ` Daniel Jacobowitz
2003-11-30  1:26     ` Fred Fish
2003-12-01  0:46     ` Fred Fish
2003-12-01 14:58       ` Elena Zannoni
2003-12-01 15:30         ` Fred Fish
2003-12-01 15:46           ` Elena Zannoni
2003-12-01 16:39             ` Fred Fish
2003-12-01 14:23     ` Elena Zannoni
2003-12-01 14:44       ` Daniel Jacobowitz
2003-12-01 17:52 ` Andrew Cagney
2003-12-01 18:10   ` Fred Fish
2003-12-09  1:02     ` Michael Snyder
2003-12-07 21:21   ` [PATCH] Outwit compiler dead code elimination in break.exp test (revised patch) Fred Fish
2003-12-08  0:31     ` Andrew Cagney
2003-12-01 16:55 [PATCH] Outwit compiler dead code elimination in break.exp test Michael Elizabeth Chastain
2003-12-08 23:49 [PATCH] Outwit compiler dead code elimination in break.exp test (revised patch) Andrew Cagney
2003-12-09  5:06 ` [PATCH] Outwit compiler dead code elimination in break.exp test Fred Fish
2003-12-09  6:52 Michael Elizabeth Chastain
2003-12-29 20:20 ` Elena Zannoni

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