diff options
author | Pedro Alves <palves@redhat.com> | 2014-03-20 13:26:32 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2014-03-20 13:41:08 +0000 |
commit | 31e77af205cf6564c2bf4c18400b4ca16bdf92cd (patch) | |
tree | ce7406c39c0733118148ef67028650b264de9606 /gdb/breakpoint.h | |
parent | b9f437de50bcca478359c4c2ec0da50c29ddc512 (diff) | |
download | gdb-31e77af205cf6564c2bf4c18400b4ca16bdf92cd.zip gdb-31e77af205cf6564c2bf4c18400b4ca16bdf92cd.tar.gz gdb-31e77af205cf6564c2bf4c18400b4ca16bdf92cd.tar.bz2 |
PR breakpoints/7143 - Watchpoint does not trigger when first set
Say the program is stopped at a breakpoint, and the user sets a
watchpoint. When the program is next resumed, GDB will first step
over the breakpoint, as explained in the manual:
@value {GDBN} normally ignores breakpoints when it resumes
execution, until at least one instruction has been executed. If it
it did not do this, you would be unable to proceed past a breakpoint
without first disabling the breakpoint. This rule applies whether
or not the breakpoint already existed when your program stopped.
However, GDB currently also removes watchpoints, catchpoints, etc.,
and that means that the first instruction off the breakpoint does not
trigger the watchpoint, catchpoint, etc.
testsuite/gdb.base/watchpoint.exp has a kfail for this.
The PR proposes installing watchpoints only when stepping over a
breakpoint, but that misses catchpoints, etc.
A better fix would instead work from the opposite direction -- remove
only real breakpoints, leaving all other kinds of breakpoints
inserted.
But, going further, it's really a waste to constantly remove/insert
all breakpoints when stepping over a single breakpoint (generating a
pair of RSP z/Z packets for each breakpoint), so the fix goes a step
further and makes GDB remove _only_ the breakpoint being stepped over,
leaving all others installed. This then has the added benefit of
reducing breakpoint-related RSP traffic substancialy when there are
many breakpoints set.
gdb/
2014-03-20 Pedro Alves <palves@redhat.com>
PR breakpoints/7143
* breakpoint.c (should_be_inserted): Don't insert breakpoints that
are being stepped over.
(breakpoint_address_match): Make extern.
* breakpoint.h (breakpoint_address_match): New declaration.
* inferior.h (stepping_past_instruction_at): New declaration.
* infrun.c (struct step_over_info): New type.
(step_over_info): New global.
(set_step_over_info, clear_step_over_info)
(stepping_past_instruction_at): New functions.
(handle_inferior_event): Clear the step-over info when
trap_expected is cleared.
(resume): Remove now stale comment.
(clear_proceed_status): Clear step-over info.
(proceed): Adjust step-over handling to set or clear the step-over
info instead of removing all breakpoints.
(handle_signal_stop): When setting up a thread-hop, don't remove
breakpoints here.
(stop_stepping): Clear step-over info.
(keep_going): Adjust step-over handling to set or clear step-over
info and then always inserting breakpoints, instead of removing
all breakpoints when stepping over one.
gdb/testsuite/
2014-03-20 Pedro Alves <palves@redhat.com>
PR breakpoints/7143
* gdb.base/watchpoint.exp: Mention bugzilla bug number instead of
old gnats gdb/38. Remove kfail. Adjust to use gdb_test instead
of gdb_test_multiple.
* gdb.cp/annota2.exp: Remove kfail for gdb/38.
* gdb.cp/annota3.exp: Remove kfail for gdb/38.
Diffstat (limited to 'gdb/breakpoint.h')
-rw-r--r-- | gdb/breakpoint.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index bf1f52a..b4abcb8 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -1135,6 +1135,16 @@ extern int hardware_watchpoint_inserted_in_range (struct address_space *, extern int breakpoint_thread_match (struct address_space *, CORE_ADDR, ptid_t); +/* Returns true if {ASPACE1,ADDR1} and {ASPACE2,ADDR2} represent the + same breakpoint location. In most targets, this can only be true + if ASPACE1 matches ASPACE2. On targets that have global + breakpoints, the address space doesn't really matter. */ + +extern int breakpoint_address_match (struct address_space *aspace1, + CORE_ADDR addr1, + struct address_space *aspace2, + CORE_ADDR addr2); + extern void until_break_command (char *, int, int); /* Initialize a struct bp_location. */ |