mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 00:59:15 +08:00
Return bool from breakpoint_ops::print_one
This changes breakpoint_ops::print_one to return bool, and updates all the implementations and the caller. The caller is changed so that a NULL check is no longer needed -- something that will be impossible with a real method.
This commit is contained in:
@ -12380,7 +12380,7 @@ print_it_exception (bpstat *bs)
|
|||||||
/* Implement the PRINT_ONE method in the breakpoint_ops structure
|
/* Implement the PRINT_ONE method in the breakpoint_ops structure
|
||||||
for all exception catchpoint kinds. */
|
for all exception catchpoint kinds. */
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
print_one_exception (struct breakpoint *b, struct bp_location **last_loc)
|
print_one_exception (struct breakpoint *b, struct bp_location **last_loc)
|
||||||
{
|
{
|
||||||
struct ui_out *uiout = current_uiout;
|
struct ui_out *uiout = current_uiout;
|
||||||
@ -12431,6 +12431,8 @@ print_one_exception (struct breakpoint *b, struct bp_location **last_loc)
|
|||||||
internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
|
internal_error (__FILE__, __LINE__, _("unexpected catchpoint type"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement the PRINT_MENTION method in the breakpoint_ops structure
|
/* Implement the PRINT_MENTION method in the breakpoint_ops structure
|
||||||
|
@ -94,7 +94,7 @@ print_it_catch_exec (bpstat *bs)
|
|||||||
return PRINT_SRC_AND_LOC;
|
return PRINT_SRC_AND_LOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
print_one_catch_exec (struct breakpoint *b, struct bp_location **last_loc)
|
print_one_catch_exec (struct breakpoint *b, struct bp_location **last_loc)
|
||||||
{
|
{
|
||||||
struct exec_catchpoint *c = (struct exec_catchpoint *) b;
|
struct exec_catchpoint *c = (struct exec_catchpoint *) b;
|
||||||
@ -119,6 +119,8 @@ print_one_catch_exec (struct breakpoint *b, struct bp_location **last_loc)
|
|||||||
|
|
||||||
if (uiout->is_mi_like_p ())
|
if (uiout->is_mi_like_p ())
|
||||||
uiout->field_string ("catch-type", "exec");
|
uiout->field_string ("catch-type", "exec");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -127,7 +127,7 @@ print_it_catch_fork (bpstat *bs)
|
|||||||
/* Implement the "print_one" breakpoint_ops method for fork
|
/* Implement the "print_one" breakpoint_ops method for fork
|
||||||
catchpoints. */
|
catchpoints. */
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
|
print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
|
||||||
{
|
{
|
||||||
struct fork_catchpoint *c = (struct fork_catchpoint *) b;
|
struct fork_catchpoint *c = (struct fork_catchpoint *) b;
|
||||||
@ -153,6 +153,8 @@ print_one_catch_fork (struct breakpoint *b, struct bp_location **last_loc)
|
|||||||
|
|
||||||
if (uiout->is_mi_like_p ())
|
if (uiout->is_mi_like_p ())
|
||||||
uiout->field_string ("catch-type", name);
|
uiout->field_string ("catch-type", name);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement the "print_mention" breakpoint_ops method for fork
|
/* Implement the "print_mention" breakpoint_ops method for fork
|
||||||
|
@ -137,7 +137,7 @@ print_it_catch_solib (bpstat *bs)
|
|||||||
return PRINT_SRC_AND_LOC;
|
return PRINT_SRC_AND_LOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
|
print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
|
||||||
{
|
{
|
||||||
struct solib_catchpoint *self = (struct solib_catchpoint *) b;
|
struct solib_catchpoint *self = (struct solib_catchpoint *) b;
|
||||||
@ -176,6 +176,8 @@ print_one_catch_solib (struct breakpoint *b, struct bp_location **locs)
|
|||||||
|
|
||||||
if (uiout->is_mi_like_p ())
|
if (uiout->is_mi_like_p ())
|
||||||
uiout->field_string ("catch-type", self->is_load ? "load" : "unload");
|
uiout->field_string ("catch-type", self->is_load ? "load" : "unload");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -201,7 +201,7 @@ signal_catchpoint_print_it (bpstat *bs)
|
|||||||
/* Implement the "print_one" breakpoint_ops method for signal
|
/* Implement the "print_one" breakpoint_ops method for signal
|
||||||
catchpoints. */
|
catchpoints. */
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
signal_catchpoint_print_one (struct breakpoint *b,
|
signal_catchpoint_print_one (struct breakpoint *b,
|
||||||
struct bp_location **last_loc)
|
struct bp_location **last_loc)
|
||||||
{
|
{
|
||||||
@ -248,6 +248,8 @@ signal_catchpoint_print_one (struct breakpoint *b,
|
|||||||
|
|
||||||
if (uiout->is_mi_like_p ())
|
if (uiout->is_mi_like_p ())
|
||||||
uiout->field_string ("catch-type", "signal");
|
uiout->field_string ("catch-type", "signal");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement the "print_mention" breakpoint_ops method for signal
|
/* Implement the "print_mention" breakpoint_ops method for signal
|
||||||
|
@ -226,7 +226,7 @@ print_it_catch_syscall (bpstat *bs)
|
|||||||
/* Implement the "print_one" breakpoint_ops method for syscall
|
/* Implement the "print_one" breakpoint_ops method for syscall
|
||||||
catchpoints. */
|
catchpoints. */
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
print_one_catch_syscall (struct breakpoint *b,
|
print_one_catch_syscall (struct breakpoint *b,
|
||||||
struct bp_location **last_loc)
|
struct bp_location **last_loc)
|
||||||
{
|
{
|
||||||
@ -275,6 +275,8 @@ print_one_catch_syscall (struct breakpoint *b,
|
|||||||
|
|
||||||
if (uiout->is_mi_like_p ())
|
if (uiout->is_mi_like_p ())
|
||||||
uiout->field_string ("catch-type", "syscall");
|
uiout->field_string ("catch-type", "syscall");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement the "print_mention" breakpoint_ops method for syscall
|
/* Implement the "print_mention" breakpoint_ops method for syscall
|
||||||
|
@ -253,7 +253,7 @@ print_it_exception_catchpoint (bpstat *bs)
|
|||||||
return PRINT_SRC_AND_LOC;
|
return PRINT_SRC_AND_LOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
print_one_exception_catchpoint (struct breakpoint *b,
|
print_one_exception_catchpoint (struct breakpoint *b,
|
||||||
struct bp_location **last_loc)
|
struct bp_location **last_loc)
|
||||||
{
|
{
|
||||||
@ -287,6 +287,8 @@ print_one_exception_catchpoint (struct breakpoint *b,
|
|||||||
uiout->field_string ("catch-type", "catch");
|
uiout->field_string ("catch-type", "catch");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement the 'print_one_detail' method. */
|
/* Implement the 'print_one_detail' method. */
|
||||||
|
@ -6058,9 +6058,10 @@ output_thread_groups (struct ui_out *uiout,
|
|||||||
instead of going via breakpoint_ops::print_one. This makes "maint
|
instead of going via breakpoint_ops::print_one. This makes "maint
|
||||||
info breakpoints" show the software breakpoint locations of
|
info breakpoints" show the software breakpoint locations of
|
||||||
catchpoints, which are considered internal implementation
|
catchpoints, which are considered internal implementation
|
||||||
detail. */
|
detail. Returns true if RAW_LOC is false and if the breakpoint's
|
||||||
|
print_one method did something; false otherwise. */
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
print_one_breakpoint_location (struct breakpoint *b,
|
print_one_breakpoint_location (struct breakpoint *b,
|
||||||
struct bp_location *loc,
|
struct bp_location *loc,
|
||||||
int loc_number,
|
int loc_number,
|
||||||
@ -6124,8 +6125,9 @@ print_one_breakpoint_location (struct breakpoint *b,
|
|||||||
uiout->field_fmt ("enabled", "%c", bpenables[(int) b->enable_state]);
|
uiout->field_fmt ("enabled", "%c", bpenables[(int) b->enable_state]);
|
||||||
|
|
||||||
/* 5 and 6 */
|
/* 5 and 6 */
|
||||||
if (!raw_loc && b->ops != NULL && b->ops->print_one != NULL)
|
bool result = false;
|
||||||
b->ops->print_one (b, last_loc);
|
if (!raw_loc && b->ops != NULL && b->ops->print_one (b, last_loc))
|
||||||
|
result = true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (is_watchpoint (b))
|
if (is_watchpoint (b))
|
||||||
@ -6372,6 +6374,8 @@ print_one_breakpoint_location (struct breakpoint *b,
|
|||||||
uiout->field_string ("original-location",
|
uiout->field_string ("original-location",
|
||||||
event_location_to_string (b->location.get ()));
|
event_location_to_string (b->location.get ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See breakpoint.h. */
|
/* See breakpoint.h. */
|
||||||
@ -6389,7 +6393,8 @@ print_one_breakpoint (struct breakpoint *b,
|
|||||||
|| fix_multi_location_breakpoint_output_globally);
|
|| fix_multi_location_breakpoint_output_globally);
|
||||||
|
|
||||||
gdb::optional<ui_out_emit_tuple> bkpt_tuple_emitter (gdb::in_place, uiout, "bkpt");
|
gdb::optional<ui_out_emit_tuple> bkpt_tuple_emitter (gdb::in_place, uiout, "bkpt");
|
||||||
print_one_breakpoint_location (b, NULL, 0, last_loc, allflag, false);
|
bool printed = print_one_breakpoint_location (b, NULL, 0, last_loc,
|
||||||
|
allflag, false);
|
||||||
|
|
||||||
/* The mi2 broken format: the main breakpoint tuple ends here, the locations
|
/* The mi2 broken format: the main breakpoint tuple ends here, the locations
|
||||||
are outside. */
|
are outside. */
|
||||||
@ -6399,9 +6404,7 @@ print_one_breakpoint (struct breakpoint *b,
|
|||||||
/* If this breakpoint has custom print function,
|
/* If this breakpoint has custom print function,
|
||||||
it's already printed. Otherwise, print individual
|
it's already printed. Otherwise, print individual
|
||||||
locations, if any. */
|
locations, if any. */
|
||||||
if (b->ops == NULL
|
if (!printed || allflag)
|
||||||
|| b->ops->print_one == NULL
|
|
||||||
|| allflag)
|
|
||||||
{
|
{
|
||||||
/* If breakpoint has a single location that is disabled, we
|
/* If breakpoint has a single location that is disabled, we
|
||||||
print it as if it had several locations, since otherwise it's
|
print it as if it had several locations, since otherwise it's
|
||||||
@ -9174,7 +9177,7 @@ print_it_ranged_breakpoint (bpstat *bs)
|
|||||||
/* Implement the "print_one" breakpoint_ops method for
|
/* Implement the "print_one" breakpoint_ops method for
|
||||||
ranged breakpoints. */
|
ranged breakpoints. */
|
||||||
|
|
||||||
static void
|
static bool
|
||||||
print_one_ranged_breakpoint (struct breakpoint *b,
|
print_one_ranged_breakpoint (struct breakpoint *b,
|
||||||
struct bp_location **last_loc)
|
struct bp_location **last_loc)
|
||||||
{
|
{
|
||||||
@ -9194,6 +9197,8 @@ print_one_ranged_breakpoint (struct breakpoint *b,
|
|||||||
annotate_field (5);
|
annotate_field (5);
|
||||||
print_breakpoint_location (b, bl);
|
print_breakpoint_location (b, bl);
|
||||||
*last_loc = bl;
|
*last_loc = bl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Implement the "print_one_detail" breakpoint_ops method for
|
/* Implement the "print_one_detail" breakpoint_ops method for
|
||||||
@ -11549,6 +11554,12 @@ base_breakpoint_print_it (bpstat *bs)
|
|||||||
internal_error_pure_virtual_called ();
|
internal_error_pure_virtual_called ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
base_breakpoint_print_one (struct breakpoint *, struct bp_location **)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
base_breakpoint_print_one_detail (const struct breakpoint *self,
|
base_breakpoint_print_one_detail (const struct breakpoint *self,
|
||||||
struct ui_out *uiout)
|
struct ui_out *uiout)
|
||||||
@ -11628,7 +11639,7 @@ struct breakpoint_ops base_breakpoint_ops =
|
|||||||
base_breakpoint_resources_needed,
|
base_breakpoint_resources_needed,
|
||||||
base_breakpoint_works_in_software_mode,
|
base_breakpoint_works_in_software_mode,
|
||||||
base_breakpoint_print_it,
|
base_breakpoint_print_it,
|
||||||
NULL,
|
base_breakpoint_print_one,
|
||||||
base_breakpoint_print_one_detail,
|
base_breakpoint_print_one_detail,
|
||||||
base_breakpoint_print_mention,
|
base_breakpoint_print_mention,
|
||||||
base_breakpoint_print_recreate,
|
base_breakpoint_print_recreate,
|
||||||
|
@ -608,8 +608,9 @@ struct breakpoint_ops
|
|||||||
enum print_stop_action (*print_it) (struct bpstat *bs);
|
enum print_stop_action (*print_it) (struct bpstat *bs);
|
||||||
|
|
||||||
/* Display information about this breakpoint, for "info
|
/* Display information about this breakpoint, for "info
|
||||||
breakpoints". */
|
breakpoints". Returns false if this method should use the
|
||||||
void (*print_one) (struct breakpoint *, struct bp_location **);
|
default behavior. */
|
||||||
|
bool (*print_one) (struct breakpoint *, struct bp_location **);
|
||||||
|
|
||||||
/* Display extra information about this breakpoint, below the normal
|
/* Display extra information about this breakpoint, below the normal
|
||||||
breakpoint description in "info breakpoints".
|
breakpoint description in "info breakpoints".
|
||||||
|
Reference in New Issue
Block a user