mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-24 12:35:55 +08:00
Add new target_read_raw_memory function, and consolidate comments.
Tested on x86_64 Fedora 17. gdb/ 2013-12-02 Pedro Alves <palves@redhat.com> * dcache.c (dcache_read_line): Use target_read_raw_memory. * target.c (target_read_raw_memory): New function. (target_read_stack, target_write_memory, target_write_raw_memory): Update comment. (target_read_code): Add comment. * target.h (target_read_raw_memory): Declare.
This commit is contained in:
parent
840207d8ee
commit
aee4bf8505
@ -1,3 +1,12 @@
|
||||
2013-12-02 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* dcache.c (dcache_read_line): Use target_read_raw_memory.
|
||||
* target.c (target_read_raw_memory): New function.
|
||||
(target_read_stack, target_write_memory, target_write_raw_memory):
|
||||
Update comment.
|
||||
(target_read_code): Add comment.
|
||||
* target.h (target_read_raw_memory): Declare.
|
||||
|
||||
2013-12-02 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* ctf.c (ctf_start): Use S_IRGRP, S_IXGRP, S_IXOTH
|
||||
|
11
gdb/dcache.c
11
gdb/dcache.c
@ -337,14 +337,13 @@ dcache_read_line (DCACHE *dcache, struct dcache_block *db)
|
||||
continue;
|
||||
}
|
||||
|
||||
res = target_read (current_target.beneath, TARGET_OBJECT_RAW_MEMORY,
|
||||
NULL, myaddr, memaddr, reg_len);
|
||||
if (res < reg_len)
|
||||
res = target_read_raw_memory (memaddr, myaddr, reg_len);
|
||||
if (res != 0)
|
||||
return 0;
|
||||
|
||||
memaddr += res;
|
||||
myaddr += res;
|
||||
len -= res;
|
||||
memaddr += reg_len;
|
||||
myaddr += reg_len;
|
||||
len -= reg_len;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
34
gdb/target.c
34
gdb/target.c
@ -1791,16 +1791,30 @@ target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
|
||||
return TARGET_XFER_E_IO;
|
||||
}
|
||||
|
||||
/* Like target_read_memory, but specify explicitly that this is a read
|
||||
from the target's raw memory. That is, this read bypasses the
|
||||
dcache, breakpoint shadowing, etc. */
|
||||
|
||||
int
|
||||
target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
|
||||
{
|
||||
/* See comment in target_read_memory about why the request starts at
|
||||
current_target.beneath. */
|
||||
if (target_read (current_target.beneath, TARGET_OBJECT_RAW_MEMORY, NULL,
|
||||
myaddr, memaddr, len) == len)
|
||||
return 0;
|
||||
else
|
||||
return TARGET_XFER_E_IO;
|
||||
}
|
||||
|
||||
/* Like target_read_memory, but specify explicitly that this is a read from
|
||||
the target's stack. This may trigger different cache behavior. */
|
||||
|
||||
int
|
||||
target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
|
||||
{
|
||||
/* Dispatch to the topmost target, not the flattened current_target.
|
||||
Memory accesses check target->to_has_(all_)memory, and the
|
||||
flattened target doesn't inherit those. */
|
||||
|
||||
/* See comment in target_read_memory about why the request starts at
|
||||
current_target.beneath. */
|
||||
if (target_read (current_target.beneath, TARGET_OBJECT_STACK_MEMORY, NULL,
|
||||
myaddr, memaddr, len) == len)
|
||||
return 0;
|
||||
@ -1814,6 +1828,8 @@ target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
|
||||
int
|
||||
target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
|
||||
{
|
||||
/* See comment in target_read_memory about why the request starts at
|
||||
current_target.beneath. */
|
||||
if (target_read (current_target.beneath, TARGET_OBJECT_CODE_MEMORY, NULL,
|
||||
myaddr, memaddr, len) == len)
|
||||
return 0;
|
||||
@ -1830,9 +1846,8 @@ target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
|
||||
int
|
||||
target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
|
||||
{
|
||||
/* Dispatch to the topmost target, not the flattened current_target.
|
||||
Memory accesses check target->to_has_(all_)memory, and the
|
||||
flattened target doesn't inherit those. */
|
||||
/* See comment in target_read_memory about why the request starts at
|
||||
current_target.beneath. */
|
||||
if (target_write (current_target.beneath, TARGET_OBJECT_MEMORY, NULL,
|
||||
myaddr, memaddr, len) == len)
|
||||
return 0;
|
||||
@ -1849,9 +1864,8 @@ target_write_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
|
||||
int
|
||||
target_write_raw_memory (CORE_ADDR memaddr, const gdb_byte *myaddr, ssize_t len)
|
||||
{
|
||||
/* Dispatch to the topmost target, not the flattened current_target.
|
||||
Memory accesses check target->to_has_(all_)memory, and the
|
||||
flattened target doesn't inherit those. */
|
||||
/* See comment in target_read_memory about why the request starts at
|
||||
current_target.beneath. */
|
||||
if (target_write (current_target.beneath, TARGET_OBJECT_RAW_MEMORY, NULL,
|
||||
myaddr, memaddr, len) == len)
|
||||
return 0;
|
||||
|
@ -1051,6 +1051,9 @@ extern int target_read_string (CORE_ADDR, char **, int, int *);
|
||||
extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
|
||||
ssize_t len);
|
||||
|
||||
extern int target_read_raw_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
|
||||
ssize_t len);
|
||||
|
||||
extern int target_read_stack (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
|
||||
|
||||
extern int target_read_code (CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len);
|
||||
|
Loading…
Reference in New Issue
Block a user