Files
binutils-gdb/gdb/testsuite/gdb.python/py-objfile.c
Tom de Vries 112608984f [gdb/testsuite] Fix gdb.python/py-objfile.exp with gcc 15
When running test-case gdb.python/py-objfile.exp with gcc 15, we get:
...
(gdb) p main^M
$2 = {int (void)} 0x40066c <main>^M
(gdb) FAIL: $exp: print main with debug info
...

The source file declares main as "int main ()"
...
and until C23 this meant a non-prototype function declaration and we'd have:
...
(gdb) p main^M
$2 = {int ()} 0x40066c <main>^M
...

However, starting C23 "int main ()" is simply equivalent to "int main (void)".

Fix this by:
- declaring main as "int main (void)" in the test-case, and
- updating the regexp to expect an "int (void)" prototype.

Likewise in gdb.base/jit-bfd-name.exp.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>

PR testsuite/32756
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32756
2025-04-29 17:30:07 +02:00

27 lines
879 B
C

/* This testcase is part of GDB, the GNU debugger.
Copyright 2011-2025 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/>. */
int global_var = 42;
static int __attribute__ ((used)) static_var = 50;
int
main (void)
{
int some_var = 0;
return 0;
}