/* Everything about breakpoints, for GDB.
- Copyright (C) 1986-2019 Free Software Foundation, Inc.
+ Copyright (C) 1986-2020 Free Software Foundation, Inc.
This file is part of GDB.
#include "gdb_regex.h"
#include "probe.h"
#include "cli/cli-utils.h"
-#include "continuations.h"
#include "stack.h"
-#include "skip.h"
#include "ax-gdb.h"
#include "dummy-frame.h"
#include "interps.h"
#include "thread-fsm.h"
#include "tid-parse.h"
#include "cli/cli-style.h"
-#include "mi/mi-main.h"
/* readline include files */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include "readline/tilde.h"
/* readline defines this. */
#undef savestring
static void update_global_location_list_nothrow (enum ugll_insert_mode);
-static int is_hardware_watchpoint (const struct breakpoint *bpt);
-
static void insert_breakpoint_locations (void);
static void trace_pass_command (const char *, int);
static void set_tracepoint_count (int num);
-static int is_masked_watchpoint (const struct breakpoint *b);
+static bool is_masked_watchpoint (const struct breakpoint *b);
static struct bp_location **get_first_locp_gte_addr (CORE_ADDR address);
/* 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;
/* True if dprintf commands should continue to operate even if GDB
has disconnected. */
-static int disconnected_dprintf = 1;
+static bool disconnected_dprintf = true;
struct command_line *
breakpoint_commands (struct breakpoint *b)
/* Flag indicating that a command has proceeded the inferior past the
current breakpoint. */
-static int breakpoint_proceeded;
+static bool breakpoint_proceeded;
const char *
bpdisp_text (enum bpdisp disp)
value);
}
-/* If 1, gdb will automatically use hardware breakpoints for breakpoints
+/* If true, gdb will automatically use hardware breakpoints for breakpoints
set with "break" but falling in read-only memory.
- If 0, gdb will warn about such breakpoints, but won't automatically
+ If false, gdb will warn about such breakpoints, but won't automatically
use hardware breakpoints. */
-static int automatic_hardware_breakpoints;
+static bool automatic_hardware_breakpoints;
static void
show_automatic_hardware_breakpoints (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
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 int always_inserted_mode = 0;
+static bool always_inserted_mode = false;
static void
show_always_inserted_mode (struct ui_file *file, int from_tty,
no threads under GDB's control yet. */
return 1;
}
- else if (target_has_execution)
+ else
{
if (always_inserted_mode)
{
return 1;
}
- if (threads_are_executing ())
- return 1;
+ for (inferior *inf : all_inferiors ())
+ if (inf->has_execution ()
+ && threads_are_executing (inf->process_target ()))
+ return 1;
/* Don't remove breakpoints yet if, even though all threads are
stopped, we still have events to process. */
static int overlay_events_enabled;
/* See description in breakpoint.h. */
-int target_exact_watchpoints = 0;
+bool target_exact_watchpoints = false;
/* Walk the following statement or block through all breakpoints.
ALL_BREAKPOINTS_SAFE does so even if the statement deletes the
/* Chains of all breakpoints defined. */
-struct breakpoint *breakpoint_chain;
+static struct breakpoint *breakpoint_chain;
-/* Array is sorted by bp_locations_compare - primarily by the ADDRESS. */
+/* Array is sorted by bp_location_is_less_than - primarily by the ADDRESS. */
static struct bp_location **bp_locations;
/* A comparison function for bp_location AP and BP that is used by
bsearch. This comparison function only cares about addresses, unlike
- the more general bp_locations_compare function. */
+ the more general bp_location_is_less_than function. */
static int
bp_locations_compare_addrs (const void *ap, const void *bp)
return type == bp_longjmp || type == bp_exception;
}
-int
+/* See breakpoint.h. */
+
+bool
is_tracepoint (const struct breakpoint *b)
{
return is_tracepoint_type (b->type);
}
}
-\f
-
-/* Return true if BPT is either a software breakpoint or a hardware
- breakpoint. */
+/* See breakpoint.h. */
-int
+bool
is_breakpoint (const struct breakpoint *bpt)
{
return (bpt->type == bp_breakpoint
/* Return true if BPT is of any hardware watchpoint kind. */
-static int
+static bool
is_hardware_watchpoint (const struct breakpoint *bpt)
{
return (bpt->type == bp_hardware_watchpoint
|| bpt->type == bp_access_watchpoint);
}
-/* Return true if BPT is of any watchpoint kind, hardware or
- software. */
+/* See breakpoint.h. */
-int
+bool
is_watchpoint (const struct breakpoint *bpt)
{
return (is_hardware_watchpoint (bpt)
/* Returns true if B is a software watchpoint that is not watching any
memory (e.g., "watch $pc"). */
-static int
+static bool
is_no_memory_software_watchpoint (struct breakpoint *b)
{
return (b->type == bp_watchpoint
to the user when the old value and the new value may actually
be completely different objects. */
b->val = NULL;
- b->val_valid = 0;
+ b->val_valid = false;
/* Note that unlike with breakpoints, the watchpoint's condition
expression is stored in the breakpoint object, not in the
if (b->val_bitsize != 0)
v = extract_bitfield_from_watchpoint_value (b, v);
b->val = release_value (v);
- b->val_valid = 1;
+ b->val_valid = true;
}
frame_pspace = get_frame_program_space (get_selected_frame (NULL));
if we aren't attached to any process yet, we should still
insert breakpoints. */
if (!gdbarch_has_global_breakpoints (target_gdbarch ())
- && inferior_ptid == null_ptid)
+ && (inferior_ptid == null_ptid || !target_has_execution))
continue;
val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
if we aren't attached to any process yet, we should still
insert breakpoints. */
if (!gdbarch_has_global_breakpoints (target_gdbarch ())
- && inferior_ptid == null_ptid)
+ && (inferior_ptid == null_ptid || !target_has_execution))
continue;
val = insert_bp_location (bl, &tmp_error_stream, &disabled_breaks,
/* Reset val field to force reread of starting value in
insert_breakpoints. */
w->val.reset (nullptr);
- w->val_valid = 0;
+ w->val_valid = false;
}
}
}
}
return 0;
}
-\f
-/* bpstat stuff. External routines' interfaces are documented
- in breakpoint.h. */
+/* See breakpoint.h. */
-int
-is_catchpoint (struct breakpoint *ep)
+bool
+is_catchpoint (struct breakpoint *b)
{
- return (ep->type == bp_catchpoint);
+ return (b->type == bp_catchpoint);
}
/* Frees any storage that is part of a bpstat. Does not walk the
/* See breakpoint.h. */
-int
+bool
bpstat_explains_signal (bpstat bsp, enum gdb_signal sig)
{
for (; bsp != NULL; bsp = bsp->next)
/* A moribund location can never explain a signal other than
GDB_SIGNAL_TRAP. */
if (sig == GDB_SIGNAL_TRAP)
- return 1;
+ return true;
}
else
{
if (bsp->breakpoint_at->ops->explains_signal (bsp->breakpoint_at,
sig))
- return 1;
+ return true;
}
}
- return 0;
+ return false;
}
/* Put in *NUM the breakpoint number of the first breakpoint we are
watchpoint_value_print (struct value *val, struct ui_file *stream)
{
if (val == NULL)
- fprintf_unfiltered (stream, _("<unreadable>"));
+ fprintf_styled (stream, metadata_style.style (), _("<unreadable>"));
else
{
struct value_print_options opts;
struct thread_info *thr = inferior_thread ();
uiout->text ("Thread ");
- uiout->field_fmt ("thread-id", "%s", print_thread_id (thr));
+ uiout->field_string ("thread-id", print_thread_id (thr));
name = thr->name != NULL ? thr->name : target_thread_name (thr);
if (name != NULL)
{
uiout->text (" \"");
- uiout->field_fmt ("name", "%s", name);
+ uiout->field_string ("name", name);
uiout->text ("\"");
}
{
bs->old_val = b->val;
b->val = release_value (new_val);
- b->val_valid = 1;
+ b->val_valid = true;
if (new_val != NULL)
value_free_to_mark (mark);
return WP_VALUE_CHANGED;
if (uiout->is_mi_like_p ())
uiout->field_string
("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
- uiout->text ("\nWatchpoint ");
- uiout->field_int ("wpnum", b->number);
- uiout->text (" deleted because the program has left the block in\n"
- "which its expression is valid.\n");
+ uiout->message ("\nWatchpoint %pF deleted because the program has "
+ "left the block in\n"
+ "which its expression is valid.\n",
+ signed_field ("wpnum", b->number));
}
/* Make sure the watchpoint's commands aren't executed. */
retval.main_action = BPSTAT_WHAT_KEEP_CHECKING;
retval.call_dummy = STOP_NONE;
- retval.is_longjmp = 0;
+ retval.is_longjmp = false;
for (bs = bs_head; bs != NULL; bs = bs->next)
{
}
else
{
- /* There was a catchpoint, but we're not stopping.
- This requires no further action. */
+ /* Some catchpoints are implemented with breakpoints.
+ For those, we need to step over the breakpoint. */
+ if (bs->bp_location_at->loc_type != bp_loc_other)
+ this_action = BPSTAT_WHAT_SINGLE;
}
break;
case bp_jit_event:
}
}
-/* Nonzero if we should step constantly (e.g. watchpoints on machines
- without hardware support). This isn't related to a specific bpstat,
- just to things like whether watchpoints are set. */
+/* See breakpoint.h. */
-int
-bpstat_should_step (void)
+bool
+bpstat_should_step ()
{
struct breakpoint *b;
ALL_BREAKPOINTS (b)
if (breakpoint_enabled (b) && b->type == bp_watchpoint && b->loc != NULL)
- return 1;
- return 0;
+ return true;
+ return false;
}
-int
+/* See breakpoint.h. */
+
+bool
bpstat_causes_stop (bpstat bs)
{
for (; bs != NULL; bs = bs->next)
if (bs->stop)
- return 1;
+ return true;
- return 0;
+ return false;
}
\f
if (sym)
{
uiout->text ("in ");
- uiout->field_string ("func", SYMBOL_PRINT_NAME (sym),
- ui_out_style_kind::FUNCTION);
+ uiout->field_string ("func", sym->print_name (),
+ function_name_style.style ());
uiout->text (" ");
uiout->wrap_hint (wrap_indent_at_field (uiout, "what"));
uiout->text ("at ");
}
uiout->field_string ("file",
symtab_to_filename_for_display (loc->symtab),
- ui_out_style_kind::FILE);
+ file_name_style.style ());
uiout->text (":");
if (uiout->is_mi_like_p ())
uiout->field_string ("fullname", symtab_to_fullname (loc->symtab));
- uiout->field_int ("line", loc->line_number);
+ uiout->field_signed ("line", loc->line_number);
}
else if (loc)
{
}
}
-/* Print B to gdb_stdout. */
+/* Print B to gdb_stdout. If RAW_LOC, print raw breakpoint locations
+ instead of going via breakpoint_ops::print_one. This makes "maint
+ info breakpoints" show the software breakpoint locations of
+ catchpoints, which are considered internal implementation
+ detail. */
static void
print_one_breakpoint_location (struct breakpoint *b,
struct bp_location *loc,
int loc_number,
struct bp_location **last_loc,
- int allflag)
+ int allflag, bool raw_loc)
{
struct command_line *l;
static char bpenables[] = "nynny";
if (part_of_multiple)
uiout->field_fmt ("number", "%d.%d", b->number, loc_number);
else
- uiout->field_int ("number", b->number);
+ uiout->field_signed ("number", b->number);
/* 2 */
annotate_field (1);
uiout->field_fmt ("enabled", "%c", bpenables[(int) b->enable_state]);
/* 5 and 6 */
- if (b->ops != NULL && b->ops->print_one != NULL)
+ if (!raw_loc && b->ops != NULL && b->ops->print_one != NULL)
b->ops->print_one (b, last_loc);
else
- switch (b->type)
- {
- case bp_none:
- internal_error (__FILE__, __LINE__,
- _("print_one_breakpoint: bp_none encountered\n"));
- break;
-
- case bp_watchpoint:
- case bp_hardware_watchpoint:
- case bp_read_watchpoint:
- case bp_access_watchpoint:
+ {
+ if (is_watchpoint (b))
{
struct watchpoint *w = (struct watchpoint *) b;
annotate_field (5);
uiout->field_string ("what", w->exp_string);
}
- break;
-
- case bp_breakpoint:
- case bp_hardware_breakpoint:
- case bp_single_step:
- case bp_until:
- case bp_finish:
- case bp_longjmp:
- case bp_longjmp_resume:
- case bp_longjmp_call_dummy:
- case bp_exception:
- case bp_exception_resume:
- case bp_step_resume:
- case bp_hp_step_resume:
- case bp_watchpoint_scope:
- case bp_call_dummy:
- case bp_std_terminate:
- case bp_shlib_event:
- case bp_thread_event:
- case bp_overlay_event:
- case bp_longjmp_master:
- case bp_std_terminate_master:
- case bp_exception_master:
- case bp_tracepoint:
- case bp_fast_tracepoint:
- case bp_static_tracepoint:
- case bp_dprintf:
- case bp_jit_event:
- case bp_gnu_ifunc_resolver:
- case bp_gnu_ifunc_resolver_return:
- if (opts.addressprint)
- {
- annotate_field (4);
- if (header_of_multiple)
- uiout->field_string ("addr", "<MULTIPLE>");
- else if (b->loc == NULL || loc->shlib_disabled)
- uiout->field_string ("addr", "<PENDING>");
- else
- uiout->field_core_addr ("addr",
- loc->gdbarch, loc->address);
- }
- annotate_field (5);
- if (!header_of_multiple)
- print_breakpoint_location (b, loc);
- if (b->loc)
- *last_loc = b->loc;
- break;
- }
-
+ else if (!is_catchpoint (b) || is_exception_catchpoint (b)
+ || is_ada_exception_catchpoint (b))
+ {
+ if (opts.addressprint)
+ {
+ annotate_field (4);
+ if (header_of_multiple)
+ uiout->field_string ("addr", "<MULTIPLE>",
+ metadata_style.style ());
+ else if (b->loc == NULL || loc->shlib_disabled)
+ uiout->field_string ("addr", "<PENDING>",
+ metadata_style.style ());
+ else
+ uiout->field_core_addr ("addr",
+ loc->gdbarch, loc->address);
+ }
+ annotate_field (5);
+ if (!header_of_multiple)
+ print_breakpoint_location (b, loc);
+ if (b->loc)
+ *last_loc = b->loc;
+ }
+ }
if (loc != NULL && !header_of_multiple)
{
/* FIXME: This seems to be redundant and lost here; see the
"stop only in" line a little further down. */
uiout->text (" thread ");
- uiout->field_int ("thread", b->thread);
+ uiout->field_signed ("thread", b->thread);
}
else if (b->task != 0)
{
uiout->text (" task ");
- uiout->field_int ("task", b->task);
+ uiout->field_signed ("task", b->task);
}
}
&& breakpoint_condition_evaluation_mode ()
== condition_evaluation_target)
{
- uiout->text (" (");
- uiout->field_string ("evaluated-by",
- bp_condition_evaluator (b));
- uiout->text (" evals)");
+ uiout->message (" (%pF evals)",
+ string_field ("evaluated-by",
+ bp_condition_evaluator (b)));
}
uiout->text ("\n");
}
/* FIXME should make an annotation for this. */
uiout->text ("\tstop only in thread ");
if (uiout->is_mi_like_p ())
- uiout->field_int ("thread", b->thread);
+ uiout->field_signed ("thread", b->thread);
else
{
struct thread_info *thr = find_thread_global_id (b->thread);
else
uiout->text ("\tbreakpoint");
uiout->text (" already hit ");
- uiout->field_int ("times", b->hit_count);
+ uiout->field_signed ("times", b->hit_count);
if (b->hit_count == 1)
uiout->text (" time\n");
else
{
/* Output the count also if it is zero, but only if this is mi. */
if (uiout->is_mi_like_p ())
- uiout->field_int ("times", b->hit_count);
+ uiout->field_signed ("times", b->hit_count);
}
}
if (!part_of_multiple && b->ignore_count)
{
annotate_field (8);
- uiout->text ("\tignore next ");
- uiout->field_int ("ignore", b->ignore_count);
- uiout->text (" hits\n");
+ uiout->message ("\tignore next %pF hits\n",
+ signed_field ("ignore", b->ignore_count));
}
/* Note that an enable count of 1 corresponds to "enable once"
uiout->text ("additional ");
else
uiout->text ("next ");
- uiout->field_int ("enable", b->enable_count);
+ uiout->field_signed ("enable", b->enable_count);
uiout->text (" hits\n");
}
if (tp->traceframe_usage)
{
uiout->text ("\ttrace buffer usage ");
- uiout->field_int ("traceframe-usage", tp->traceframe_usage);
+ uiout->field_signed ("traceframe-usage", tp->traceframe_usage);
uiout->text (" bytes\n");
}
}
{
annotate_field (10);
uiout->text ("\tpass count ");
- uiout->field_int ("pass", t->pass_count);
+ uiout->field_signed ("pass", t->pass_count);
uiout->text (" \n");
}
|| fix_multi_location_breakpoint_output_globally);
gdb::optional<ui_out_emit_tuple> bkpt_tuple_emitter (gdb::in_place, uiout, "bkpt");
- print_one_breakpoint_location (b, NULL, 0, last_loc, allflag);
+ print_one_breakpoint_location (b, NULL, 0, last_loc, allflag, false);
/* The mi2 broken format: the main breakpoint tuple ends here, the locations
are outside. */
/* If this breakpoint has custom print function,
it's already printed. Otherwise, print individual
locations, if any. */
- if (b->ops == NULL || b->ops->print_one == NULL)
+ if (b->ops == NULL
+ || b->ops->print_one == NULL
+ || allflag)
{
/* If breakpoint has a single location that is disabled, we
print it as if it had several locations, since otherwise it's
situation.
Note that while hardware watchpoints have several locations
- internally, that's not a property exposed to user. */
- if (b->loc
- && !is_hardware_watchpoint (b)
- && (b->loc->next || !b->loc->enabled))
+ internally, that's not a property exposed to users.
+
+ Likewise, while catchpoints may be implemented with
+ breakpoints (e.g., catch throw), that's not a property
+ exposed to users. We do however display the internal
+ breakpoint locations with "maint info breakpoints". */
+ if (!is_hardware_watchpoint (b)
+ && (!is_catchpoint (b) || is_exception_catchpoint (b)
+ || is_ada_exception_catchpoint (b))
+ && (allflag
+ || (b->loc && (b->loc->next || !b->loc->enabled))))
{
gdb::optional<ui_out_emit_list> locations_list;
for (bp_location *loc = b->loc; loc != NULL; loc = loc->next, ++n)
{
ui_out_emit_tuple loc_tuple_emitter (uiout, NULL);
- print_one_breakpoint_location (b, loc, n, last_loc, allflag);
+ print_one_breakpoint_location (b, loc, n, last_loc,
+ allflag, allflag);
}
}
}
return b->loc == NULL;
}
-/* Print information on user settable breakpoint (watchpoint, etc)
- number BNUM. If BNUM is -1 print all user-settable breakpoints.
- If ALLFLAG is non-zero, include non-user-settable breakpoints. If
- FILTER is non-NULL, call it on each breakpoint and only include the
- ones for which it returns non-zero. Return the total number of
- breakpoints listed. */
+/* Print information on breakpoints (including watchpoints and tracepoints).
+
+ If non-NULL, BP_NUM_LIST is a list of numbers and number ranges as
+ understood by number_or_range_parser. Only breakpoints included in this
+ list are then printed.
+
+ If SHOW_INTERNAL is true, print internal breakpoints.
+
+ If FILTER is non-NULL, call it on each breakpoint and only include the
+ ones for which it returns true.
+
+ Return the total number of breakpoints listed. */
static int
-breakpoint_1 (const char *args, int allflag,
- int (*filter) (const struct breakpoint *))
+breakpoint_1 (const char *bp_num_list, bool show_internal,
+ bool (*filter) (const struct breakpoint *))
{
struct breakpoint *b;
struct bp_location *last_loc = NULL;
if (filter && !filter (b))
continue;
- /* If we have an "args" string, it is a list of breakpoints to
+ /* If we have a BP_NUM_LIST string, it is a list of breakpoints to
accept. Skip the others. */
- if (args != NULL && *args != '\0')
+ if (bp_num_list != NULL && *bp_num_list != '\0')
{
- if (allflag && parse_and_eval_long (args) != b->number)
+ if (show_internal && parse_and_eval_long (bp_num_list) != b->number)
continue;
- if (!allflag && !number_is_in_list (args, b->number))
+ if (!show_internal && !number_is_in_list (bp_num_list, b->number))
continue;
}
- if (allflag || user_breakpoint_p (b))
+ if (show_internal || user_breakpoint_p (b))
{
int addr_bit, type_len;
if (filter && !filter (b))
continue;
- /* If we have an "args" string, it is a list of breakpoints to
+ /* If we have a BP_NUM_LIST string, it is a list of breakpoints to
accept. Skip the others. */
- if (args != NULL && *args != '\0')
+ if (bp_num_list != NULL && *bp_num_list != '\0')
{
- if (allflag) /* maintenance info breakpoint */
+ if (show_internal) /* maintenance info breakpoint */
{
- if (parse_and_eval_long (args) != b->number)
+ if (parse_and_eval_long (bp_num_list) != b->number)
continue;
}
else /* all others */
{
- if (!number_is_in_list (args, b->number))
+ if (!number_is_in_list (bp_num_list, b->number))
continue;
}
}
/* We only print out user settable breakpoints unless the
- allflag is set. */
- if (allflag || user_breakpoint_p (b))
- print_one_breakpoint (b, &last_loc, allflag);
+ show_internal is set. */
+ if (show_internal || user_breakpoint_p (b))
+ print_one_breakpoint (b, &last_loc, show_internal);
}
}
empty list. */
if (!filter)
{
- if (args == NULL || *args == '\0')
+ if (bp_num_list == NULL || *bp_num_list == '\0')
uiout->message ("No breakpoints or watchpoints.\n");
else
uiout->message ("No breakpoint or watchpoint matching '%s'.\n",
- args);
+ bp_num_list);
}
}
else
static void
info_breakpoints_command (const char *args, int from_tty)
{
- breakpoint_1 (args, 0, NULL);
+ breakpoint_1 (args, false, NULL);
default_collect_info ();
}
static void
info_watchpoints_command (const char *args, int from_tty)
{
- int num_printed = breakpoint_1 (args, 0, is_watchpoint);
+ int num_printed = breakpoint_1 (args, false, is_watchpoint);
struct ui_out *uiout = current_uiout;
if (num_printed == 0)
static void
maintenance_info_breakpoints (const char *args, int from_tty)
{
- breakpoint_1 (args, 1, NULL);
+ breakpoint_1 (args, true, NULL);
default_collect_info ();
}
(others > 1) ? ","
: ((others == 1) ? " and" : ""));
}
- printf_filtered (_("also set at pc "));
- fputs_styled (paddress (gdbarch, pc), address_style.style (), gdb_stdout);
- printf_filtered (".\n");
+ current_uiout->message (_("also set at pc %ps.\n"),
+ styled_string (address_style.style (),
+ paddress (gdbarch, pc)));
}
}
\f
-/* Return true iff it is meaningful to use the address member of
- BPT locations. For some breakpoint types, the locations' address members
- are irrelevant and it makes no sense to attempt to compare them to other
- addresses (or use them for any other purpose either).
-
- More specifically, each of the following breakpoint types will
- always have a zero valued location address and we don't want to mark
- breakpoints of any of these types to be a duplicate of an actual
- breakpoint location at address zero:
+/* Return true iff it is meaningful to use the address member of LOC.
+ For some breakpoint types, the locations' address members are
+ irrelevant and it makes no sense to attempt to compare them to
+ other addresses (or use them for any other purpose either).
- bp_watchpoint
- bp_catchpoint
+ More specifically, software watchpoints and catchpoints that are
+ not backed by breakpoints always have a zero valued location
+ address and we don't want to mark breakpoints of any of these types
+ to be a duplicate of an actual breakpoint location at address
+ zero. */
-*/
-
-static int
-breakpoint_address_is_meaningful (struct breakpoint *bpt)
+static bool
+bl_address_is_meaningful (bp_location *loc)
{
- enum bptype type = bpt->type;
-
- return (type != bp_watchpoint && type != bp_catchpoint);
+ return loc->loc_type != bp_loc_other;
}
/* Assuming LOC1 and LOC2's owners are hardware watchpoints, returns
}
/* Assuming LOC1 and LOC2's types' have meaningful target addresses
- (breakpoint_address_is_meaningful), returns true if LOC1 and LOC2
- represent the same location. */
+ (bl_address_is_meaningful), returns true if LOC1 and LOC2 represent
+ the same location. */
static int
breakpoint_locations_match (struct bp_location *loc1,
}
}
-bp_location::bp_location (breakpoint *owner)
+static bp_loc_type
+bp_location_from_bp_type (bptype type)
{
- bp_location *loc = this;
-
- loc->owner = owner;
- loc->cond_bytecode = NULL;
- loc->shlib_disabled = 0;
- loc->enabled = 1;
-
- switch (owner->type)
+ switch (type)
{
case bp_breakpoint:
case bp_single_step:
case bp_gnu_ifunc_resolver:
case bp_gnu_ifunc_resolver_return:
case bp_dprintf:
- loc->loc_type = bp_loc_software_breakpoint;
- mark_breakpoint_location_modified (loc);
- break;
+ return bp_loc_software_breakpoint;
case bp_hardware_breakpoint:
- loc->loc_type = bp_loc_hardware_breakpoint;
- mark_breakpoint_location_modified (loc);
- break;
+ return bp_loc_hardware_breakpoint;
case bp_hardware_watchpoint:
case bp_read_watchpoint:
case bp_access_watchpoint:
- loc->loc_type = bp_loc_hardware_watchpoint;
- break;
+ return bp_loc_hardware_watchpoint;
case bp_watchpoint:
case bp_catchpoint:
case bp_tracepoint:
case bp_fast_tracepoint:
case bp_static_tracepoint:
- loc->loc_type = bp_loc_other;
- break;
+ return bp_loc_other;
default:
internal_error (__FILE__, __LINE__, _("unknown breakpoint type"));
}
+}
+
+bp_location::bp_location (breakpoint *owner, bp_loc_type type)
+{
+ this->owner = owner;
+ this->cond_bytecode = NULL;
+ this->shlib_disabled = 0;
+ this->enabled = 1;
+
+ this->loc_type = type;
+
+ if (this->loc_type == bp_loc_software_breakpoint
+ || this->loc_type == bp_loc_hardware_breakpoint)
+ mark_breakpoint_location_modified (this);
+
+ this->refc = 1;
+}
- loc->refc = 1;
+bp_location::bp_location (breakpoint *owner)
+ : bp_location::bp_location (owner,
+ bp_location_from_bp_type (owner->type))
+{
}
/* Allocate a struct bp_location. */
{
struct breakpoint *b = loc->owner;
- function_name = MSYMBOL_LINKAGE_NAME (loc->msymbol);
+ function_name = loc->msymbol->linkage_name ();
if (b->type == bp_breakpoint && b->loc == loc
&& loc->next == NULL && b->related_breakpoint == b)
uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_FORK));
uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- uiout->field_int ("bkptno", b->number);
+ uiout->field_signed ("bkptno", b->number);
uiout->text (" (forked process ");
- uiout->field_int ("newpid", c->forked_inferior_pid.pid ());
+ uiout->field_signed ("newpid", c->forked_inferior_pid.pid ());
uiout->text ("), ");
return PRINT_SRC_AND_LOC;
}
if (c->forked_inferior_pid != null_ptid)
{
uiout->text (", process ");
- uiout->field_int ("what", c->forked_inferior_pid.pid ());
+ uiout->field_signed ("what", c->forked_inferior_pid.pid ());
uiout->spaces (1);
}
uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_VFORK));
uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- uiout->field_int ("bkptno", b->number);
+ uiout->field_signed ("bkptno", b->number);
uiout->text (" (vforked process ");
- uiout->field_int ("newpid", c->forked_inferior_pid.pid ());
+ uiout->field_signed ("newpid", c->forked_inferior_pid.pid ());
uiout->text ("), ");
return PRINT_SRC_AND_LOC;
}
if (c->forked_inferior_pid != null_ptid)
{
uiout->text (", process ");
- uiout->field_int ("what", c->forked_inferior_pid.pid ());
+ uiout->field_signed ("what", c->forked_inferior_pid.pid ());
uiout->spaces (1);
}
uiout->text ("Temporary catchpoint ");
else
uiout->text ("Catchpoint ");
- uiout->field_int ("bkptno", b->number);
+ uiout->field_signed ("bkptno", b->number);
uiout->text ("\n");
if (uiout->is_mi_like_p ())
uiout->field_string ("disp", bpdisp_text (b->disposition));
uiout->field_string ("reason", async_reason_lookup (EXEC_ASYNC_EXEC));
uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- uiout->field_int ("bkptno", b->number);
+ uiout->field_signed ("bkptno", b->number);
uiout->text (" (exec'd ");
uiout->field_string ("new-exec", c->exec_pathname);
uiout->text ("), ");
{
gdb_assert (loc != NULL);
- /* If we have a catchpoint or a watchpoint, just return 0. We should not
- attempt to read from the addresses the locations of these breakpoint types
- point to. program_breakpoint_here_p, below, will attempt to read
+ /* If we have a non-breakpoint-backed catchpoint or a software
+ watchpoint, just return 0. We should not attempt to read from
+ the addresses the locations of these breakpoint types point to.
+ program_breakpoint_here_p, below, will attempt to read
memory. */
- if (!breakpoint_address_is_meaningful (loc->owner))
+ if (!bl_address_is_meaningful (loc))
return 0;
scoped_restore_current_pspace_and_thread restore_pspace_thread;
b->location = std::move (location);
else
b->location = new_address_location (b->loc->address, NULL, 0);
- b->filter = filter.release ();
+ b->filter = std::move (filter);
}
static void
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 (),
async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- uiout->field_int ("bkptno", b->number);
+ uiout->field_signed ("bkptno", b->number);
uiout->text (", ");
return PRINT_SRC_AND_LOC;
}
ui_out_emit_tuple tuple_emitter (uiout, tuple_name);
- uiout->field_int ("number", b->number);
+ uiout->field_signed ("number", b->number);
uiout->text (": ");
uiout->field_string ("exp", w->exp_string);
}
}
ui_out_emit_tuple tuple_emitter (uiout, tuple_name);
- uiout->field_int ("number", b->number);
+ uiout->field_signed ("number", b->number);
uiout->text (": ");
uiout->field_string ("exp", w->exp_string);
}
/* Tell whether the given watchpoint is a masked hardware watchpoint. */
-static int
+static bool
is_masked_watchpoint (const struct breakpoint *b)
{
return b->ops == &masked_watchpoint_breakpoint_ops;
w->val = val;
w->val_bitpos = saved_bitpos;
w->val_bitsize = saved_bitsize;
- w->val_valid = 1;
+ w->val_valid = true;
}
if (cond_start)
enough for now, though. */
}
- init_raw_breakpoint (b, gdbarch, sal, bp_breakpoint, ops);
+ init_raw_breakpoint (b, gdbarch, sal, bp_catchpoint, ops);
b->enable_state = enabled ? bp_enabled : bp_disabled;
b->disposition = tempflag ? disp_del : disp_donttouch;
}
/* A comparison function for bp_location AP and BP being interfaced to
- qsort. Sort elements primarily by their ADDRESS (no matter what
- does breakpoint_address_is_meaningful say for its OWNER),
- secondarily by ordering first permanent elements and
- terciarily just ensuring the array is sorted stable way despite
- qsort being an unstable algorithm. */
+ std::sort. Sort elements primarily by their ADDRESS (no matter what
+ bl_address_is_meaningful says), secondarily by ordering first
+ permanent elements and terciarily just ensuring the array is sorted
+ stable way despite std::sort being an unstable algorithm. */
static int
-bp_locations_compare (const void *ap, const void *bp)
+bp_location_is_less_than (const bp_location *a, const bp_location *b)
{
- const struct bp_location *a = *(const struct bp_location **) ap;
- const struct bp_location *b = *(const struct bp_location **) bp;
-
if (a->address != b->address)
- return (a->address > b->address) - (a->address < b->address);
+ return a->address < b->address;
/* Sort locations at the same address by their pspace number, keeping
locations of the same inferior (in a multi-inferior environment)
grouped. */
if (a->pspace->num != b->pspace->num)
- return ((a->pspace->num > b->pspace->num)
- - (a->pspace->num < b->pspace->num));
+ return a->pspace->num < b->pspace->num;
/* Sort permanent breakpoints first. */
if (a->permanent != b->permanent)
- return (a->permanent < b->permanent) - (a->permanent > b->permanent);
+ return a->permanent > b->permanent;
/* Make the internal GDB representation stable across GDB runs
where A and B memory inside GDB can differ. Breakpoint locations of
the same type at the same address can be sorted in arbitrary order. */
if (a->owner->number != b->owner->number)
- return ((a->owner->number > b->owner->number)
- - (a->owner->number < b->owner->number));
+ return a->owner->number < b->owner->number;
- return (a > b) - (a < b);
+ return a < b;
}
/* Set bp_locations_placed_address_before_address_max and
ALL_BREAKPOINTS (b)
for (loc = b->loc; loc; loc = loc->next)
*locp++ = loc;
- qsort (bp_locations, bp_locations_count, sizeof (*bp_locations),
- bp_locations_compare);
+ std::sort (bp_locations, bp_locations + bp_locations_count,
+ bp_location_is_less_than);
bp_locations_target_extensions_update ();
this one from the target. */
/* OLD_LOC comes from existing struct breakpoint. */
- if (breakpoint_address_is_meaningful (old_loc->owner))
+ if (bl_address_is_meaningful (old_loc))
{
for (loc2p = locp;
(loc2p < bp_locations + bp_locations_count
around. We simply always ignore hardware watchpoint
traps we can no longer explain. */
- old_loc->events_till_retirement = 3 * (thread_count () + 1);
+ process_stratum_target *proc_target = nullptr;
+ for (inferior *inf : all_inferiors ())
+ if (inf->pspace == old_loc->pspace)
+ {
+ proc_target = inf->process_target ();
+ break;
+ }
+ if (proc_target != nullptr)
+ old_loc->events_till_retirement
+ = 3 * (thread_count (proc_target) + 1);
+ else
+ old_loc->events_till_retirement = 1;
old_loc->owner = NULL;
moribund_locations.push_back (old_loc);
b = loc->owner;
if (!unduplicated_should_be_inserted (loc)
- || !breakpoint_address_is_meaningful (b)
+ || !bl_address_is_meaningful (loc)
/* Don't detect duplicate for tracepoint locations because they are
never duplicated. See the comments in field `duplicate' of
`struct bp_location'. */
else
{
if (opts.addressprint || b->loc->symtab == NULL)
- {
- printf_filtered (" at ");
- fputs_styled (paddress (b->loc->gdbarch, b->loc->address),
- address_style.style (),
- gdb_stdout);
- }
+ printf_filtered (" at %ps",
+ styled_string (address_style.style (),
+ paddress (b->loc->gdbarch,
+ b->loc->address)));
if (b->loc->symtab != NULL)
{
/* If there is a single location, we can print the location
more nicely. */
if (b->loc->next == NULL)
{
- puts_filtered (": file ");
- fputs_styled (symtab_to_filename_for_display (b->loc->symtab),
- file_name_style.style (),
- gdb_stdout);
- printf_filtered (", line %d.",
+ const char *filename
+ = symtab_to_filename_for_display (b->loc->symtab);
+ printf_filtered (": file %ps, line %d.",
+ styled_string (file_name_style.style (),
+ filename),
b->loc->line_number);
}
else
{
xfree (this->cond_string);
xfree (this->extra_string);
- xfree (this->filter);
}
static struct bp_location *
annotate_breakpoint (b->number);
maybe_print_thread_hit_breakpoint (uiout);
- if (bp_temp)
- uiout->text ("Temporary breakpoint ");
- else
- uiout->text ("Breakpoint ");
if (uiout->is_mi_like_p ())
{
uiout->field_string ("reason",
async_reason_lookup (EXEC_ASYNC_BREAKPOINT_HIT));
uiout->field_string ("disp", bpdisp_text (b->disposition));
}
- uiout->field_int ("bkptno", b->number);
- uiout->text (", ");
+ if (bp_temp)
+ uiout->message ("Temporary breakpoint %pF, ",
+ signed_field ("bkptno", b->number));
+ else
+ uiout->message ("Breakpoint %pF, ",
+ signed_field ("bkptno", b->number));
return PRINT_SRC_AND_LOC;
}
{
gdb_assert (self->type == bp_static_tracepoint);
- uiout->text ("\tmarker id is ");
- uiout->field_string ("static-tracepoint-marker-string-id",
- tp->static_trace_marker_id);
- uiout->text ("\n");
+ uiout->message ("\tmarker id is %pF\n",
+ string_field ("static-tracepoint-marker-string-id",
+ tp->static_trace_marker_id.c_str ()));
}
}
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
uiout->text ("Now in ");
if (sym)
{
- uiout->field_string ("func", SYMBOL_PRINT_NAME (sym),
- ui_out_style_kind::FUNCTION);
+ uiout->field_string ("func", sym->print_name (),
+ function_name_style.style ());
uiout->text (" at ");
}
uiout->field_string ("file",
symtab_to_filename_for_display (sal2.symtab),
- ui_out_style_kind::FILE);
+ file_name_style.style ());
uiout->text (":");
if (uiout->is_mi_like_p ())
uiout->field_string ("fullname", fullname);
}
- uiout->field_int ("line", sal2.line);
+ uiout->field_signed ("line", sal2.line);
uiout->text ("\n");
b->loc->line_number = sal2.line;
decode_line_full (location, DECODE_LINE_FUNFIRSTLINE, search_pspace,
NULL, 0, &canonical, multiple_symbols_all,
- b->filter);
+ b->filter.get ());
/* We should get 0 or 1 resulting SALs. */
gdb_assert (canonical.lsals.size () < 2);
&& addr + len > loc->address)
{
wp->val = NULL;
- wp->val_valid = 0;
+ wp->val_valid = false;
}
}
}
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 (),
struct ui_out *uiout = current_uiout;
int num_printed;
- num_printed = breakpoint_1 (args, 0, is_tracepoint);
+ num_printed = breakpoint_1 (args, false, is_tracepoint);
if (num_printed == 0)
{
/* Save information on user settable breakpoints (watchpoints, etc) to
a new script file named FILENAME. If FILTER is non-NULL, call it
on each breakpoint and only include the ones for which it returns
- non-zero. */
+ true. */
static void
save_breakpoints (const char *filename, int from_tty,
- int (*filter) (const struct breakpoint *))
+ bool (*filter) (const struct breakpoint *))
{
struct breakpoint *tp;
int any = 0;
}
struct breakpoint *
-iterate_over_breakpoints (int (*callback) (struct breakpoint *, void *),
- void *data)
+iterate_over_breakpoints (gdb::function_view<bool (breakpoint *)> callback)
{
struct breakpoint *b, *b_tmp;
ALL_BREAKPOINTS_SAFE (b, b_tmp)
{
- if ((*callback) (b, data))
+ if (callback (b))
return b;
}
set_cmd_completer (c, location_completer);
add_prefix_cmd ("enable", class_breakpoint, enable_command, _("\
-Enable some breakpoints.\n\
+Enable all or some breakpoints.\n\
+Usage: enable [BREAKPOINTNUM]...\n\
Give breakpoint numbers (separated by spaces) as arguments.\n\
With no subcommand, breakpoints are enabled until you command otherwise.\n\
This is used to cancel the effect of the \"disable\" command.\n\
add_com_alias ("en", "enable", class_breakpoint, 1);
add_prefix_cmd ("breakpoints", class_breakpoint, enable_command, _("\
-Enable some breakpoints.\n\
+Enable all or some breakpoints.\n\
+Usage: enable breakpoints [BREAKPOINTNUM]...\n\
Give breakpoint numbers (separated by spaces) as arguments.\n\
This is used to cancel the effect of the \"disable\" command.\n\
May be abbreviated to simply \"enable\"."),
&enablebreaklist, "enable breakpoints ", 1, &enablelist);
add_cmd ("once", no_class, enable_once_command, _("\
-Enable breakpoints for one hit. Give breakpoint numbers.\n\
+Enable some breakpoints for one hit.\n\
+Usage: enable breakpoints once BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion, it becomes disabled."),
&enablebreaklist);
add_cmd ("delete", no_class, enable_delete_command, _("\
-Enable breakpoints and delete when hit. Give breakpoint numbers.\n\
+Enable some breakpoints and delete when hit.\n\
+Usage: enable breakpoints delete BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion, it is deleted."),
&enablebreaklist);
add_cmd ("count", no_class, enable_count_command, _("\
-Enable breakpoints for COUNT hits. Give count and then breakpoint numbers.\n\
+Enable some breakpoints for COUNT hits.\n\
+Usage: enable breakpoints count COUNT BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion,\n\
the count is decremented; when it reaches zero, the breakpoint is disabled."),
&enablebreaklist);
add_cmd ("delete", no_class, enable_delete_command, _("\
-Enable breakpoints and delete when hit. Give breakpoint numbers.\n\
+Enable some breakpoints and delete when hit.\n\
+Usage: enable delete BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion, it is deleted."),
&enablelist);
add_cmd ("once", no_class, enable_once_command, _("\
-Enable breakpoints for one hit. Give breakpoint numbers.\n\
+Enable some breakpoints for one hit.\n\
+Usage: enable once BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion, it becomes disabled."),
&enablelist);
add_cmd ("count", no_class, enable_count_command, _("\
-Enable breakpoints for COUNT hits. Give count and then breakpoint numbers.\n\
+Enable some breakpoints for COUNT hits.\n\
+Usage: enable count COUNT BREAKPOINTNUM...\n\
If a breakpoint is hit while enabled in this fashion,\n\
the count is decremented; when it reaches zero, the breakpoint is disabled."),
&enablelist);
add_prefix_cmd ("disable", class_breakpoint, disable_command, _("\
-Disable some breakpoints.\n\
+Disable all or some breakpoints.\n\
+Usage: disable [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
To disable all breakpoints, give no argument.\n\
A disabled breakpoint is not forgotten, but has no effect until re-enabled."),
add_com_alias ("disa", "disable", class_breakpoint, 1);
add_cmd ("breakpoints", class_alias, disable_command, _("\
-Disable some breakpoints.\n\
+Disable all or some breakpoints.\n\
+Usage: disable breakpoints [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
To disable all breakpoints, give no argument.\n\
A disabled breakpoint is not forgotten, but has no effect until re-enabled.\n\
&disablelist);
add_prefix_cmd ("delete", class_breakpoint, delete_command, _("\
-Delete some breakpoints or auto-display expressions.\n\
+Delete all or some breakpoints.\n\
+Usage: delete [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
To delete all breakpoints, give no argument.\n\
\n\
-Also a prefix command for deletion of other GDB objects.\n\
-The \"unset\" command is also an alias for \"delete\"."),
+Also a prefix command for deletion of other GDB objects."),
&deletelist, "delete ", 1, &cmdlist);
add_com_alias ("d", "delete", class_breakpoint, 1);
add_com_alias ("del", "delete", class_breakpoint, 1);
add_cmd ("breakpoints", class_alias, delete_command, _("\
-Delete some breakpoints or auto-display expressions.\n\
+Delete all or some breakpoints or auto-display expressions.\n\
+Usage: delete breakpoints [BREAKPOINTNUM]...\n\
Arguments are breakpoint numbers with spaces in between.\n\
To delete all breakpoints, give no argument.\n\
This command may be abbreviated \"delete\"."),
deprecate_cmd (c, "save tracepoints");
add_prefix_cmd ("breakpoint", class_maintenance, set_breakpoint_cmd, _("\
-Breakpoint specific settings\n\
+Breakpoint specific settings.\n\
Configure various breakpoint-specific variables such as\n\
-pending breakpoint behavior"),
+pending breakpoint behavior."),
&breakpoint_set_cmdlist, "set breakpoint ",
0/*allow-unknown*/, &setlist);
add_prefix_cmd ("breakpoint", class_maintenance, show_breakpoint_cmd, _("\
-Breakpoint specific settings\n\
+Breakpoint specific settings.\n\
Configure various breakpoint-specific variables such as\n\
-pending breakpoint behavior"),
+pending breakpoint behavior."),
&breakpoint_show_cmdlist, "show breakpoint ",
0/*allow-unknown*/, &showlist);
dprintf_function = xstrdup ("printf");
add_setshow_string_cmd ("dprintf-function", class_support,
&dprintf_function, _("\
-Set the function to use for dynamic printf"), _("\
-Show the function to use for dynamic printf"), NULL,
+Set the function to use for dynamic printf."), _("\
+Show the function to use for dynamic printf."), NULL,
update_dprintf_commands, NULL,
&setlist, &showlist);
dprintf_channel = xstrdup ("");
add_setshow_string_cmd ("dprintf-channel", class_support,
&dprintf_channel, _("\
-Set the channel to use for dynamic printf"), _("\
-Show the channel to use for dynamic printf"), NULL,
+Set the channel to use for dynamic printf."), _("\
+Show the channel to use for dynamic printf."), NULL,
update_dprintf_commands, NULL,
&setlist, &showlist);
&setlist, &showlist);
add_com ("agent-printf", class_vars, agent_printf_command, _("\
-agent-printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\
-(target agent only) This is useful for formatted output in user-defined commands."));
+Target agent only formatted printing, like the C \"printf\" function.\n\
+Usage: agent-printf \"format string\", ARG1, ARG2, ARG3, ..., ARGN\n\
+This supports most C printf format specifications, like %s, %d, etc.\n\
+This is useful for formatted output in user-defined commands."));
- automatic_hardware_breakpoints = 1;
+ automatic_hardware_breakpoints = true;
gdb::observers::about_to_proceed.attach (breakpoint_about_to_proceed);
gdb::observers::thread_exit.attach (remove_threaded_breakpoints);