This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/3] set trust-readonly-sections off in test cases
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 6 Sep 2013 10:01:58 +0800
- Subject: [PATCH 1/3] 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>
In the test cases, if GDB modified code in the inferior, it should
'set trust-readonly-sections off' too. Similarly, users has to set it
off if users modified code for some purpose.
gdb/testsuite:
2013-09-06 Yao Qi <yao@codesourcery.com>
* gdb.base/break-always.exp: Set trust-readonly-sections off.
* gdb.mi/mi-fill-memory.exp: Likewise.
gdb/doc:
2013-09-06 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (File): Mention that user has
'set trust-readonly-sections off' to get updated contents if
they are modified.
---
gdb/doc/gdb.texinfo | 5 ++++-
gdb/testsuite/gdb.base/break-always.exp | 4 ++++
gdb/testsuite/gdb.mi/mi-fill-memory.exp | 5 +++++
3 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 21250fe..d8e4adf 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -16678,7 +16678,10 @@ The default is off.
@item set trust-readonly-sections off
Tell @value{GDBN} not to trust readonly sections. This means that
the contents of the section might change while the program is running,
-and must therefore be fetched from the target when needed.
+and must therefore be fetched from the target when needed. If user
+modified the code in the target program, user has to
+@code{set trust-readonly-sections off} to guarantee @value{GDBN} reads
+updated contents from the target program instead of object file.
@item show trust-readonly-sections
Show the current setting of trusting readonly sections.
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..ac9313b 100644
--- a/gdb/testsuite/gdb.mi/mi-fill-memory.exp
+++ b/gdb/testsuite/gdb.mi/mi-fill-memory.exp
@@ -51,6 +51,11 @@ mi_gdb_test "4-data-write-memory-bytes \$pc ab 8"\
"4\\\^done" \
"memory successfully filled (8 bytes)"
+# 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 "5-interpreter-exec console \"x \$pc\"" \
".*0xabababab.*" \
"pattern correctly read from memory"
--
1.7.7.6