This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[pushed] Make gdb.base/find-unmapped.exp pass on remote targets
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 13 Oct 2017 16:54:41 +0100
- Subject: [pushed] Make gdb.base/find-unmapped.exp pass on remote targets
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A45D71E318
Currently, with --target_board=native-extended-gdbserver, we get:
Running .../src/gdb/testsuite/gdb.base/find-unmapped.exp ...
FAIL: gdb.base/find-unmapped.exp: find global_var_0, global_var_2, 0xff
FAIL: gdb.base/find-unmapped.exp: find global_var_1, global_var_2, 0xff
FAIL: gdb.base/find-unmapped.exp: find global_var_2, (global_var_2 + 16), 0xff
This commit makes the test pass there, and also enables in on
--target_board=native-gdbserver, and other remote targets.
I've filed PR gdb/22293 to track the missing-warning problem.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
PR gdb/22293
* gdb.base/find-unmapped.exp: Don't skip if is_remote target.
(top level): Move some tests to ...
(test_not_found): ... this new procedure.
(top level): Call it.
---
gdb/testsuite/ChangeLog | 8 ++++
gdb/testsuite/gdb.base/find-unmapped.exp | 66 +++++++++++++++++++++++++-------
2 files changed, 61 insertions(+), 13 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 73389ae..2e7eb1d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2017-10-13 Pedro Alves <palves@redhat.com>
+ PR gdb/22293
+ * gdb.base/find-unmapped.exp: Don't skip if is_remote target.
+ (top level): Move some tests to ...
+ (test_not_found): ... this new procedure.
+ (top level): Call it.
+
+2017-10-13 Pedro Alves <palves@redhat.com>
+
* gdb.base/term.exp: Don't skip if is_remote target. Instead,
expect different "info terminal" output if testing with a
non-native target.
diff --git a/gdb/testsuite/gdb.base/find-unmapped.exp b/gdb/testsuite/gdb.base/find-unmapped.exp
index 9982d0c..d150d97 100644
--- a/gdb/testsuite/gdb.base/find-unmapped.exp
+++ b/gdb/testsuite/gdb.base/find-unmapped.exp
@@ -13,12 +13,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if {[is_remote target]} {
- # gdbserver prints the warning message but expect is parsing only the
- # GDB output, not the gdbserver output.
- return 0
-}
-
standard_testfile
if { [prepare_for_testing "failed to prepare" ${testfile}] } {
@@ -35,12 +29,58 @@ gdb_test "x/5w global_var_1" \
gdb_test "x/5w global_var_2" \
"$hex:\[ \t\]+Cannot access memory at address $hex"
-# Now try a find starting from each global.
-gdb_test "find global_var_0, global_var_2, 0xff" \
- "warning: Unable to access $decimal bytes of target memory at $hex, halting search\.\r\nPattern not found."
-gdb_test "find global_var_1, global_var_2, 0xff" \
- "warning: Unable to access $decimal bytes of target memory at $hex, halting search\.\r\nPattern not found."
+# Try a find starting from each global, expecting the search to fail
+# due to memory access failure.
+#
+# If EXPECT_WARNING is true, then expect the "Unable to access
+# ... halting search" warning before the "Pattern not found" output.
+# Otherwise, don't expect the warning.
+#
+# (EXPECT_WARNING is necessary because when testing with the RSP
+# against servers that support the remote search memory packet, GDB
+# does not print that "halting search" warning. While there are
+# servers that do print the same warning message as GDB would if it
+# were in charge of the search (like GDBserver), we're only parsing
+# GDB's output here, not the server's output. And while we could read
+# GDBserver's output from $inferior_spawn_id, having GDBserver print
+# the warnings on its terminal doesn't really help users. Much better
+# would be to extend the remote protocol to let the server tell GDB
+# which memory range couldn't be accessed, and then let GDB print the
+# warning instead of the server. See PR gdb/22293.)
+
+proc test_not_found {expect_warning} {
+ global decimal hex
+
+ if {$expect_warning} {
+ set halting_search_re \
+ "warning: Unable to access $decimal bytes of target memory at $hex, halting search\.\r\n"
+ } else {
+ set halting_search_re ""
+ }
-gdb_test "find global_var_2, (global_var_2 + 16), 0xff" \
- "warning: Unable to access $decimal bytes of target memory at $hex, halting search\.\r\nPattern not found."
+ # Now try a find starting from each global.
+ gdb_test "find global_var_0, global_var_2, 0xff" \
+ "${halting_search_re}Pattern not found."
+
+ gdb_test "find global_var_1, global_var_2, 0xff" \
+ "${halting_search_re}Pattern not found."
+
+ gdb_test "find global_var_2, (global_var_2 + 16), 0xff" \
+ "${halting_search_re}Pattern not found."
+}
+
+# If testing with the RSP, also test with target-side search
+# acceleration disabled. This serves as proxy for servers that don't
+# support the memory search packet, when testing with GDBserver.
+
+if {[target_info gdb_protocol] == "remote"
+ || [target_info gdb_protocol] == "extended-remote"} {
+ test_not_found 0
+ with_test_prefix "search-memory-packet off" {
+ gdb_test_no_output "set remote search-memory-packet off"
+ test_not_found 0
+ }
+} else {
+ test_not_found 1
+}
--
2.5.5