89 lines
3.2 KiB
Diff
89 lines
3.2 KiB
Diff
|
From c77016a72a59a2f32be370d2c8d6729baa97191c Mon Sep 17 00:00:00 2001
|
||
|
From: Tom de Vries <tdevries@suse.de>
|
||
|
Date: Wed, 24 Jul 2024 14:44:33 +0200
|
||
|
Subject: [PATCH 10/46] [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>
|
||
|
---
|
||
|
gdb/testsuite/gdb.cp/m-static.exp | 15 +++++++++++----
|
||
|
gdb/testsuite/lib/gdb-utils.exp | 8 ++++++++
|
||
|
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 45bc090d01f..5b41898ec9d 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 95c53d030d8..41989da3ed2 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.
|
||
|
|
||
|
--
|
||
|
2.43.0
|
||
|
|