This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix coredump-filter.exp by correctly unsetting array
- From: Sergio Durigan Junior <sergiodj at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 8 May 2015 17:23:11 -0000
- Subject: [binutils-gdb] Fix coredump-filter.exp by correctly unsetting array
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f7797074a5dc314f8922d2e90c1a4ea04b189c36
commit f7797074a5dc314f8922d2e90c1a4ea04b189c36
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Fri May 8 13:19:19 2015 -0400
Fix coredump-filter.exp by correctly unsetting array
In my last commit to make gdb.base/coredump-filter.exp be more robust
regarding using arrays in the global namespace, I cleared the
"coredump_var_addr" array like this:
set coredump_var_addr ""
# use coredump_var_addr as an array...
This causes DejaGNU to complain because the variable is first set as
non-array, and the used as an array. The correct way to do this is to
unset the variable using:
unset -nocomplain coredump_var_addr
# use coredump_var_addr as an array...
The "-nocomplain" part is necessary because if the variable doesn't
exist "unset" will not error.
Tested on Fedora 20 x86_64.
gdb/testsuite/ChangeLog:
2015-05-08 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.base/coredump-filter.exp: Correctly unset
"coredump_var_addr" array.
Diff:
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.base/coredump-filter.exp | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4064b28..f4ee04a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-05-08 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * gdb.base/coredump-filter.exp: Correctly unset
+ "coredump_var_addr" array.
+
2015-05-08 Pedro Alves <palves@redhat.com>
* gdb.server/non-existing-program.exp: Unset spawn_id.
diff --git a/gdb/testsuite/gdb.base/coredump-filter.exp b/gdb/testsuite/gdb.base/coredump-filter.exp
index 8638ab0..81f5d42 100644
--- a/gdb/testsuite/gdb.base/coredump-filter.exp
+++ b/gdb/testsuite/gdb.base/coredump-filter.exp
@@ -167,7 +167,7 @@ gdb_test_multiple "print/x &main" "getting main's address" {
# Obtain the address of each variable that will be checked on each
# case.
-set coredump_var_addr ""
+unset -nocomplain coredump_var_addr
foreach item $all_anon_corefiles {
foreach name [list [lindex $item 3] [lindex $item 4]] {
set test "print/x $name"