diff options
author | Yao Qi <yao@codesourcery.com> | 2013-10-18 17:36:11 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2013-12-10 20:27:49 +0800 |
commit | 0865b04a4dec8a458bee54081b5598a6268b0724 (patch) | |
tree | 7b2cdde0ecfc6456086735083c6a8b1a7ebb08dc /gdb/gdbcore.h | |
parent | f15cb84a84613a5017e41ae435312ddcb17877b5 (diff) | |
download | fsf-binutils-gdb-0865b04a4dec8a458bee54081b5598a6268b0724.zip fsf-binutils-gdb-0865b04a4dec8a458bee54081b5598a6268b0724.tar.gz fsf-binutils-gdb-0865b04a4dec8a458bee54081b5598a6268b0724.tar.bz2 |
Use target_read_code in skip_prologue (i386)
GDB is able to cache memory accesses requested in target_read_code,
so target_read_code is more efficient than general target_read_memory.
This patch uses target_read_code and its variants to read target
memory in the functions related to i386_skip_prologue. It improves
the performance when doing 'b foo' (foo is a function) in remote
debugging.
Nowadays, when we set a breakpoint on function f1, GDB will fetch the
code in f1 to determine the start of the function body (say skip the
prologue), it requests read from target many times. With this patch
applied, the number of RSP 'm' packets are reduced.
gdb:
2013-12-10 Yao Qi <yao@codesourcery.com>
* corefile.c (read_code): New function.
(read_code_integer): New function.
(read_code_unsigned_integer): New function.
* gdbcore.h (read_code): Declare.
(read_code_integer): Declare.
(read_code_unsigned_integer): Declare.
* i386-tdep.c (i386_follow_jump): Call target_read_code instead
of target_read_memory. Call read_code_unsigned_integer instead
of read_memory_unsigned_integer.
(i386_analyze_struct_return): Likewise.
(i386_skip_probe): Likewise.
(i386_analyze_stack_align): Likewise.
(i386_match_pattern): Likewise.
(i386_skip_noop): Likewise.
(i386_analyze_frame_setup): Likewise.
(i386_analyze_register_saves): Likewise.
(i386_skip_prologue): Likewise.
(i386_skip_main_prologue): Likewise.
(i386_frame_cache_1): Likewise.
Diffstat (limited to 'gdb/gdbcore.h')
-rw-r--r-- | gdb/gdbcore.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h index 41bcf1f..c2bc255 100644 --- a/gdb/gdbcore.h +++ b/gdb/gdbcore.h @@ -57,6 +57,10 @@ extern void read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len); extern void read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len); +/* Like target_read_code, but report an error if can't read. */ + +extern void read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len); + /* Read an integer from debugged memory, given address and number of bytes. */ @@ -73,6 +77,19 @@ extern ULONGEST read_memory_unsigned_integer (CORE_ADDR memaddr, int len, enum bfd_endian byte_order); +/* Read an integer from debugged code memory, given address, + number of bytes, and byte order for code. */ + +extern LONGEST read_code_integer (CORE_ADDR memaddr, int len, + enum bfd_endian byte_order); + +/* Read an unsigned integer from debugged code memory, given address, + number of bytes, and byte order for code. */ + +extern ULONGEST read_code_unsigned_integer (CORE_ADDR memaddr, + int len, + enum bfd_endian byte_order); + /* Read a null-terminated string from the debuggee's memory, given address, a buffer into which to place the string, and the maximum available space. */ |