From 707ed39ac5cb255f656b2947b50c8273c8ad1d80 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Fri, 5 Nov 2021 12:14:01 +0000 Subject: [PATCH] gdb/testsuite: use gdb_get_line_number 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 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.30.2