This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/7] set trust-readonly-sections off in test cases
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Sun, 8 Sep 2013 20:03:22 +0800
- Subject: [PATCH 2/7] set trust-readonly-sections off in test cases
- Authentication-results: sourceware.org; auth=none
- References: <1378432920-7731-1-git-send-email-yao at codesourcery dot com> <1378641807-24256-1-git-send-email-yao at codesourcery dot com>
In the test cases, if GDB modified code in the inferior, it should
'set trust-readonly-sections off'.
gdb/testsuite:
2013-09-08 Yao Qi <yao@codesourcery.com>
* gdb.base/break-always.exp: Set trust-readonly-sections off.
* gdb.mi/mi-fill-memory.exp: Likewise.
---
gdb/testsuite/gdb.base/break-always.exp | 4 ++++
gdb/testsuite/gdb.mi/mi-fill-memory.exp | 5 +++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/gdb/testsuite/gdb.base/break-always.exp b/gdb/testsuite/gdb.base/break-always.exp
index b0a9faf..16f6d47 100644
--- a/gdb/testsuite/gdb.base/break-always.exp
+++ b/gdb/testsuite/gdb.base/break-always.exp
@@ -69,6 +69,10 @@ gdb_test "p /x \$shadow = *(char *) $bp_address" \
# and still leave the breakpoint insn planted. Try twice with
# different values, in case we happen to be writting exactly what was
# there already.
+# Turn option "trust-readonly-sections" off to force GDB to read
+# contents from the target instead of the object file.
+gdb_test_no_output "set trust-readonly-sections off"
+
gdb_test "p /x *(char *) $bp_address = 0" \
" = 0x0" \
"write 0 to breakpoint's address"
diff --git a/gdb/testsuite/gdb.mi/mi-fill-memory.exp b/gdb/testsuite/gdb.mi/mi-fill-memory.exp
index 5f68cbb..2b7408a 100644
--- a/gdb/testsuite/gdb.mi/mi-fill-memory.exp
+++ b/gdb/testsuite/gdb.mi/mi-fill-memory.exp
@@ -35,6 +35,11 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}.c" "${binfile}" executable {d
mi_run_to_main
mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
+# Turn option "trust-readonly-sections" off to force GDB to read
+# contents from the target instead of the object file.
+mi_gdb_test "-gdb-set trust-readonly-sections off" "\\\^done" \
+ "set trust-readonly-sections off"
+
mi_gdb_test "1-data-write-memory-bytes"\
"1\\\^error,msg=\"Usage: ADDR DATA \\\[COUNT\\\]\.\""\
"no arguments"
--
1.7.7.6