Files
binutils-gdb/gdb/testsuite/gdb.reverse/shr2.c
Guinevere Larsen 890891f14d 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 <tom@tromey.com>
2023-08-24 11:08:35 +02:00

30 lines
860 B
C

/* This testcase is part of GDB, the GNU debugger.
Copyright 2009-2023 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "shr.h"
int shr2(int x)
{
int y = 2*x;
return y;
}
int shr2_local(int x)
{
return 2*x;
}