diff options
author | Daniel Jacobowitz <drow@false.org> | 2008-03-13 12:22:14 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2008-03-13 12:22:14 +0000 |
commit | 8defab1af704e456ddf7da74f3e7617bdb70ca3b (patch) | |
tree | 6d35cf1fda2ae3e74d708c8438bfa87416570091 /gdb/target.c | |
parent | 5808f4a685c011dca2ea8046508af6c39b91b8da (diff) | |
download | gdb-8defab1af704e456ddf7da74f3e7617bdb70ca3b.zip gdb-8defab1af704e456ddf7da74f3e7617bdb70ca3b.tar.gz gdb-8defab1af704e456ddf7da74f3e7617bdb70ca3b.tar.bz2 |
* breakpoint.h (breakpoint_restore_shadows): New
declaration.
* breakpoint.c (breakpoint_restore_shadows): New.
(read_memory_nobpt): Delete.
* gdbcore.h (read_memory_nobpt): Delete declaration.
* target.c (memory_xfer_partial): Call
breakpoint_restore_shadows.
(restore_show_memory_breakpoints)
(make_show_memory_beakpoints_cleanup): New.
(show_memory_breakpoints): New.
* target.h (make_show_memory_beakpoints_cleanup): Declare.
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint):
Make sure we see memory breakpoints when checking if
breakpoint is still there.
* alpha-tdep.c, alphanbsd-tdep.c, frame.c, frv-tdep.c,
hppa-linux-tdep.c, hppa-tdep.c, i386-linux-nat.c, i386-tdep.c,
m68klinux-tdep.c, mips-tdep.c, mn10300-tdep.c, s390-tdep.c,
sparc-tdep.c: Use target_read_memory instead of read_memory_nobpt.
Diffstat (limited to 'gdb/target.c')
-rw-r--r-- | gdb/target.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/gdb/target.c b/gdb/target.c index ceb71b3..9d2f1fd 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -39,6 +39,7 @@ #include "gdbcore.h" #include "exceptions.h" #include "target-descriptions.h" +#include "gdb_stdint.h" static void target_info (char *, int); @@ -203,6 +204,11 @@ int attach_flag; static int trust_readonly = 0; +/* Nonzero if we should show true memory content including + memory breakpoint inserted by gdb. */ + +static int show_memory_breakpoints = 0; + /* Non-zero if we want to see trace of target level stuff. */ static int targetdebug = 0; @@ -1064,7 +1070,11 @@ memory_xfer_partial (struct target_ops *ops, void *readbuf, const void *writebuf if (res <= 0) return -1; else - return res; + { + if (readbuf && !show_memory_breakpoints) + breakpoint_restore_shadows (readbuf, memaddr, reg_len); + return res; + } } /* If none of those methods found the memory we wanted, fall back @@ -1082,22 +1092,41 @@ memory_xfer_partial (struct target_ops *ops, void *readbuf, const void *writebuf res = ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL, readbuf, writebuf, memaddr, reg_len); if (res > 0) - return res; + break; /* We want to continue past core files to executables, but not past a running target's memory. */ if (ops->to_has_all_memory) - return res; + break; ops = ops->beneath; } while (ops != NULL); + if (readbuf && !show_memory_breakpoints) + breakpoint_restore_shadows (readbuf, memaddr, reg_len); + /* If we still haven't got anything, return the last error. We give up. */ return res; } +static void +restore_show_memory_breakpoints (void *arg) +{ + show_memory_breakpoints = (uintptr_t) arg; +} + +struct cleanup * +make_show_memory_breakpoints_cleanup (int show) +{ + int current = show_memory_breakpoints; + show_memory_breakpoints = show; + + return make_cleanup (restore_show_memory_breakpoints, + (void *) (uintptr_t) current); +} + static LONGEST target_xfer_partial (struct target_ops *ops, enum target_object object, const char *annex, |