Files
binutils-gdb/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug-caller.c
Fedora GDB patches fb054b5e08 gdb/testsuite: Test for a backtrace through object without debuginfo
Fedora has been carrying this test since back in the Project Archer
days. A change back then caused GDB to stop being able to backtrace when
only some of the object files had debug information. Even though the
changed code never seems to have made its way into the main GDB project,
I think it makes sense to bring the test along to ensure something like
this doesn't pass unnoticed.
2024-02-14 15:38:26 +01:00

29 lines
1.0 KiB
C

/* This testcase is part of GDB, the GNU debugger.
Copyright 2005-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/>. */
typedef int (*callback_t) (void);
int
caller (callback_t callback)
{
/* Ensure some frame content to push away the return address. */
volatile const long one = 1;
/* Modify the return value to prevent any tail-call optimization. */
return (*callback) () - one;
}