From 890891f14de5f08a5e5bfa4a6907fb6ec409dd45 Mon Sep 17 00:00:00 2001 From: Guinevere Larsen Date: Fri, 21 Jul 2023 13:45:12 +0200 Subject: gdb/testsuite: fix gdb.reverse/solib-*.exp tests when using clang The tests gdb.reverse/solib-precsave.exp and solib-reverse.exp have the assumption that line tables will have an entry for the closing } in a function. Not all compiles do this, one example being clang. To fix this, this commit changes the function in shr2.c to have multiple lines, and the test to accept either line as a correct step location. To properly re-sync the inferiors, the function repeat_cmd_until had to be slightly changed to work with empty "current locations", so that we are able to step through multiple lines. This also changes the annotations used to determine the breakpoint locations in solib-reverse.c, adding a simple variable assignment right before the return statement. This way GDB will not set a breakpoint in the closing } line. Approved-By: Tom Tromey --- gdb/testsuite/gdb.reverse/shr2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gdb/testsuite/gdb.reverse/shr2.c') diff --git a/gdb/testsuite/gdb.reverse/shr2.c b/gdb/testsuite/gdb.reverse/shr2.c index 84a03de..16c3bf3 100644 --- a/gdb/testsuite/gdb.reverse/shr2.c +++ b/gdb/testsuite/gdb.reverse/shr2.c @@ -19,7 +19,8 @@ int shr2(int x) { - return 2*x; + int y = 2*x; + return y; } int shr2_local(int x) -- cgit v1.1