aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2017-10-27 13:17:21 -0700
committerKeith Seitz <keiths@redhat.com>2017-11-28 13:23:10 -0800
commita62f06ebb31ac243450bf17b07b8892517e9a981 (patch)
tree2613c8cf49e3bcf0e4d05cbeb1e657f0c424a8cf
parent83b9557361c2d79479e17d5967f5180c371fa138 (diff)
downloadgdb-users/keiths/inline-func-bp-for-pedro.zip
gdb-users/keiths/inline-func-bp-for-pedro.tar.gz
gdb-users/keiths/inline-func-bp-for-pedro.tar.bz2
Same thing but using the exception, leaving bpstat_stop_status call where it is. This and the previous commit are intended to be exported to an stgit branch, where one can easily switch between the two approaches by push/pop'ing patches. Diffing against origin/master will therefore always give a complete patch sans busywork.
-rw-r--r--gdb/breakpoint.c99
-rw-r--r--gdb/breakpoint.h11
-rw-r--r--gdb/infrun.c18
3 files changed, 53 insertions, 75 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 0560589..d057666 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -68,6 +68,7 @@
#include "format.h"
#include "thread-fsm.h"
#include "tid-parse.h"
+#include "inline-frame.h"
/* readline include files */
#include "readline/readline.h"
@@ -5315,6 +5316,7 @@ bpstat_check_breakpoint_conditions (bpstat bs, ptid_t ptid)
}
CATCH (ex, RETURN_MASK_ALL)
{
+ clear_inline_frame_state (ptid);
exception_fprintf (gdb_stderr, ex,
"Error in testing breakpoint condition:\n");
}
@@ -5357,25 +5359,58 @@ need_moribund_for_location_type (struct bp_location *loc)
&& !target_supports_stopped_by_hw_breakpoint ()));
}
-/* See breakpoint.h. */
+
+/* Get a bpstat associated with having just stopped at address
+ BP_ADDR in thread PTID.
+
+ Determine whether we stopped at a breakpoint, etc, or whether we
+ don't understand this stop. Result is a chain of bpstat's such
+ that:
+
+ if we don't understand the stop, the result is a null pointer.
+
+ if we understand why we stopped, the result is not null.
+
+ Each element of the chain refers to a particular breakpoint or
+ watchpoint at which we have stopped. (We may have stopped for
+ several reasons concurrently.)
+
+ Each element of the chain has valid next, breakpoint_at,
+ commands, FIXME??? fields. */
bpstat
-build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
+bpstat_stop_status (const address_space *aspace,
+ CORE_ADDR bp_addr, ptid_t ptid,
const struct target_waitstatus *ws)
{
- struct breakpoint *b;
+ struct breakpoint *b = NULL;
+ struct bp_location *bl;
+ struct bp_location *loc;
+ /* First item of allocated bpstat's. */
bpstat bs_head = NULL, *bs_link = &bs_head;
+ /* Pointer to the last thing in the chain currently. */
+ bpstat bs;
+ int ix;
+ int need_remove_insert;
+ int removed_any;
+
+ /* First, build the bpstat chain with locations that explain a
+ target stop, while being careful to not set the target running,
+ as that may invalidate locations (in particular watchpoint
+ locations are recreated). Resuming will happen here with
+ breakpoint conditions or watchpoint expressions that include
+ inferior function calls. */
ALL_BREAKPOINTS (b)
{
if (!breakpoint_enabled (b))
continue;
- for (bp_location *bl = b->loc; bl != NULL; bl = bl->next)
+ for (bl = b->loc; bl != NULL; bl = bl->next)
{
/* For hardware watchpoints, we look only at the first
location. The watchpoint_check function will work on the
-
+ entire expression, not the individual locations. For
read watchpoints, the watchpoints_triggered function has
checked all locations already. */
if (b->type == bp_hardware_watchpoint && bl != b->loc)
@@ -5390,8 +5425,8 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
/* Come here if it's a watchpoint, or if the break address
matches. */
- bpstat bs = new bpstats (bl, &bs_link); /* Alloc a bpstat to
- explain stop. */
+ bs = new bpstats (bl, &bs_link); /* Alloc a bpstat to
+ explain stop. */
/* Assume we stop. Should we find a watchpoint that is not
actually triggered, or if the condition of the breakpoint
@@ -5416,15 +5451,12 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
if (!target_supports_stopped_by_sw_breakpoint ()
|| !target_supports_stopped_by_hw_breakpoint ())
{
- struct bp_location *loc;
-
- for (int ix = 0;
- VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
+ for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
{
if (breakpoint_location_address_match (loc, aspace, bp_addr)
&& need_moribund_for_location_type (loc))
{
- bpstat bs = new bpstats (loc, &bs_link);
+ bs = new bpstats (loc, &bs_link);
/* For hits of moribund locations, we should just proceed. */
bs->stop = 0;
bs->print = 0;
@@ -5433,49 +5465,6 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
}
}
- return bs_head;
-}
-
-/* Get a bpstat associated with having just stopped at address
- BP_ADDR in thread PTID.
-
- Determine whether we stopped at a breakpoint, etc, or whether we
- don't understand this stop. Result is a chain of bpstat's such
- that:
-
- if we don't understand the stop, the result is a null pointer.
-
- if we understand why we stopped, the result is not null.
-
- Each element of the chain refers to a particular breakpoint or
- watchpoint at which we have stopped. (We may have stopped for
- several reasons concurrently.)
-
- Each element of the chain has valid next, breakpoint_at,
- commands, FIXME??? fields. */
-
-bpstat
-bpstat_stop_status (const address_space *aspace,
- CORE_ADDR bp_addr, ptid_t ptid,
- const struct target_waitstatus *ws,
- bpstat stop_chain)
-{
- struct breakpoint *b = NULL;
- /* First item of allocated bpstat's. */
- bpstat bs_head = stop_chain;
- bpstat bs;
- int need_remove_insert;
- int removed_any;
-
- /* First, build the bpstat chain with locations that explain a
- target stop, while being careful to not set the target running,
- as that may invalidate locations (in particular watchpoint
- locations are recreated). Resuming will happen here with
- breakpoint conditions or watchpoint expressions that include
- inferior function calls. */
- if (bs_head == NULL)
- bs_head = build_bpstat_chain (aspace, bp_addr, ws);
-
/* A bit of special processing for shlib breakpoints. We need to
process solib loading here, so that the lists of loaded and
unloaded libraries are correct before we handle "catch load" and
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 9d17976..1e5b819 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -917,17 +917,9 @@ extern void bpstat_clear (bpstat *);
is part of the bpstat is copied as well. */
extern bpstat bpstat_copy (bpstat);
-/* Build the bstat chain for the stop information given by ASPACE,
- BP_ADDR, and WS. Returns the head of the bpstat chain. */
-
-extern bpstat build_bpstat_chain (const address_space *aspace,
- CORE_ADDR bp_addr,
- const struct target_waitstatus *ws);
-
extern bpstat bpstat_stop_status (const address_space *aspace,
CORE_ADDR pc, ptid_t ptid,
- const struct target_waitstatus *ws,
- bpstat stop_chain = NULL);
+ const struct target_waitstatus *ws);
/* Return true iff it is meaningful to use the address member of
BPT locations. For some breakpoint types, the locations' address members
@@ -943,7 +935,6 @@ extern bpstat bpstat_stop_status (const address_space *aspace,
bp_catchpoint
*/
-
extern bool breakpoint_address_is_meaningful (struct breakpoint *bpt);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 2b14024..db6fd4e 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -5839,7 +5839,12 @@ handle_signal_stop (struct execution_control_state *ecs)
ecs->event_thread->control.stop_step = 0;
stop_print_frame = 1;
stopped_by_random_signal = 0;
- bpstat stop_chain = NULL;
+
+ /* See if there is a breakpoint/watchpoint/catchpoint/etc. that
+ handles this event. */
+ ecs->event_thread->control.stop_bpstat
+ = bpstat_stop_status (get_current_regcache ()->aspace (),
+ stop_pc, ecs->ptid, &ecs->ws);
/* Hide inlined functions starting here, unless we just performed stepi or
nexti. After stepi and nexti, always show the innermost frame (not any
@@ -5873,9 +5878,8 @@ handle_signal_stop (struct execution_control_state *ecs)
{
struct breakpoint *bpt = NULL;
- stop_chain = build_bpstat_chain (aspace, stop_pc, &ecs->ws);
- if (stop_chain != NULL)
- bpt = stop_chain->breakpoint_at;
+ if (ecs->event_thread->control.stop_bpstat != NULL)
+ bpt = ecs->event_thread->control.stop_bpstat->breakpoint_at;
skip_inline_frames (ecs->ptid, bpt);
@@ -5922,12 +5926,6 @@ handle_signal_stop (struct execution_control_state *ecs)
}
}
- /* See if there is a breakpoint/watchpoint/catchpoint/etc. that
- handles this event. */
- ecs->event_thread->control.stop_bpstat
- = bpstat_stop_status (get_current_regcache ()->aspace (),
- stop_pc, ecs->ptid, &ecs->ws, stop_chain);
-
/* Following in case break condition called a
function. */
stop_print_frame = 1;