From 721ec300e1e27c2fa7540ef97f39b6c5ce65083f Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Thu, 11 Sep 2014 11:19:56 +0100 Subject: Introduce target/target.h This introduces target/target.h. This file declares some functions that the shared code can use and that clients must implement. It also changes some shared code to use these functions. gdb/ChangeLog: * target/target.h: New file. * Makefile.in (HFILES_NO_SRCDIR): Add target/target.h. * target.h: Include target/target.h. (target_read_memory, target_write_memory): Don't declare. * target.c (target_read_uint32): New function. * common/agent.c: Include target/target.h. [!GDBSERVER]: Don't include target.h. (helper_thread_id): Type changed to uint32_t. (agent_get_helper_thread_id): Use target_read_uint32. (agent_run_command): Always use target_read_memory and target_write_memory. (agent_capability): Type changed to uint32_t. (agent_capability_check): Use target_read_uint32. gdb/gdbserver/ChangeLog: * target.h: Include target/target.h. * target.c (target_read_memory, target_read_uint32) (target_write_memory): New functions. --- gdb/gdbserver/target.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gdb/gdbserver/target.c') diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c index dcad5c9..08506e5 100644 --- a/gdb/gdbserver/target.c +++ b/gdb/gdbserver/target.c @@ -48,6 +48,22 @@ read_inferior_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) return res; } +/* See target/target.h. */ + +int +target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len) +{ + return read_inferior_memory (memaddr, myaddr, len); +} + +/* See target/target.h. */ + +int +target_read_uint32 (CORE_ADDR memaddr, uint32_t *result) +{ + return read_inferior_memory (memaddr, (gdb_byte *) result, sizeof (*result)); +} + int write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len) @@ -71,6 +87,14 @@ write_inferior_memory (CORE_ADDR memaddr, const unsigned char *myaddr, return res; } +/* See target/target.h. */ + +int +target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len) +{ + return write_inferior_memory (memaddr, myaddr, len); +} + ptid_t mywait (ptid_t ptid, struct target_waitstatus *ourstatus, int options, int connected_wait) -- cgit v1.1