This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/7143] Watchpoint does not trigger when first set


https://sourceware.org/bugzilla/show_bug.cgi?id=7143

--- Comment #16 from Pedro Alves <palves at redhat dot com> ---
On 05/29/2014 06:47 PM, brobecker at adacore dot com wrote:>>>> >>> And thus
insert the userr breakpoints again, except we're not
>>>> >>> inserting the second breakpoint?!? I bet this is because we think
>>>> >>> it's still inserted, but in fact it got removed by the SSS bp
>>>> >>> removal earlier.

Yeah, sounds like that's it, because removing a breakpoint
bypasses the shadow buffer overlaying (breakpoint_xfer_memory):

int
default_memory_remove_breakpoint (struct gdbarch *gdbarch,
                  struct bp_target_info *bp_tgt)
{
  return target_write_raw_memory (bp_tgt->placed_address,
bp_tgt->shadow_contents,
                  bp_tgt->placed_size);
}

This is the sort of thing that'd be fixed if software
single-step breakpoints were in the generic global location
list framework, but, they're not.

I guess the simplest is to do something like:

int
deprecated_remove_raw_breakpoint (struct gdbarch *gdbarch, void *bp)
{
  struct bp_target_info *bp_tgt = bp;
-  int ret;
+  int ret = 0;

-  ret = target_remove_breakpoint (gdbarch, bp_tgt);
+  if (!software_breakpoint_inserted_here_p (bp_tgt->placed_aspace, 
+                                           bp_tgt->placed_address)
+    ret = target_remove_breakpoint (gdbarch, bp_tgt);
  xfree (bp_tgt);

  return ret;
}

But note software_breakpoint_inserted_here_p checks for software single-step
breakpoints too, so obviously a little refactoring is necessary.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]