mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-25 10:52:00 +08:00
gdb: use bool in the solib catchpoint area
Use bool instead of int in struct solib_catchpoint and in init_catchpoint & related functions. gdb/ChangeLog: * breakpoint.h (init_catchpoint): Change int parameter to bool. (add_solib_catchpoint): Likewise. * breakpoint.c (struct solib_catchpoint) <is_load>: Change type to bool. (add_solib_catchpoint): Change int parameter/variable to bool. (catch_load_or_unload): Likewise. (init_catchpoint): Likewise. (create_fork_vfork_event_catchpoint): Likewise. (catch_fork_command_1): Likewise. (catch_exec_command_1): Likewise. Change-Id: I1faf4506e9109f3ccdd7229ba766dc7d77aa7aa0
This commit is contained in:
@ -1,3 +1,16 @@
|
||||
2020-09-16 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* breakpoint.h (init_catchpoint): Change int parameter to bool.
|
||||
(add_solib_catchpoint): Likewise.
|
||||
* breakpoint.c (struct solib_catchpoint) <is_load>: Change type
|
||||
to bool.
|
||||
(add_solib_catchpoint): Change int parameter/variable to bool.
|
||||
(catch_load_or_unload): Likewise.
|
||||
(init_catchpoint): Likewise.
|
||||
(create_fork_vfork_event_catchpoint): Likewise.
|
||||
(catch_fork_command_1): Likewise.
|
||||
(catch_exec_command_1): Likewise.
|
||||
|
||||
2020-09-16 Simon Marchi <simon.marchi@efficios.com>
|
||||
|
||||
* gdb-gdb.py.in (class StructTypePrettyPrinter) <to_string>:
|
||||
|
@ -7867,7 +7867,7 @@ struct solib_catchpoint : public breakpoint
|
||||
~solib_catchpoint () override;
|
||||
|
||||
/* True for "catch load", false for "catch unload". */
|
||||
unsigned char is_load;
|
||||
bool is_load;
|
||||
|
||||
/* Regular expression to match, if any. COMPILED is only valid when
|
||||
REGEX is non-NULL. */
|
||||
@ -8039,15 +8039,10 @@ print_recreate_catch_solib (struct breakpoint *b, struct ui_file *fp)
|
||||
|
||||
static struct breakpoint_ops catch_solib_breakpoint_ops;
|
||||
|
||||
/* Shared helper function (MI and CLI) for creating and installing
|
||||
a shared object event catchpoint. If IS_LOAD is non-zero then
|
||||
the events to be caught are load events, otherwise they are
|
||||
unload events. If IS_TEMP is non-zero the catchpoint is a
|
||||
temporary one. If ENABLED is non-zero the catchpoint is
|
||||
created in an enabled state. */
|
||||
/* See breakpoint.h. */
|
||||
|
||||
void
|
||||
add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
|
||||
add_solib_catchpoint (const char *arg, bool is_load, bool is_temp, bool enabled)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_current_arch ();
|
||||
|
||||
@ -8080,12 +8075,10 @@ static void
|
||||
catch_load_or_unload (const char *arg, int from_tty, int is_load,
|
||||
struct cmd_list_element *command)
|
||||
{
|
||||
int tempflag;
|
||||
const int enabled = 1;
|
||||
bool temp = get_cmd_context (command) == CATCH_TEMPORARY;
|
||||
|
||||
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
|
||||
|
||||
add_solib_catchpoint (arg, is_load, tempflag, enabled);
|
||||
add_solib_catchpoint (arg, is_load, temp, enabled);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -8102,14 +8095,11 @@ catch_unload_command_1 (const char *arg, int from_tty,
|
||||
catch_load_or_unload (arg, from_tty, 0, command);
|
||||
}
|
||||
|
||||
/* Initialize a new breakpoint of the bp_catchpoint kind. If TEMPFLAG
|
||||
is non-zero, then make the breakpoint temporary. If COND_STRING is
|
||||
not NULL, then store it in the breakpoint. OPS, if not NULL, is
|
||||
the breakpoint_ops structure associated to the catchpoint. */
|
||||
/* See breakpoint.h. */
|
||||
|
||||
void
|
||||
init_catchpoint (struct breakpoint *b,
|
||||
struct gdbarch *gdbarch, int tempflag,
|
||||
struct gdbarch *gdbarch, bool temp,
|
||||
const char *cond_string,
|
||||
const struct breakpoint_ops *ops)
|
||||
{
|
||||
@ -8119,7 +8109,7 @@ init_catchpoint (struct breakpoint *b,
|
||||
init_raw_breakpoint (b, gdbarch, sal, bp_catchpoint, ops);
|
||||
|
||||
b->cond_string = (cond_string == NULL) ? NULL : xstrdup (cond_string);
|
||||
b->disposition = tempflag ? disp_del : disp_donttouch;
|
||||
b->disposition = temp ? disp_del : disp_donttouch;
|
||||
}
|
||||
|
||||
void
|
||||
@ -8139,12 +8129,12 @@ install_breakpoint (int internal, std::unique_ptr<breakpoint> &&arg, int update_
|
||||
|
||||
static void
|
||||
create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
|
||||
int tempflag, const char *cond_string,
|
||||
bool temp, const char *cond_string,
|
||||
const struct breakpoint_ops *ops)
|
||||
{
|
||||
std::unique_ptr<fork_catchpoint> c (new fork_catchpoint ());
|
||||
|
||||
init_catchpoint (c.get (), gdbarch, tempflag, cond_string, ops);
|
||||
init_catchpoint (c.get (), gdbarch, temp, cond_string, ops);
|
||||
|
||||
c->forked_inferior_pid = null_ptid;
|
||||
|
||||
@ -11148,11 +11138,10 @@ catch_fork_command_1 (const char *arg, int from_tty,
|
||||
struct gdbarch *gdbarch = get_current_arch ();
|
||||
const char *cond_string = NULL;
|
||||
catch_fork_kind fork_kind;
|
||||
int tempflag;
|
||||
|
||||
fork_kind = (catch_fork_kind) (uintptr_t) get_cmd_context (command);
|
||||
tempflag = (fork_kind == catch_fork_temporary
|
||||
|| fork_kind == catch_vfork_temporary);
|
||||
bool temp = (fork_kind == catch_fork_temporary
|
||||
|| fork_kind == catch_vfork_temporary);
|
||||
|
||||
if (!arg)
|
||||
arg = "";
|
||||
@ -11174,12 +11163,12 @@ catch_fork_command_1 (const char *arg, int from_tty,
|
||||
{
|
||||
case catch_fork_temporary:
|
||||
case catch_fork_permanent:
|
||||
create_fork_vfork_event_catchpoint (gdbarch, tempflag, cond_string,
|
||||
create_fork_vfork_event_catchpoint (gdbarch, temp, cond_string,
|
||||
&catch_fork_breakpoint_ops);
|
||||
break;
|
||||
case catch_vfork_temporary:
|
||||
case catch_vfork_permanent:
|
||||
create_fork_vfork_event_catchpoint (gdbarch, tempflag, cond_string,
|
||||
create_fork_vfork_event_catchpoint (gdbarch, temp, cond_string,
|
||||
&catch_vfork_breakpoint_ops);
|
||||
break;
|
||||
default:
|
||||
@ -11193,10 +11182,8 @@ catch_exec_command_1 (const char *arg, int from_tty,
|
||||
struct cmd_list_element *command)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_current_arch ();
|
||||
int tempflag;
|
||||
const char *cond_string = NULL;
|
||||
|
||||
tempflag = get_cmd_context (command) == CATCH_TEMPORARY;
|
||||
bool temp = get_cmd_context (command) == CATCH_TEMPORARY;
|
||||
|
||||
if (!arg)
|
||||
arg = "";
|
||||
@ -11213,7 +11200,7 @@ catch_exec_command_1 (const char *arg, int from_tty,
|
||||
error (_("Junk at end of arguments."));
|
||||
|
||||
std::unique_ptr<exec_catchpoint> c (new exec_catchpoint ());
|
||||
init_catchpoint (c.get (), gdbarch, tempflag, cond_string,
|
||||
init_catchpoint (c.get (), gdbarch, temp, cond_string,
|
||||
&catch_exec_breakpoint_ops);
|
||||
c->exec_pathname = NULL;
|
||||
|
||||
|
@ -1333,8 +1333,13 @@ extern void
|
||||
int enabled,
|
||||
int from_tty);
|
||||
|
||||
/* Initialize a new breakpoint of the bp_catchpoint kind. If TEMP
|
||||
is true, then make the breakpoint temporary. If COND_STRING is
|
||||
not NULL, then store it in the breakpoint. OPS, if not NULL, is
|
||||
the breakpoint_ops structure associated to the catchpoint. */
|
||||
|
||||
extern void init_catchpoint (struct breakpoint *b,
|
||||
struct gdbarch *gdbarch, int tempflag,
|
||||
struct gdbarch *gdbarch, bool temp,
|
||||
const char *cond_string,
|
||||
const struct breakpoint_ops *ops);
|
||||
|
||||
@ -1561,9 +1566,14 @@ extern void disable_breakpoints_in_shlibs (void);
|
||||
extern bool is_catchpoint (struct breakpoint *b);
|
||||
|
||||
/* Shared helper function (MI and CLI) for creating and installing
|
||||
a shared object event catchpoint. */
|
||||
extern void add_solib_catchpoint (const char *arg, int is_load, int is_temp,
|
||||
int enabled);
|
||||
a shared object event catchpoint. If IS_LOAD is true then
|
||||
the events to be caught are load events, otherwise they are
|
||||
unload events. If IS_TEMP is true the catchpoint is a
|
||||
temporary one. If ENABLED is true the catchpoint is
|
||||
created in an enabled state. */
|
||||
|
||||
extern void add_solib_catchpoint (const char *arg, bool is_load, bool is_temp,
|
||||
bool enabled);
|
||||
|
||||
/* Create and insert a new software single step breakpoint for the
|
||||
current thread. May be called multiple times; each time will add a
|
||||
|
Reference in New Issue
Block a user