This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fix spurious FAILs with examine-backward.exp
- From: Andreas Arnez <arnez at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 20 Mar 2017 17:56:18 -0000
- Subject: [binutils-gdb] Fix spurious FAILs with examine-backward.exp
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=59a561480d547d041127630b1ba17a284eef8225
commit 59a561480d547d041127630b1ba17a284eef8225
Author: Andreas Arnez <arnez@linux.vnet.ibm.com>
Date: Mon Mar 20 18:55:39 2017 +0100
Fix spurious FAILs with examine-backward.exp
The test case examine-backward.exp issues the command "x/-s" after the end
of the first string in TestStrings, but without making sure that this
string is preceded by a string terminator. Thus GDB may spuriously print
some random characters from before that string, and then the test fails.
This patch assures that TestStrings is preceded by a string terminator.
gdb/testsuite/ChangeLog:
* gdb.base/examine-backward.c (Barrier): New character array
constant, to ensure that TestStrings is preceded by a string
terminator.
Diff:
---
gdb/testsuite/ChangeLog | 6 ++++++
gdb/testsuite/gdb.base/examine-backward.c | 8 ++++++++
2 files changed, 14 insertions(+)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 018104c..2386c0a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-20 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.base/examine-backward.c (Barrier): New character array
+ constant, to ensure that TestStrings is preceded by a string
+ terminator.
+
2017-03-16 Andreas Arnez <arnez@linux.vnet.ibm.com>
* lib/dwarf.exp: Add support for DW_OP_implicit_pointer.
diff --git a/gdb/testsuite/gdb.base/examine-backward.c b/gdb/testsuite/gdb.base/examine-backward.c
index 5e9162a..462089d 100644
--- a/gdb/testsuite/gdb.base/examine-backward.c
+++ b/gdb/testsuite/gdb.base/examine-backward.c
@@ -32,6 +32,14 @@ literals. The content of each array is the same as followings:
};
*/
+/* This is here just to ensure we have a null character before
+ TestStrings, to avoid showing garbage when we look for strings
+ backwards from TestStrings. */
+
+const char Barrier[] = {
+ 0x00,
+};
+
const char TestStrings[] = {
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50,