* 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.
This commit is contained in:
Daniel Jacobowitz 2008-03-13 12:22:14 +00:00
parent 5808f4a685
commit 8defab1af7
21 changed files with 136 additions and 116 deletions

View File

@ -1,3 +1,25 @@
2008-03-13 Vladimir Prus <vladimir@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
* 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.
2008-03-12 Pedro Alves <pedro@codesourcery.com>
* thread.c (add_thread): Use printf_unfiltered to print.

View File

@ -2873,7 +2873,7 @@ symtab.o: symtab.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(gdbcore_h) \
target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
$(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
$(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) $(gdbcore_h) \
$(exceptions_h) $(target_descriptions_h)
$(exceptions_h) $(target_descriptions_h) $(gdb_stdint_h)
target-descriptions.o: target-descriptions.c $(defs_h) $(arch_utils_h) \
$(target_h) $(target_descriptions_h) $(vec_h) $(xml_tdesc_h) \
$(gdbcmd_h) $(gdb_assert_h) $(gdbtypes_h) $(reggroups_h) \

View File

@ -638,7 +638,7 @@ alpha_read_insn (CORE_ADDR pc)
gdb_byte buf[ALPHA_INSN_SIZE];
int status;
status = read_memory_nobpt (pc, buf, sizeof (buf));
status = target_read_memory (pc, buf, sizeof (buf));
if (status)
memory_error (status, pc);
return extract_unsigned_integer (buf, sizeof (buf));

View File

@ -216,7 +216,7 @@ alphanbsd_sigtramp_offset (CORE_ADDR pc)
LONGEST off;
int i;
if (read_memory_nobpt (pc, (char *) w, 4) != 0)
if (target_read_memory (pc, (char *) w, 4) != 0)
return -1;
for (i = 0; i < RETCODE_NWORDS; i++)
@ -230,7 +230,7 @@ alphanbsd_sigtramp_offset (CORE_ADDR pc)
off = i * 4;
pc -= off;
if (read_memory_nobpt (pc, (char *) ret, sizeof (ret)) != 0)
if (target_read_memory (pc, (char *) ret, sizeof (ret)) != 0)
return -1;
if (memcmp (ret, sigtramp_retcode, RETCODE_SIZE) == 0)

View File

@ -702,25 +702,16 @@ commands_from_control_command (char *arg, struct command_line *cmd)
error (_("No breakpoint number %d."), bnum);
}
/* Like target_read_memory() but if breakpoints are inserted, return
the shadow contents instead of the breakpoints themselves.
/* Update BUF, which is LEN bytes read from the target address MEMADDR,
by replacing any memory breakpoints with their shadowed contents. */
Read "memory data" from whatever target or inferior we have.
Returns zero if successful, errno value if not. EIO is used
for address out of bounds. If breakpoints are inserted, returns
shadow contents, not the breakpoints themselves. From breakpoint.c. */
int
read_memory_nobpt (CORE_ADDR memaddr, gdb_byte *myaddr, unsigned len)
void
breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr, LONGEST len)
{
int status;
const struct bp_location *b;
struct bp_location *b;
CORE_ADDR bp_addr = 0;
int bp_size = 0;
if (gdbarch_breakpoint_from_pc (current_gdbarch, &bp_addr, &bp_size) == NULL)
/* No breakpoints on this machine. */
return target_read_memory (memaddr, myaddr, len);
int bptoffset = 0;
ALL_BP_LOCATIONS (b)
{
@ -739,59 +730,35 @@ read_memory_nobpt (CORE_ADDR memaddr, gdb_byte *myaddr, unsigned len)
if (bp_size == 0)
/* bp isn't valid, or doesn't shadow memory. */
continue;
if (bp_addr + bp_size <= memaddr)
/* The breakpoint is entirely before the chunk of memory we
are reading. */
continue;
if (bp_addr >= memaddr + len)
/* The breakpoint is entirely after the chunk of memory we are
reading. */
continue;
/* Copy the breakpoint from the shadow contents, and recurse for
the things before and after. */
{
/* Offset within shadow_contents. */
int bptoffset = 0;
if (bp_addr < memaddr)
{
/* Only copy the second part of the breakpoint. */
bp_size -= memaddr - bp_addr;
bptoffset = memaddr - bp_addr;
bp_addr = memaddr;
}
/* Offset within shadow_contents. */
if (bp_addr < memaddr)
{
/* Only copy the second part of the breakpoint. */
bp_size -= memaddr - bp_addr;
bptoffset = memaddr - bp_addr;
bp_addr = memaddr;
}
if (bp_addr + bp_size > memaddr + len)
{
/* Only copy the first part of the breakpoint. */
bp_size -= (bp_addr + bp_size) - (memaddr + len);
}
if (bp_addr + bp_size > memaddr + len)
{
/* Only copy the first part of the breakpoint. */
bp_size -= (bp_addr + bp_size) - (memaddr + len);
}
memcpy (myaddr + bp_addr - memaddr,
b->target_info.shadow_contents + bptoffset, bp_size);
if (bp_addr > memaddr)
{
/* Copy the section of memory before the breakpoint. */
status = read_memory_nobpt (memaddr, myaddr, bp_addr - memaddr);
if (status != 0)
return status;
}
if (bp_addr + bp_size < memaddr + len)
{
/* Copy the section of memory after the breakpoint. */
status = read_memory_nobpt (bp_addr + bp_size,
myaddr + bp_addr + bp_size - memaddr,
memaddr + len - (bp_addr + bp_size));
if (status != 0)
return status;
}
return 0;
}
memcpy (buf + bp_addr - memaddr,
b->target_info.shadow_contents + bptoffset, bp_size);
}
/* Nothing overlaps. Just call read_memory_noerr. */
return target_read_memory (memaddr, myaddr, len);
}
@ -4299,7 +4266,7 @@ set_raw_breakpoint (struct symtab_and_line sal, enum bptype bptype)
/* Adjust the breakpoint's address prior to allocating a location.
Once we call allocate_bp_location(), that mostly uninitialized
location will be placed on the location chain. Adjustment of the
breakpoint may cause read_memory_nobpt() to be called and we do
breakpoint may cause target_read_memory() to be called and we do
not want its scan of the location chain to find a breakpoint and
location that's only been partially initialized. */
adjusted_address = adjust_breakpoint_address (sal.pc, bptype);

View File

@ -859,4 +859,9 @@ extern int deprecated_remove_raw_breakpoint (void *);
target. */
int watchpoints_triggered (struct target_waitstatus *);
/* Update BUF, which is LEN bytes read from the target address MEMADDR,
by replacing any memory breakpoints with their shadowed contents. */
void breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr,
LONGEST len);
#endif /* !defined (BREAKPOINT_H) */

View File

@ -1691,8 +1691,8 @@ int
safe_frame_unwind_memory (struct frame_info *this_frame,
CORE_ADDR addr, gdb_byte *buf, int len)
{
/* NOTE: read_memory_nobpt returns zero on success! */
return !read_memory_nobpt (addr, buf, len);
/* NOTE: target_read_memory returns zero on success! */
return !target_read_memory (addr, buf, len);
}
/* Architecture method. */

View File

@ -449,7 +449,7 @@ frv_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
char instr[frv_instr_size];
int status;
status = read_memory_nobpt (addr, instr, sizeof instr);
status = target_read_memory (addr, instr, sizeof instr);
if (status != 0)
break;

View File

@ -39,18 +39,6 @@ extern char *get_exec_file (int err);
extern int have_core_file_p (void);
/* Read "memory data" from whatever target or inferior we have.
Returns zero if successful, errno value if not. EIO is used for
address out of bounds. If breakpoints are inserted, returns shadow
contents, not the breakpoints themselves. From breakpoint.c. */
/* NOTE: cagney/2004-06-10: Code reading from a live inferior can use
the get_frame_memory methods, code reading from an exec can use the
target methods. */
extern int read_memory_nobpt (CORE_ADDR memaddr, gdb_byte *myaddr,
unsigned len);
/* Report a memory error with error(). */
extern void memory_error (int status, CORE_ADDR memaddr);

View File

@ -101,7 +101,7 @@ insns_match_pattern (CORE_ADDR pc,
{
char buf[4];
read_memory_nobpt (npc, buf, 4);
target_read_memory (npc, buf, 4);
insn[i] = extract_unsigned_integer (buf, 4);
if ((insn[i] & pattern[i].mask) == pattern[i].data)
npc += 4;

View File

@ -545,7 +545,7 @@ hppa_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
char buf[4];
int off;
status = read_memory_nobpt (pc, buf, 4);
status = target_read_memory (pc, buf, 4);
if (status != 0)
return 0;
@ -1552,7 +1552,7 @@ restart:
old_save_sp = save_sp;
old_stack_remaining = stack_remaining;
status = read_memory_nobpt (pc, buf, 4);
status = target_read_memory (pc, buf, 4);
inst = extract_unsigned_integer (buf, 4);
/* Yow! */
@ -1603,7 +1603,7 @@ restart:
&& reg_num <= 26)
{
pc += 4;
status = read_memory_nobpt (pc, buf, 4);
status = target_read_memory (pc, buf, 4);
inst = extract_unsigned_integer (buf, 4);
if (status != 0)
return pc;
@ -1616,7 +1616,7 @@ restart:
reg_num = inst_saves_fr (inst);
save_fr &= ~(1 << reg_num);
status = read_memory_nobpt (pc + 4, buf, 4);
status = target_read_memory (pc + 4, buf, 4);
next_inst = extract_unsigned_integer (buf, 4);
/* Yow! */
@ -1647,13 +1647,13 @@ restart:
<= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
{
pc += 8;
status = read_memory_nobpt (pc, buf, 4);
status = target_read_memory (pc, buf, 4);
inst = extract_unsigned_integer (buf, 4);
if (status != 0)
return pc;
if ((inst & 0xfc000000) != 0x34000000)
break;
status = read_memory_nobpt (pc + 4, buf, 4);
status = target_read_memory (pc + 4, buf, 4);
next_inst = extract_unsigned_integer (buf, 4);
if (status != 0)
return pc;
@ -2857,7 +2857,7 @@ hppa_match_insns (CORE_ADDR pc, struct insn_pattern *pattern,
{
gdb_byte buf[HPPA_INSN_SIZE];
read_memory_nobpt (npc, buf, HPPA_INSN_SIZE);
target_read_memory (npc, buf, HPPA_INSN_SIZE);
insn[i] = extract_unsigned_integer (buf, HPPA_INSN_SIZE);
if ((insn[i] & pattern[i].mask) == pattern[i].data)
npc += 4;

View File

@ -770,7 +770,7 @@ i386_linux_resume (ptid_t ptid, int step, enum target_signal signal)
that's about to be restored, and set the trace flag there. */
/* First check if PC is at a system call. */
if (read_memory_nobpt (pc, buf, LINUX_SYSCALL_LEN) == 0
if (target_read_memory (pc, buf, LINUX_SYSCALL_LEN) == 0
&& memcmp (buf, linux_syscall, LINUX_SYSCALL_LEN) == 0)
{
ULONGEST syscall;

View File

@ -344,7 +344,7 @@ i386_follow_jump (CORE_ADDR pc)
long delta = 0;
int data16 = 0;
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
if (op == 0x66)
{
data16 = 1;
@ -410,12 +410,12 @@ i386_analyze_struct_return (CORE_ADDR pc, CORE_ADDR current_pc,
if (current_pc <= pc)
return pc;
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
if (op != 0x58) /* popl %eax */
return pc;
read_memory_nobpt (pc + 1, buf, 4);
target_read_memory (pc + 1, buf, 4);
if (memcmp (buf, proto1, 3) != 0 && memcmp (buf, proto2, 4) != 0)
return pc;
@ -454,7 +454,7 @@ i386_skip_probe (CORE_ADDR pc)
gdb_byte buf[8];
gdb_byte op;
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
if (op == 0x68 || op == 0x6a)
{
@ -541,7 +541,7 @@ i386_match_insn (CORE_ADDR pc, struct i386_insn *skip_insns)
struct i386_insn *insn;
gdb_byte op;
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
for (insn = skip_insns; insn->len > 0; insn++)
{
@ -554,7 +554,7 @@ i386_match_insn (CORE_ADDR pc, struct i386_insn *skip_insns)
gdb_assert (insn->len > 1);
gdb_assert (insn->len <= I386_MAX_INSN_LEN);
read_memory_nobpt (pc + 1, buf, insn->len - 1);
target_read_memory (pc + 1, buf, insn->len - 1);
for (i = 1; i < insn->len; i++)
{
if ((buf[i - 1] & insn->mask[i]) != insn->insn[i])
@ -632,7 +632,7 @@ i386_skip_noop (CORE_ADDR pc)
gdb_byte op;
int check = 1;
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
while (check)
{
@ -641,7 +641,7 @@ i386_skip_noop (CORE_ADDR pc)
if (op == 0x90)
{
pc += 1;
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
check = 1;
}
/* Ignore no-op instruction `mov %edi, %edi'.
@ -657,11 +657,11 @@ i386_skip_noop (CORE_ADDR pc)
else if (op == 0x8b)
{
read_memory_nobpt (pc + 1, &op, 1);
target_read_memory (pc + 1, &op, 1);
if (op == 0xff)
{
pc += 2;
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
check = 1;
}
}
@ -685,7 +685,7 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR limit,
if (limit <= pc)
return limit;
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
if (op == 0x55) /* pushl %ebp */
{
@ -720,7 +720,7 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR limit,
if (limit <= pc + skip)
return limit;
read_memory_nobpt (pc + skip, &op, 1);
target_read_memory (pc + skip, &op, 1);
/* Check for `movl %esp, %ebp' -- can be written in two ways. */
switch (op)
@ -754,7 +754,7 @@ i386_analyze_frame_setup (CORE_ADDR pc, CORE_ADDR limit,
NOTE: You can't subtract a 16-bit immediate from a 32-bit
reg, so we don't have to worry about a data16 prefix. */
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
if (op == 0x83)
{
/* `subl' with 8-bit immediate. */
@ -810,7 +810,7 @@ i386_analyze_register_saves (CORE_ADDR pc, CORE_ADDR current_pc,
offset -= cache->locals;
for (i = 0; i < 8 && pc < current_pc; i++)
{
read_memory_nobpt (pc, &op, 1);
target_read_memory (pc, &op, 1);
if (op < 0x50 || op > 0x57)
break;
@ -900,7 +900,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
for (i = 0; i < 6; i++)
{
read_memory_nobpt (pc + i, &op, 1);
target_read_memory (pc + i, &op, 1);
if (pic_pat[i] != op)
break;
}
@ -908,7 +908,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
{
int delta = 6;
read_memory_nobpt (pc + delta, &op, 1);
target_read_memory (pc + delta, &op, 1);
if (op == 0x89) /* movl %ebx, x(%ebp) */
{
@ -921,7 +921,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
else /* Unexpected instruction. */
delta = 0;
read_memory_nobpt (pc + delta, &op, 1);
target_read_memory (pc + delta, &op, 1);
}
/* addl y,%ebx */

View File

@ -69,7 +69,7 @@ m68k_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
char buf[12];
unsigned long insn0, insn1, insn2;
if (read_memory_nobpt (pc - 4, buf, sizeof (buf)))
if (target_read_memory (pc - 4, buf, sizeof (buf)))
return 0;
insn1 = extract_unsigned_integer (buf + 4, 4);
insn2 = extract_unsigned_integer (buf + 8, 4);

View File

@ -926,7 +926,7 @@ mips_fetch_instruction (CORE_ADDR addr)
}
else
instlen = MIPS_INSN32_SIZE;
status = read_memory_nobpt (addr, buf, instlen);
status = target_read_memory (addr, buf, instlen);
if (status)
memory_error (status, addr);
return extract_unsigned_integer (buf, instlen);

View File

@ -620,7 +620,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch, struct frame_info *fi,
goto finish_prologue;
/* Get the next two bytes so the prologue scan can continue. */
status = read_memory_nobpt (addr, buf, 2);
status = target_read_memory (addr, buf, 2);
if (status != 0)
goto finish_prologue;
}
@ -761,7 +761,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch, struct frame_info *fi,
if (!fmov_found)
{
addr = restore_addr;
status = read_memory_nobpt (addr, buf, 2);
status = target_read_memory (addr, buf, 2);
if (status != 0)
goto finish_prologue;
stack_extra_size = 0;

View File

@ -281,12 +281,15 @@ ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
int val;
int bplen;
gdb_byte old_contents[BREAKPOINT_MAX];
struct cleanup *cleanup;
/* Determine appropriate breakpoint contents and size for this address. */
bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
if (bp == NULL)
error (_("Software breakpoints not implemented for this target."));
/* Make sure we see the memory breakpoints. */
cleanup = make_show_memory_breakpoints_cleanup (1);
val = target_read_memory (addr, old_contents, bplen);
/* If our breakpoint is no longer at the address, this means that the
@ -295,6 +298,7 @@ ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
val = target_write_memory (addr, bp_tgt->shadow_contents, bplen);
do_cleanups (cleanup);
return val;
}

View File

@ -503,12 +503,12 @@ s390_readinstruction (bfd_byte instr[], CORE_ADDR at)
static int s390_instrlen[] = { 2, 4, 4, 6 };
int instrlen;
if (read_memory_nobpt (at, &instr[0], 2))
if (target_read_memory (at, &instr[0], 2))
return -1;
instrlen = s390_instrlen[instr[0] >> 6];
if (instrlen > 2)
{
if (read_memory_nobpt (at + 2, &instr[2], instrlen - 2))
if (target_read_memory (at + 2, &instr[2], instrlen - 2))
return -1;
}
return instrlen;
@ -1132,19 +1132,19 @@ s390_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
int d2;
if (word_size == 4
&& !read_memory_nobpt (pc - 4, insn, 4)
&& !target_read_memory (pc - 4, insn, 4)
&& is_rs (insn, op_lm, &r1, &r3, &d2, &b2)
&& r3 == S390_SP_REGNUM - S390_R0_REGNUM)
return 1;
if (word_size == 4
&& !read_memory_nobpt (pc - 6, insn, 6)
&& !target_read_memory (pc - 6, insn, 6)
&& is_rsy (insn, op1_lmy, op2_lmy, &r1, &r3, &d2, &b2)
&& r3 == S390_SP_REGNUM - S390_R0_REGNUM)
return 1;
if (word_size == 8
&& !read_memory_nobpt (pc - 6, insn, 6)
&& !target_read_memory (pc - 6, insn, 6)
&& is_rsy (insn, op1_lmg, op2_lmg, &r1, &r3, &d2, &b2)
&& r3 == S390_SP_REGNUM - S390_R0_REGNUM)
return 1;
@ -1658,7 +1658,7 @@ s390_sigtramp_frame_sniffer (struct frame_info *next_frame)
CORE_ADDR pc = frame_pc_unwind (next_frame);
bfd_byte sigreturn[2];
if (read_memory_nobpt (pc, sigreturn, 2))
if (target_read_memory (pc, sigreturn, 2))
return NULL;
if (sigreturn[0] != 0x0a /* svc */)

View File

@ -99,7 +99,7 @@ sparc_fetch_instruction (CORE_ADDR pc)
int i;
/* If we can't read the instruction at PC, return zero. */
if (read_memory_nobpt (pc, buf, sizeof (buf)))
if (target_read_memory (pc, buf, sizeof (buf)))
return 0;
insn = 0;

View File

@ -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,

View File

@ -1250,6 +1250,11 @@ extern enum target_signal target_signal_from_command (int);
/* Any target can call this to switch to remote protocol (in remote.c). */
extern void push_remote_target (char *name, int from_tty);
/* Set the show memory breakpoints mode to show, and installs a cleanup
to restore it back to the current value. */
extern struct cleanup *make_show_memory_breakpoints_cleanup (int show);
/* Imported from machine dependent code */