static int strace_marker_p (struct breakpoint *b);
-/* The abstract base class all breakpoint_ops structures inherit
- from. */
-struct breakpoint_ops base_breakpoint_ops;
-
/* The breakpoint_ops structure to be inherited by all breakpoint_ops
that are implemented on top of software or hardware breakpoints
(user breakpoints, internal and momentary breakpoints, etc.). */
}
}
+/* Returns true if we need to track moribund locations of LOC's type
+ on the current target. */
+
+static int
+need_moribund_for_location_type (struct bp_location *loc)
+{
+ return ((loc->loc_type == bp_loc_software_breakpoint
+ && !target_supports_stopped_by_sw_breakpoint ())
+ || (loc->loc_type == bp_loc_hardware_breakpoint
+ && !target_supports_stopped_by_hw_breakpoint ()));
+}
+
/* Get a bpstat associated with having just stopped at address
BP_ADDR in thread PTID.
}
/* Check if a moribund breakpoint explains the stop. */
- for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
+ if (!target_supports_stopped_by_sw_breakpoint ()
+ || !target_supports_stopped_by_hw_breakpoint ())
{
- if (breakpoint_location_address_match (loc, aspace, bp_addr))
+ for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
{
- bs = bpstat_alloc (loc, &bs_link);
- /* For hits of moribund locations, we should just proceed. */
- bs->stop = 0;
- bs->print = 0;
- bs->print_it = print_it_noop;
+ if (breakpoint_location_address_match (loc, aspace, bp_addr)
+ && need_moribund_for_location_type (loc))
+ {
+ bs = bpstat_alloc (loc, &bs_link);
+ /* For hits of moribund locations, we should just proceed. */
+ bs->stop = 0;
+ bs->print = 0;
+ bs->print_it = print_it_noop;
+ }
}
}
}
\f
-/* Return 1 if LOC is pointing to a permanent breakpoint,
- return 0 otherwise. */
+/* See breakpoint.h. */
-static int
-bp_loc_is_permanent (struct bp_location *loc)
+int
+program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address)
{
int len;
CORE_ADDR addr;
struct cleanup *cleanup;
int retval = 0;
+ addr = address;
+ bpoint = gdbarch_breakpoint_from_pc (gdbarch, &addr, &len);
+
+ /* Software breakpoints unsupported? */
+ if (bpoint == NULL)
+ return 0;
+
+ target_mem = alloca (len);
+
+ /* Enable the automatic memory restoration from breakpoints while
+ we read the memory. Otherwise we could say about our temporary
+ breakpoints they are permanent. */
+ cleanup = make_show_memory_breakpoints_cleanup (0);
+
+ if (target_read_memory (address, target_mem, len) == 0
+ && memcmp (target_mem, bpoint, len) == 0)
+ retval = 1;
+
+ do_cleanups (cleanup);
+
+ return retval;
+}
+
+/* Return 1 if LOC is pointing to a permanent breakpoint,
+ return 0 otherwise. */
+
+static int
+bp_loc_is_permanent (struct bp_location *loc)
+{
+ struct cleanup *cleanup;
+ int retval;
+
gdb_assert (loc != NULL);
/* bp_call_dummy breakpoint locations are usually memory locations
if (loc->owner->type == bp_call_dummy)
return 0;
- addr = loc->address;
- bpoint = gdbarch_breakpoint_from_pc (loc->gdbarch, &addr, &len);
-
- /* Software breakpoints unsupported? */
- if (bpoint == NULL)
- return 0;
-
- target_mem = alloca (len);
-
- /* Enable the automatic memory restoration from breakpoints while
- we read the memory. Otherwise we could say about our temporary
- breakpoints they are permanent. */
cleanup = save_current_space_and_thread ();
-
switch_to_program_space_and_thread (loc->pspace);
- make_show_memory_breakpoints_cleanup (0);
- if (target_read_memory (loc->address, target_mem, len) == 0
- && memcmp (target_mem, bpoint, len) == 0)
- retval = 1;
+ retval = program_breakpoint_here_p (loc->gdbarch, loc->address);
do_cleanups (cleanup);
/* If no arg given, or if first arg is 'if ', use the default
breakpoint. */
if ((*address) == NULL
- || (strncmp ((*address), "if", 2) == 0 && isspace ((*address)[2])))
+ || (startswith ((*address), "if") && isspace ((*address)[2])))
{
/* The last displayed codepoint, if it's valid, is our default breakpoint
address. */
tok++;
toklen = end_tok - tok + 1;
- if (toklen == 6 && !strncmp (tok, "thread", 6))
+ if (toklen == 6 && startswith (tok, "thread"))
{
/* At this point we've found a "thread" token, which means
the user is trying to set a watchpoint that triggers
if (!valid_thread_id (thread))
invalid_thread_id_error (thread);
}
- else if (toklen == 4 && !strncmp (tok, "mask", 4))
+ else if (toklen == 4 && startswith (tok, "mask"))
{
/* We've found a "mask" token, which means the user wants to
create a hardware watchpoint that is going to have the mask
if (!found_object)
{
if (removed && non_stop
- && breakpoint_address_is_meaningful (old_loc->owner)
- && !is_hardware_watchpoint (old_loc->owner))
+ && need_moribund_for_location_type (old_loc))
{
/* This location was removed from the target. In
non-stop mode, a race condition is possible where
/* Decide if we are dealing with a static tracepoint marker (`-m'),
or with a normal static tracepoint. */
- if (arg && strncmp (arg, "-m", 2) == 0 && isspace (arg[2]))
+ if (arg && startswith (arg, "-m") && isspace (arg[2]))
ops = &strace_marker_breakpoint_ops;
else
ops = &tracepoint_breakpoint_ops;
command" [PROBE_MODIFIER] [LOCATION] [thread THREADNUM] [if CONDITION]\n\
PROBE_MODIFIER shall be present if the command is to be placed in a\n\
probe point. Accepted values are `-probe' (for a generic, automatically\n\
-guessed probe type) or `-probe-stap' (for a SystemTap probe).\n\
+guessed probe type), `-probe-stap' (for a SystemTap probe) or \n\
+`-probe-dtrace' (for a DTrace probe).\n\
LOCATION may be a line number, function name, or \"*\" and an address.\n\
If a line number is specified, break at start of code for that line.\n\
If a function is specified, break at start of code for that function.\n\