aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2002-01-31 02:31:06 +0000
committerMichael Snyder <msnyder@vmware.com>2002-01-31 02:31:06 +0000
commit3a11626da1b01bee21978b0bfa90b8d13775ae25 (patch)
treef3415fec0baf329be4181810e46c3a2ba412c4e5 /gdb
parent2c955b8b6195aba246f98f80c4ba218f296d8c13 (diff)
downloadgdb-3a11626da1b01bee21978b0bfa90b8d13775ae25.zip
gdb-3a11626da1b01bee21978b0bfa90b8d13775ae25.tar.gz
gdb-3a11626da1b01bee21978b0bfa90b8d13775ae25.tar.bz2
2002-01-15 Michael Snyder <msnyder@redhat.com>
* target.c: New command, "set trust-readonly-sections on". (do_xfer_memory): Honor the suggestion to trust readonly sections by reading them from the object file instead of from the target. (initialize_targets): Register command "set trust-readonly-sections".
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/target.c42
2 files changed, 43 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b2068fa..27dfeb0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2002-01-15 Michael Snyder <msnyder@redhat.com>
+
+ * target.c: New command, "set trust-readonly-sections on".
+ (do_xfer_memory): Honor the suggestion to trust readonly sections
+ by reading them from the object file instead of from the target.
+ (initialize_targets): Register command "set trust-readonly-sections".
+
2002-01-29 Andrew Cagney <ac131313@redhat.com>
* parse.c (target_map_name_to_register): Simplify, search regs and
diff --git a/gdb/target.c b/gdb/target.c
index 1af8883..95ec4ef 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -835,6 +835,8 @@ target_write_memory (CORE_ADDR memaddr, char *myaddr, int len)
return target_xfer_memory (memaddr, myaddr, len, 1);
}
+static int trust_readonly = 0;
+
/* Move memory to or from the targets. The top target gets priority;
if it cannot handle it, it is offered to the next one down, etc.
@@ -857,6 +859,24 @@ do_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
0. */
errno = 0;
+ if (!write && trust_readonly)
+ {
+ /* User-settable option, "trust-readonly". If true, then
+ memory from any SEC_READONLY bfd section may be read
+ directly from the bfd file. */
+
+ struct section_table *secp;
+
+ for (secp = current_target.to_sections;
+ secp < current_target.to_sections_end;
+ secp++)
+ {
+ if (memaddr >= secp->addr && memaddr < secp->endaddr)
+ return xfer_memory (memaddr, myaddr, len, 0,
+ attrib, &current_target);
+ }
+ }
+
/* The quick case is that the top target can handle the transfer. */
res = current_target.to_xfer_memory
(memaddr, myaddr, len, write, attrib, &current_target);
@@ -2254,13 +2274,23 @@ initialize_targets (void)
add_info ("target", target_info, targ_desc);
add_info ("files", target_info, targ_desc);
- add_show_from_set (
- add_set_cmd ("target", class_maintenance, var_zinteger,
- (char *) &targetdebug,
- "Set target debugging.\n\
+ add_show_from_set
+ (add_set_cmd ("target", class_maintenance, var_zinteger,
+ (char *) &targetdebug,
+ "Set target debugging.\n\
When non-zero, target debugging is enabled.", &setdebuglist),
- &showdebuglist);
-
+ &showdebuglist);
+
+ add_show_from_set
+ (add_set_boolean_cmd
+ ("trust-readonly-sections", class_support,
+ &trust_readonly,
+ "Set mode for reading from readonly sections.\n\
+When this mode is on, memory reads from readonly sections (such as .text)\n\
+will be read from the object file instead of from the target. This will\n\
+result in significant performance improvement for remote targets.",
+ &setlist),
+ &showlist);
add_com ("monitor", class_obscure, do_monitor_command,
"Send a command to the remote monitor (remote targets only).");