This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Make gdb.arch/i386-biarch-core.exp more robust


This test attempts to load a x86 core file no matter what the target
architecture is. If the architecture is not x86, GDB will not recognize
the core file and therefore won't have any memory to inspect. All we will
have is a memory read error, resulting in a FAIL.

The following patch addresses this by checking if we successfully loaded
the core file. If not, just return. Otherwise it keeps testing.

gdb/testsuite/ChangeLog:

2017-01-31  Luis Machado  <lgustavo@codesourcery.com>

	* gdb.arch/i386-biarch-core.exp: Return if core file was not
	recognized.
---
 gdb/testsuite/gdb.arch/i386-biarch-core.exp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.arch/i386-biarch-core.exp b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
index 4c5f450..2776ac3 100644
--- a/gdb/testsuite/gdb.arch/i386-biarch-core.exp
+++ b/gdb/testsuite/gdb.arch/i386-biarch-core.exp
@@ -62,7 +62,16 @@ if {$corestat(size) != 102400} {
 # objcopy as it corrupts the core file beyond all recognition.
 # The output therefore does not matter much, just we should not get GDB
 # internal error.
-gdb_test "core-file ${corefile}" ".*" "core-file"
+set test "load core file"
+gdb_test_multiple "core-file ${corefile}" $test {
+    -re ".* no core file handler recognizes format(.*\r\n)?$gdb_prompt $" {
+	untested $test
+	return
+    }
+    -re "\r\n$gdb_prompt $" {
+	pass $test
+    }
+}
 
 # Test if at least the core file segments memory has been loaded.
 # https://bugzilla.redhat.com/show_bug.cgi?id=457187
-- 
2.7.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]