[PATCH] Harden gdb.arch/aarch64-pauth.exp and fix a failure

Luis Machado luis.machado@linaro.org
Fri Feb 21 21:06:00 GMT 2020


When running this testcase against a QEMU with PAC support, i noticed we
were failing to recognize the additional [PAC] that is emitted in the
backtrace, resulting in this failure:

FAIL: gdb.arch/aarch64-pauth.exp: backtrace

I've made the test use multi_line to make the pattern more clear.

Tested against aarch64-linux-gnu with and without PAC support.

gdb/testsuite/ChangeLog:

2020-02-21  Luis Machado  <luis.machado@linaro.org>

	* gdb.arch/aarch64-pauth.exp: Recognize optional PAC output.

Signed-off-by: Luis Machado <luis.machado@linaro.org>
---
 gdb/testsuite/gdb.arch/aarch64-pauth.exp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.arch/aarch64-pauth.exp b/gdb/testsuite/gdb.arch/aarch64-pauth.exp
index 816e58be44..e6d25c5d97 100644
--- a/gdb/testsuite/gdb.arch/aarch64-pauth.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-pauth.exp
@@ -40,4 +40,9 @@ gdb_breakpoint [ gdb_get_line_number "break here" ]
 gdb_continue_to_breakpoint "break here" ".*break here.*"
 
 # Ensure we can get a full backtrace, despite the address signing.
-gdb_test "bt" "^bt\r\n#0 +bar *\\(b=9\\) +at.*\r\n#1 +0x\[0-9a-f\]* +in +foo \\(a=5\\).*\r\n#2 +0x\[0-9a-f\]* +in +main \\(\\).*" "backtrace"
+gdb_test "bt" \
+    [multi_line \
+	"#0\[ \t\]*bar \\(b=9\\) at \[^\r\n\]+" \
+	"#1\[ \t\]*$hex (\\\[PAC\\\] )?in foo \\(a=5\\) at \[^\r\n\]+" \
+	"#2\[ \t\]*$hex (\\\[PAC\\\] )?in main \\(\\) at \[^\r\n\]+" ] \
+    "backtrace"
-- 
2.17.1



More information about the Gdb-patches mailing list