summaryrefslogtreecommitdiff
path: root/gdb/dcache.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-11-27 18:01:05 +0800
committerYao Qi <yao@codesourcery.com>2013-11-29 21:32:03 +0800
commit9f7132948dd9a08e020e6409ebe790d8fd9c6d5d (patch)
treeda852d27b7b1156181e7e852a5e1e83e33131304 /gdb/dcache.c
parent5425b0d80b3f883115ae120124625cb4f040e17c (diff)
Delegate to target_ops->beneath for TARGET_OBJECT_RAW_MEMORY
GDB on x86_64-linux is unable to disassemble on core-file target. $ ./gdb ./testsuite/gdb.base/corefile (gdb) core-file ./testsuite/gdb.base/corefile.core (gdb) disassemble main Dump of assembler code for function main: 0x0000000000400976 <+0>: Cannot access memory at address 0x400976 However, it works if we turn code-cache off. (gdb) set code-cache off (gdb) disassemble main,+4 Dump of assembler code from 0x400976 to 0x40097a: 0x0000000000400976 <main+0>: push %rbp 0x0000000000400977 <main+1>: mov %rsp,%rbp End of assembler dump. When code-cache is off, GDB will iterate target_ops from top to bottom and call to_xfer_partial. When current_target is "core", it will call to_xfer_partial of target "exec", which reads the contents for disassemble. However, dcache uses TARGET_OBJECT_RAW_MEMORY to read, but target_xfer_partial doesn't delegate requests to beneath for TARGET_OBJECT_RAW_MEMORY. This patch factors out the iteration from top to bottom to a new function, raw_memory_xfer_partial, and use it for TARGET_OBJECT_RAW_MEMORY. Regression tested on x86_64-linux. gdb: 2013-11-29 Yao Qi <yao@codesourcery.com> Pedro Alves <palves@redhat.com> * dcache.c (dcache_read_line): Use current_target.beneath instead of &current_target. * target.c (memory_xfer_partial_1): Factor code out to ... (raw_memory_xfer_partial): ... it. New function. (target_xfer_partial): Call raw_memory_xfer_partial if OBJECT is TARGET_OBJECT_RAW_MEMORY.
Diffstat (limited to 'gdb/dcache.c')
-rw-r--r--gdb/dcache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/dcache.c b/gdb/dcache.c
index ea2b73230c..12d1a4b9c2 100644
--- a/gdb/dcache.c
+++ b/gdb/dcache.c
@@ -336,8 +336,8 @@ dcache_read_line (DCACHE *dcache, struct dcache_block *db)
len -= reg_len;
continue;
}
-
- res = target_read (&current_target, TARGET_OBJECT_RAW_MEMORY,
+
+ res = target_read (current_target.beneath, TARGET_OBJECT_RAW_MEMORY,
NULL, myaddr, memaddr, reg_len);
if (res < reg_len)
return 0;