aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/target.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2010-08-26 23:17:22 +0000
committerPedro Alves <palves@redhat.com>2010-08-26 23:17:22 +0000
commit90d74c301f749fc06e859ab4424fd4cabc019bc2 (patch)
tree24b64960d7237ee27ab81014a049da62cef4ab1e /gdb/gdbserver/target.h
parentae53ffa4b631eede55fa98f7b27050d54024c575 (diff)
downloadgdb-90d74c301f749fc06e859ab4424fd4cabc019bc2.zip
gdb-90d74c301f749fc06e859ab4424fd4cabc019bc2.tar.gz
gdb-90d74c301f749fc06e859ab4424fd4cabc019bc2.tar.bz2
* linux-low.c (linux_prepare_to_access_memory): New.
(linux_unprepare_to_access_memory): New. (linux_target_ops): Install them. * server.c (read_memory): Rename to ... (gdb_read_memory): ... this. Use prepare_to_access_memory/prepare_to_access_memory. (write_memory): Rename to ... (gdb_write_memory): ... this. Use prepare_to_access_memory/prepare_to_access_memory. (handle_search_memory_1): Adjust. (process_serial_event): Adjust. * target.h (struct target_ops): New fields prepare_to_access_memory and unprepare_to_access_memory. (prepare_to_access_memory, unprepare_to_access_memory): New. * linux-x86-low.c (x86_insert_point, x86_remove_point): Use prepare_to_access_memory/prepare_to_access_memory. * nto-low.c (nto_target_ops): Adjust. * spu-low.c (spu_target_ops): Adjust. * win32-low.c (win32_target_ops): Adjust.
Diffstat (limited to 'gdb/gdbserver/target.h')
-rw-r--r--gdb/gdbserver/target.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 1f9f921..8126f85 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -181,6 +181,23 @@ struct target_ops
void (*store_registers) (struct regcache *regcache, int regno);
+ /* Prepare to read or write memory from the inferior process.
+ Targets use this to do what is necessary to get the state of the
+ inferior such that it is possible to access memory.
+
+ This should generally only be called from client facing routines,
+ such as gdb_read_memory/gdb_write_memory, or the insert_point
+ callbacks.
+
+ Like `read_memory' and `write_memory' below, returns 0 on success
+ and errno on failure. */
+
+ int (*prepare_to_access_memory) (void);
+
+ /* Undo the effects of prepare_to_access_memory. */
+
+ void (*unprepare_to_access_memory) (void);
+
/* Read memory from the inferior process. This should generally be
called through read_inferior_memory, which handles breakpoint shadowing.
@@ -469,6 +486,18 @@ int start_non_stop (int nonstop);
ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options,
int connected_wait);
+#define prepare_to_access_memory() \
+ (the_target->prepare_to_access_memory \
+ ? (*the_target->prepare_to_access_memory) () \
+ : 0)
+
+#define unprepare_to_access_memory() \
+ do \
+ { \
+ if (the_target->unprepare_to_access_memory) \
+ (*the_target->unprepare_to_access_memory) (); \
+ } while (0)
+
int read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len);
int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr,