aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-07-24 14:44:33 +0200
committerTom de Vries <tdevries@suse.de>2024-07-24 14:44:33 +0200
commitd4cea453901b3f1d1e7ea95e8ce0d7860fa9602b (patch)
tree9a090e7a2bff849bab3dcf2a16c2ef6490ad0eb0 /gdb
parent91a84aaf9a1c72d3b56c8cbc55d32327cdcfb8ce (diff)
downloadgdb-d4cea453901b3f1d1e7ea95e8ce0d7860fa9602b.zip
gdb-d4cea453901b3f1d1e7ea95e8ce0d7860fa9602b.tar.gz
gdb-d4cea453901b3f1d1e7ea95e8ce0d7860fa9602b.tar.bz2
[gdb/testsuite] Fix gdb.cp/m-static.exp on arm
With test-case gdb.cp/m-static.exp on arm-linux, I get: ... (gdb) ptype test5.single_constructor^M type = class single_constructor {^M ^M public:^M single_constructor(void);^M ~single_constructor(void);^M } *(single_constructor * const)^M (gdb) FAIL: gdb.cp/m-static.exp: simple object instance, ptype constructor ... The test-case expects: - no empty line before "public:", and - no "~single_constructor(void)", but "~single_constructor()" The latter is due to commit 137c886e9a6 ("[gdb/c++] Print destructor the same for gcc and clang"). The failing test is in a part only enabled for is_aarch32_target == 1, so it looks like it was left behind. I'm assuming the same happened for the other difference. Fix this by updating the regexps to match the observed output. Tested on arm-linux. Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/gdb.cp/m-static.exp15
-rw-r--r--gdb/testsuite/lib/gdb-utils.exp8
2 files changed, 19 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp
index 45bc090..5b41898 100644
--- a/gdb/testsuite/gdb.cp/m-static.exp
+++ b/gdb/testsuite/gdb.cp/m-static.exp
@@ -71,11 +71,18 @@ if { [is_aarch32_target] } {
gdb_test "print test5.single_constructor" \
{ = {single_constructor \*\(single_constructor \* const\)} 0x[0-9a-f]+ <single_constructor::single_constructor\(\)>} \
"simple object instance, print constructor"
- gdb_test "ptype test5.single_constructor" \
- {type = class single_constructor {\r\n public:\r\n single_constructor\(void\);\r\n ~single_constructor\(\);\r\n} \*\(single_constructor \* const\)} \
+
+ set re \
+ [multi_line_string_to_regexp \
+ "type = class single_constructor {" \
+ "" \
+ " public:" \
+ " single_constructor(void);" \
+ " ~single_constructor(void);" \
+ "} *(single_constructor * const)"]
+ gdb_test "ptype test5.single_constructor" $re \
"simple object instance, ptype constructor"
- gdb_test "ptype single_constructor::single_constructor" \
- {type = class single_constructor {\r\n public:\r\n single_constructor\(void\);\r\n ~single_constructor\(\);\r\n} \*\(single_constructor \* const\)} \
+ gdb_test "ptype single_constructor::single_constructor" $re \
"simple object class, ptype constructor"
gdb_test "print test1.~gnu_obj_1" \
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index 95c53d0..41989da 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -38,6 +38,14 @@ proc string_to_regexp {str} {
return $result
}
+# Convenience function that calls string_to_regexp for each arg, and
+# joins the results using "\r\n".
+
+proc multi_line_string_to_regexp { args } {
+ set res [lmap arg $args {string_to_regexp $arg}]
+ return [multi_line {*}$res]
+}
+
# Given a list of strings, adds backslashes as needed to each string to
# create a regexp that will match the string, and join the result.