Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [PATCH] Outwit compiler dead code elimination in break.exp test (revised patch)
@ 2003-12-08  4:20 Michael Elizabeth Chastain
  2003-12-08 23:49 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2003-12-08  4:20 UTC (permalink / raw)
  To: fnf; +Cc: cagney, gdb-patches

The interesting part: before and after tests.

native i686-pc-linux-gnu, gcc 2.95.3 and 3.3.2, dwarf-2 and stabs+.

To save time, I tested only gdb.base.

All tests came out the same, except for the new names, such as:

  OLD: gdb.base/break.exp: hit silent break 79
  NEW: gdb.base/break.exp: hit silent break bp_location1

This is okay.  In fact, I like the new names better than the old names.

---

These files need updates to copyright years:

  condbreak.exp
  define.exp
  ena-dis-br.exp
  info-proc.exp
  maint.exp

---

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.

---

This wording is confusing:

  "Some of the tests that use this file compile it with optimization on,
   which can result in these functions being optimized away.  So it is
   compiled into a a [sic] separate object file."

This confuses me.  The first line suggests that the sentence is still
optimizing away the functions!  How about something like:

  "These functions are in a separate source file to prevent an optimizing
   compiler from inlining them and optimizing them away."

---

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] 5+ messages in thread
* [PATCH] Outwit compiler dead code elimination in break.exp test
@ 2003-11-29 23:05 Fred Fish
  2003-12-01 17:52 ` Andrew Cagney
  0 siblings, 1 reply; 5+ 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] 5+ messages in thread

end of thread, other threads:[~2003-12-09  5:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-08  4:20 [PATCH] Outwit compiler dead code elimination in break.exp test (revised patch) Michael Elizabeth Chastain
2003-12-08 23:49 ` Andrew Cagney
2003-12-09  5:06   ` [PATCH] Outwit compiler dead code elimination in break.exp test Fred Fish
  -- strict thread matches above, loose matches on Subject: below --
2003-11-29 23:05 Fred Fish
2003-12-01 17:52 ` Andrew Cagney
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

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