diff options
author | Pedro Alves <pedro@palves.net> | 2020-09-17 23:33:42 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2020-09-18 00:07:41 +0100 |
commit | a8129512f6cd2ce6cbf379f3bec00fe41c304a43 (patch) | |
tree | 297a93fffb7484c8a67c6567e6b3c5c4fef78b63 /gdb | |
parent | a83cdcb636a661fe0070160d58b69a27be9ae079 (diff) | |
download | gdb-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')
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/prologue.c | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/prologue.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/symbol-alias.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/symbol-alias2.c | 6 |
5 files changed, 23 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 211132a..b123bb6 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2020-09-17 Pedro Alves <pedro@palves.net> + * 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. + +2020-09-17 Pedro Alves <pedro@palves.net> + * gdb.python/py-nested-maps.c (struct key_t): Rename to... (struct my_key_t): ... this. Adjust all references. (struct value_t): Rename to ... diff --git a/gdb/testsuite/gdb.base/prologue.c b/gdb/testsuite/gdb.base/prologue.c index c7de916..717bd3f 100644 --- a/gdb/testsuite/gdb.base/prologue.c +++ b/gdb/testsuite/gdb.base/prologue.c @@ -20,6 +20,12 @@ int leaf (void) return 1; } +#ifdef __cplusplus +/* So that the alias attribute below work without having to figure out + this function's mangled name. */ +int marker (int val) asm ("marker"); +#endif + int marker (int val) { leaf (); diff --git a/gdb/testsuite/gdb.base/prologue.exp b/gdb/testsuite/gdb.base/prologue.exp index ee83488..20ab22e 100644 --- a/gdb/testsuite/gdb.base/prologue.exp +++ b/gdb/testsuite/gdb.base/prologue.exp @@ -59,4 +59,4 @@ set pc1 [find_breakpoint_pc "marker"] set pc2 [find_breakpoint_pc "other"] -gdb_test "print $pc1 == $pc2" "\\\$$decimal = 1" "same pc from minimal symbol" +gdb_test "print /d $pc1 == $pc2" "\\\$$decimal = 1" "same pc from minimal symbol" diff --git a/gdb/testsuite/gdb.base/symbol-alias.exp b/gdb/testsuite/gdb.base/symbol-alias.exp index fcdcce2..1907cad 100644 --- a/gdb/testsuite/gdb.base/symbol-alias.exp +++ b/gdb/testsuite/gdb.base/symbol-alias.exp @@ -27,7 +27,7 @@ if ![runto_main] then { # Functions. foreach f {"func" "func_alias"} { - gdb_test "p $f" " = {struct S \\*\\(void\\)} $hex <func>" + gdb_test "p $f" " = {(struct )?S \\*\\(void\\)} $hex <func(\\(\\))?>" gdb_test "p *${f}()" "= {field1 = 1, field2 = 2}" } 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) { |