- static unsigned char little_break_insn[] = LITTLE_BREAKPOINT;
- *lenptr = sizeof (little_break_insn);
- return little_break_insn;
+ /* These must be set together, either before or after the shadow
+ read, so that if we're "reinserting" a breakpoint that
+ doesn't have a shadow yet, the breakpoint masking code inside
+ target_read_memory doesn't mask out this breakpoint using an
+ unfilled shadow buffer. The core may be trying to reinsert a
+ permanent breakpoint, for targets that support breakpoint
+ conditions/commands on the target side for some types of
+ breakpoints, such as target remote. */
+ bp_tgt->shadow_len = bplen;
+ memcpy (bp_tgt->shadow_contents, readbuf, bplen);
+
+ val = target_write_raw_memory (addr, bp, bplen);