This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC/PATCH] Extend gdb_core_cmd to allow "Cannot access memory..." messages
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <palves at redhat dot com>
- Date: Tue, 24 Mar 2015 20:06:05 -0400
- Subject: [RFC/PATCH] Extend gdb_core_cmd to allow "Cannot access memory..." messages
- Authentication-results: sourceware.org; auth=none
Hi,
While hacking the coredump_filter patch, I noticed that, when you load a
corefile on GDB and receive a "Cannot access memory at address..."
message, gdb_core_cmd will fail and return -1, which means that some
fatal error happened.
Unfortunately, this kind of message does not mean that the user cannot
continue debugging with the corefile; it meant that some memory region
(sometimes not important) was inaccessible. Given that
gcore_create_callback, nowadays, will dump memory regions if they don't
have the 'read' permission set (but have any other permission set), this
kind of error can be expected sometimes.
I would like to propose this patch to be applied, which will allow the
test to continue even if this message is triggered. I was not sure
wether I should use a "pass" or "xfail" there, so I chose the second
(which makes more sense to me).
WDYT?
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
gdb/testsuite/ChangeLog:
2015-03-24 Sergio Durigan Junior <sergiodj@redhat.com>
* lib/gdb.exp (gdb_core_cmd): Handle "Cannot access memory at
address..." message.
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f274b64..48b50b5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3573,7 +3573,7 @@ proc gdb_gcore_cmd {core test} {
# -1 - core file failed to load
proc gdb_core_cmd { core test } {
- global gdb_prompt
+ global gdb_prompt hex
gdb_test_multiple "core $core" "$test" {
-re "\\\[Thread debugging using \[^ \r\n\]* enabled\\\]\r\n" {
@@ -3591,6 +3591,10 @@ proc gdb_core_cmd { core test } {
fail "$test (incomplete note section)"
return 0
}
+ -re "Cannot access memory at address $hex\r\n$gdb_prompt $" {
+ pass "$test (could not access some memory regions)"
+ return 0
+ }
-re "Core was generated by .*\r\n$gdb_prompt $" {
pass "$test"
return 1