diff options
author | Doug Evans <dje@google.com> | 2008-05-09 17:02:03 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2008-05-09 17:02:03 +0000 |
commit | 08388c79d5a8553465b2de881bed15766837735c (patch) | |
tree | 1c0af907d5caa5836541d62803dd1775c683913c /gdb/target.h | |
parent | 7010a0c9019a68999ca6e43b4eec8b28d0907cbc (diff) | |
download | gdb-08388c79d5a8553465b2de881bed15766837735c.zip gdb-08388c79d5a8553465b2de881bed15766837735c.tar.gz gdb-08388c79d5a8553465b2de881bed15766837735c.tar.bz2 |
New "find" command.
* NEWS: Document find command and qSearch:memory packet.
* Makefile.in (SFILES): Add findcmd.c.
(COMMON_OBJS): Add findcmd.o.
(findcmd.o): New rule.
* findcmd.c: New file.
* target.h (target_ops): New member to_search_memory.
(simple_search_memory): Declare.
(target_search_memory): Declare.
* target.c (simple_search_memory): New fn.
(target_search_memory): New fn.
* remote.c (PACKET_qSearch_memory): New packet kind.
(remote_search_memory): New fn.
(init_remote_ops): Init to_search_memory.
(init_extended_remote_ops): Ditto.
(_initialize_remote): Add qSearch:memory packet config command.
* gdbserver/server.h (decode_search_memory_packet): Declare.
* gdbserver/remote-utils.c (decode_search_memory_packet): New fn.
* gdbserver/server.c (handle_search_memory_1): New fn.
(handle_search_memory): New fn.
(handle_query): Process qSearch:memory packets.
* doc/gdb.texinfo: Document "find" command, qSearch:memory packet.
* testsuite/gdb.base/find.exp: New file.
* testsuite/gdb.base/find.c: New file.
Diffstat (limited to 'gdb/target.h')
-rw-r--r-- | gdb/target.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/target.h b/gdb/target.h index 8822a40..f1e4147 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -505,6 +505,17 @@ struct target_ops int (*to_auxv_parse) (struct target_ops *ops, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp); + /* Search SEARCH_SPACE_LEN bytes beginning at START_ADDR for the + sequence of bytes in PATTERN with length PATTERN_LEN. + + The result is 1 if found, 0 if not found, and -1 if there was an error + requiring halting of the search (e.g. memory read error). + If the pattern is found the address is recorded in FOUND_ADDRP. */ + int (*to_search_memory) (struct target_ops *ops, + CORE_ADDR start_addr, ULONGEST search_space_len, + const gdb_byte *pattern, ULONGEST pattern_len, + CORE_ADDR *found_addrp); + int to_magic; /* Need sub-structure for target machine related rather than comm related? */ @@ -1102,6 +1113,21 @@ extern int target_stopped_data_address_p (struct target_ops *); extern const struct target_desc *target_read_description (struct target_ops *); +/* Utility implementation of searching memory. */ +extern int simple_search_memory (struct target_ops* ops, + CORE_ADDR start_addr, + ULONGEST search_space_len, + const gdb_byte *pattern, + ULONGEST pattern_len, + CORE_ADDR *found_addrp); + +/* Main entry point for searching memory. */ +extern int target_search_memory (CORE_ADDR start_addr, + ULONGEST search_space_len, + const gdb_byte *pattern, + ULONGEST pattern_len, + CORE_ADDR *found_addrp); + /* Command logging facility. */ #define target_log_command(p) \ |