public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PUSHED] gdb/testsuite: use gdb_get_line_number
@ 2021-11-05 12:31 Andrew Burgess
  0 siblings, 0 replies; only message in thread
From: Andrew Burgess @ 2021-11-05 12:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

Replaces a hard coded line number with a use of gdb_get_line_number.

I suspect that the line number has, over time, come adrift from where
it was supposed to be stopping.  When the test was first added, line
770 pointed at the final 'return 0' in function main.  Over time, as
things have been added, line 770 now points at some random location in
the middle of main.

So, I've marked the 'return 0' with a comment, and now the test will
always stop there.

I also removed an old comment from 1997 talking about how these tests
will only pass with the HP compiler, followed by an additional comment
from 2000 saying that the tests now pass with GCC.

I get the same results before and after this change.
---
 gdb/testsuite/gdb.cp/templates.cc  |  2 +-
 gdb/testsuite/gdb.cp/templates.exp | 20 +++-----------------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/gdb/testsuite/gdb.cp/templates.cc b/gdb/testsuite/gdb.cp/templates.cc
index 49cf6b66eff..d6120e2dd1c 100644
--- a/gdb/testsuite/gdb.cp/templates.cc
+++ b/gdb/testsuite/gdb.cp/templates.cc
@@ -801,5 +801,5 @@ int main()
 
   arg.method(empty);
 
-  return 0;
+  return 0;	/* Final breakpoint.  */
 }
diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp
index 388c4f268cc..8370beb95b5 100644
--- a/gdb/testsuite/gdb.cp/templates.exp
+++ b/gdb/testsuite/gdb.cp/templates.exp
@@ -278,23 +278,9 @@ do_tests
 
 # More tests for different kinds of template parameters,
 # templates with partial specializations, nested templates, etc.
-# These have been tested only with HP aCC.  They probably won't
-# work with other compilers because of differences in mangling
-# schemes. 
-# Added by Satish Pai <pai@apollo.hp.com> 1997-09-25 
-# As of 2000-06-03, C++ support has been improved to the point that g++ can
-# pass all of theses, excluding what appears to be one that exposes a stabs bug. - djb
-
-# I don't know how HP could be passing these tests without this. They
-# weren't breakpointing past a point where the below expressions were
-# initialized in the actual source. - djb
-
-gdb_test "b 770" \
-    "Breakpoint .* at .*, line 770."
-
-gdb_test "c" \
-    "Continuing.*Breakpoint .*" \
-    "continue to line 770"
+
+gdb_breakpoint [gdb_get_line_number "Final breakpoint"]
+gdb_continue_to_breakpoint "Final breakpoint"
 
 gdb_test "print fint" \
    "\\$\[0-9\]* = \\{x = 0, t = 0\\}"
-- 
2.25.4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-05 12:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 12:31 [PUSHED] gdb/testsuite: use gdb_get_line_number Andrew Burgess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).