diff mbox

[testsuite,committed] fix gdb.dwarf2/staticvirtual.exp regexp

Message ID 560EE854.2040705@codesourcery.com
State New
Headers show

Commit Message

Sandra Loosemore Oct. 2, 2015, 8:25 p.m. UTC
I saw that gdb.dwarf2/staticvirtual.exp was failing on some bare-metal 
targets.  This test manufactures some DWARF for a function at address 
0x1000, and the regexp was only matching if that address wasn't mapped 
on the target.  Our hardware nios2-elf test boards don't have memory 
mapped there, but the simulator we use for testing does.  I also saw 
similar failures on arm-none-eabi.  On Nios II and ARM GNU/Linux targets 
this address is unmapped so the test is passing.

Since it appears that the point of this test is to ensure that GDB 
doesn't crash, I don't think there's any actual requirement for the 
address to be unmapped, and no reason not to generalize the test to 
count any reasonable output as a PASS.  So, I've checked in the attached 
patch under the obvious fix rule.

diff mbox


diff --git a/gdb/testsuite/gdb.dwarf2/staticvirtual.exp b/gdb/testsuite/gdb.dwarf2/staticvirtual.exp
index 06d46e1..dd85b7e 100644
--- a/gdb/testsuite/gdb.dwarf2/staticvirtual.exp
+++ b/gdb/testsuite/gdb.dwarf2/staticvirtual.exp
@@ -51,4 +51,9 @@  if { [prepare_for_testing ${testfile}.exp ${testfile} \
 # gdb/18021: The test below would cause GDB to crash.
-gdb_test "p S::~S" "0x1000"
+# Depending on whether the target maps memory at address 0x1000,
+# on success this may either print something like
+#   $1 = {void (void)} 0x1000 <.*>
+# or
+#   Cannot access memory at address 0x1000
+gdb_test "p S::~S" "0x1000.*"