/* Everything about breakpoints, for GDB.
Copyright (C) 1986-2019 Free Software Foundation, Inc.
+ Copyright (C) 2019 Advanced Micro Devices, Inc. All rights reserved.
This file is part of GDB.
/* Breakpoints set on probes. */
static struct breakpoint_ops bkpt_probe_breakpoint_ops;
+ /* Tracepoints set on probes. */
+ static struct breakpoint_ops tracepoint_probe_breakpoint_ops;
+
/* Dynamic printf class type. */
struct breakpoint_ops dprintf_breakpoint_ops;
breakpoints until the next resume, and removes them again when the
target fully stops. This is a bit safer in case GDB crashes while
processing user input. */
-static bool always_inserted_mode = false;
+/* FIXME: this is a temporary workaround to make sure waves created while
+ all known threads are stopped, and the gdb prompt is presented, do not
+ execute past the enabled breakpoints. */
+static bool always_inserted_mode = true;
static void
show_always_inserted_mode (struct ui_file *file, int from_tty,
mention (struct breakpoint *b)
{
b->ops->print_mention (b);
- current_uiout->text ("\n");
+ if (current_uiout->is_mi_like_p ())
+ return;
+ printf_filtered ("\n");
}
\f
return sals;
}
+ /* Returns the breakpoint ops appropriate for use with with LOCATION_TYPE and
+ according to IS_TRACEPOINT. */
+
+ static const struct breakpoint_ops *
+ breakpoint_ops_for_event_location_type (enum event_location_type location_type,
+ bool is_tracepoint)
+ {
+ if (is_tracepoint)
+ {
+ if (location_type == PROBE_LOCATION)
+ return &tracepoint_probe_breakpoint_ops;
+ else
+ return &tracepoint_breakpoint_ops;
+ }
+ else
+ {
+ if (location_type == PROBE_LOCATION)
+ return &bkpt_probe_breakpoint_ops;
+ else
+ return &bkpt_breakpoint_ops;
+ }
+ }
+
+ /* See breakpoint.h. */
+
+ const struct breakpoint_ops *
+ breakpoint_ops_for_event_location (const struct event_location *location,
+ bool is_tracepoint)
+ {
+ if (location != nullptr)
+ return breakpoint_ops_for_event_location_type
+ (event_location_type (location), is_tracepoint);
+ return is_tracepoint ? &tracepoint_breakpoint_ops : &bkpt_breakpoint_ops;
+ }
+
/* See breakpoint.h. */
int
enum bptype type_wanted = (flag & BP_HARDWAREFLAG
? bp_hardware_breakpoint
: bp_breakpoint);
- struct breakpoint_ops *ops;
event_location_up location = string_to_event_location (&arg, current_language);
-
- /* Matching breakpoints on probes. */
- if (location != NULL
- && event_location_type (location.get ()) == PROBE_LOCATION)
- ops = &bkpt_probe_breakpoint_ops;
- else
- ops = &bkpt_breakpoint_ops;
+ const struct breakpoint_ops *ops = breakpoint_ops_for_event_location
+ (location.get (), false /* is_tracepoint */);
create_breakpoint (get_current_arch (),
location.get (),
struct breakpoint_ops tracepoint_breakpoint_ops;
- /* The breakpoint_ops structure to be use on tracepoints placed in a
- static probe. */
+ /* Virtual table for tracepoints on static probes. */
static void
tracepoint_probe_create_sals_from_location
return bkpt_probe_decode_location (b, location, search_pspace);
}
- static struct breakpoint_ops tracepoint_probe_breakpoint_ops;
-
/* Dprintf breakpoint_ops methods. */
static void
static void
trace_command (const char *arg, int from_tty)
{
- struct breakpoint_ops *ops;
-
event_location_up location = string_to_event_location (&arg,
current_language);
- if (location != NULL
- && event_location_type (location.get ()) == PROBE_LOCATION)
- ops = &tracepoint_probe_breakpoint_ops;
- else
- ops = &tracepoint_breakpoint_ops;
+ const struct breakpoint_ops *ops = breakpoint_ops_for_event_location
+ (location.get (), true /* is_tracepoint */);
create_breakpoint (get_current_arch (),
location.get (),