aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/symbol-alias2.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2020-09-17 23:33:42 +0100
committerPedro Alves <pedro@palves.net>2020-09-18 00:07:41 +0100
commita8129512f6cd2ce6cbf379f3bec00fe41c304a43 (patch)
tree297a93fffb7484c8a67c6567e6b3c5c4fef78b63 /gdb/testsuite/gdb.base/symbol-alias2.c
parenta83cdcb636a661fe0070160d58b69a27be9ae079 (diff)
downloadgdb-a8129512f6cd2ce6cbf379f3bec00fe41c304a43.zip
gdb-a8129512f6cd2ce6cbf379f3bec00fe41c304a43.tar.gz
gdb-a8129512f6cd2ce6cbf379f3bec00fe41c304a43.tar.bz2
gdb.base/{prologue,symbol-alias}.exp C++ify
Make these testcases work when compiled as C++ programs. These testcases use the alias attribute, which requires passing in the target function's mangled name in C++. To avoid having to figure out how the functions are mangled, explicitly specify a linkage name. This is preferred over 'extern "C"' because that doesn't work with static functions. gdb/testsuite/ChangeLog: * gdb.base/prologue.c [__cplusplus] (marker): Explicitly specify linkage name. * gdb.base/prologue.exp: Use print /d. * gdb.base/symbol-alias.exp: Handle C++ output. * gdb.base/symbol-alias2.c: Handle C++ output. [__cplusplus] (func): Explicitly specify linkage name.
Diffstat (limited to 'gdb/testsuite/gdb.base/symbol-alias2.c')
-rw-r--r--gdb/testsuite/gdb.base/symbol-alias2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/symbol-alias2.c b/gdb/testsuite/gdb.base/symbol-alias2.c
index e53c212..2c6185f 100644
--- a/gdb/testsuite/gdb.base/symbol-alias2.c
+++ b/gdb/testsuite/gdb.base/symbol-alias2.c
@@ -23,6 +23,12 @@ struct S
struct S g_var_s = { 1, 2 };
+#ifdef __cplusplus
+/* So that the alias attribute below work without having to figure out
+ this function's mangled name. */
+static struct S *func (void) asm ("func");
+#endif
+
static struct S *
func (void)
{