From 59305ae6247e86f35bbe94ed1f9599af8f8e6f69 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexandra=20H=C3=A1jkov=C3=A1?= Date: Tue, 2 May 2023 22:33:49 +0200 Subject: [PATCH] gdb.base/watchpoint-unaligned.exp: Always initialize wpoffset_to_wpnum Initialize wpoffset_to_wpnumto avoid TCL error which happens in some aarch64 types. ERROR: in testcase /root/build/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/watchpoint-unaligned.exp ERROR: can't read "wpoffset_to_wpnum(1)": no such element in array ERROR: tcl error code TCL READ VARNAME ERROR: tcl error info: can't read "wpoffset_to_wpnum(1)": no such element in array while executing Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30340 Reviewed-by: Luis Machado Reviewed-By: Andrew Burgess --- gdb/testsuite/gdb.base/watchpoint-unaligned.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp index ce5a1e5bf66..d31a9cdc2c8 100644 --- a/gdb/testsuite/gdb.base/watchpoint-unaligned.exp +++ b/gdb/testsuite/gdb.base/watchpoint-unaligned.exp @@ -103,6 +103,8 @@ foreach wpcount {4 7} { for {set wpoffset 1} {$wpoffset <= $wpcount} {incr wpoffset} { set test "$rwatch data.u.size1\[$wpoffset\]" set wpnum "" + # Initialize the result incase the test fails. + set wpoffset_to_wpnum($wpoffset) 0 gdb_test_multiple $test $test { -re "$rwatch_exp (\[0-9\]+): .*\r\n$gdb_prompt $" { set wpoffset_to_wpnum($wpoffset) $expect_out(1,string) @@ -113,7 +115,6 @@ foreach wpcount {4 7} { setup_xfail breakpoints/23131 "arm*-*-*" } fail $test - set wpoffset_to_wpnum($wpoffset) 0 } } } -- 2.30.2