diff options
author | Gary Benson <gbenson@redhat.com> | 2014-09-11 11:19:56 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2014-09-11 11:19:56 +0100 |
commit | 721ec300e1e27c2fa7540ef97f39b6c5ce65083f (patch) | |
tree | a0dfc0a39a7bbce24a32af6bed353ba57675eafc /gdb/target/target.h | |
parent | c5e92cca56da9153985d4c15dab243e383f66919 (diff) | |
download | gdb-721ec300e1e27c2fa7540ef97f39b6c5ce65083f.zip gdb-721ec300e1e27c2fa7540ef97f39b6c5ce65083f.tar.gz gdb-721ec300e1e27c2fa7540ef97f39b6c5ce65083f.tar.bz2 |
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.
Diffstat (limited to 'gdb/target/target.h')
-rw-r--r-- | gdb/target/target.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/gdb/target/target.h b/gdb/target/target.h new file mode 100644 index 0000000..0a3c4b7 --- /dev/null +++ b/gdb/target/target.h @@ -0,0 +1,62 @@ +/* Declarations for common target functions. + + Copyright (C) 1986-2014 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef TARGET_COMMON_H +#define TARGET_COMMON_H + +#include "target/waitstatus.h" +#include <stdint.h> + +/* This header is a stopgap until more code is shared. */ + +/* Read LEN bytes of target memory at address MEMADDR, placing the + results in GDB's memory at MYADDR. Return zero for success, + nonzero if any error occurs. This function must be provided by + the client. Implementations of this function may define and use + their own error codes, but functions in the common, nat and target + directories must treat the return code as opaque. No guarantee is + made about the contents of the data at MYADDR if any error + occurs. */ + +extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, + ssize_t len); + +/* Read an unsigned 32-bit integer in the target's format from target + memory at address MEMADDR, storing the result in GDB's format in + GDB's memory at RESULT. Return zero for success, nonzero if any + error occurs. This function must be provided by the client. + Implementations of this function may define and use their own error + codes, but functions in the common, nat and target directories must + treat the return code as opaque. No guarantee is made about the + contents of the data at RESULT if any error occurs. */ + +extern int target_read_uint32 (CORE_ADDR memaddr, uint32_t *result); + +/* Write LEN bytes from MYADDR to target memory at address MEMADDR. + Return zero for success, nonzero if any error occurs. This + function must be provided by the client. Implementations of this + function may define and use their own error codes, but functions + in the common, nat and target directories must treat the return + code as opaque. No guarantee is made about the contents of the + data at MEMADDR if any error occurs. */ + +extern int target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, + ssize_t len); + +#endif /* TARGET_COMMON_H */ |