From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 35FEF3850201; Thu, 20 Oct 2022 15:45:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35FEF3850201 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666280758; bh=sU/7i1NoriW3laUj8rGY3TbhqlLJjmppoft39g6KbdI=; h=From:To:Subject:Date:From; b=aLqqJ7pUvF4lWiXk0FikdzxHSbUCHwYDoMuKmeRBYPwzPXj/ZHg61Phu5S3M4dPAp OAXA20pT1A3QI3idEN3Lgt+4tx+xkhRvCfh9VEhUuuBhdlvVA5LlVA1LxlMjimqrDT o+Yhgq46zpeKr5U+lWi/KxiksZAyQPIsGJ5Qleuw= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: some int to bool conversion in breakpoint.c X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: aaa141a0a99fb63f6209da75257c58d94404a963 X-Git-Newrev: d8de7963a9d64d82e745e402f7f264fc53f4f2a7 Message-Id: <20221020154558.35FEF3850201@sourceware.org> Date: Thu, 20 Oct 2022 15:45:57 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd8de7963a9d6= 4d82e745e402f7f264fc53f4f2a7 commit d8de7963a9d64d82e745e402f7f264fc53f4f2a7 Author: Andrew Burgess Date: Tue Oct 4 14:13:53 2022 +0100 gdb: some int to bool conversion in breakpoint.c =20 Some int to bool conversion in breakpoint.c. I've only updated the function signatures of static functions, but I've updated some function local variables throughout the file. =20 There should be no user visible changes after this commit. =20 Approved-By: Simon Marchi Diff: --- gdb/breakpoint.c | 276 +++++++++++++++++++++++++++------------------------= ---- 1 file changed, 135 insertions(+), 141 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index bfa017f1398..a0653f189b9 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -114,27 +114,27 @@ static struct breakpoint * enum bptype type, int loc_enabled, int thread); =20 -static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int); +static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, bool= ); =20 static CORE_ADDR adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr, enum bptype bptype, struct program_space *pspace); =20 -static int watchpoint_locations_match (const struct bp_location *loc1, - const struct bp_location *loc2); +static bool watchpoint_locations_match (const struct bp_location *loc1, + const struct bp_location *loc2); =20 -static int breakpoint_locations_match (const struct bp_location *loc1, - const struct bp_location *loc2, - bool sw_hw_bps_match =3D false); +static bool breakpoint_locations_match (const struct bp_location *loc1, + const struct bp_location *loc2, + bool sw_hw_bps_match =3D false); =20 -static int breakpoint_location_address_match (struct bp_location *bl, - const struct address_space *aspace, - CORE_ADDR addr); +static bool breakpoint_location_address_match (struct bp_location *bl, + const struct address_space *aspace, + CORE_ADDR addr); =20 -static int breakpoint_location_address_range_overlap (struct bp_location *, - const address_space *, - CORE_ADDR, int); +static bool breakpoint_location_address_range_overlap (struct bp_location = *, + const address_space *, + CORE_ADDR, int); =20 static int remove_breakpoint (struct bp_location *); static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reaso= n); @@ -210,10 +210,10 @@ static void set_tracepoint_count (int num); =20 static bool is_masked_watchpoint (const struct breakpoint *b); =20 -/* Return 1 if B refers to a static tracepoint set by marker ("-m"), zero - otherwise. */ +/* Return true if B refers to a static tracepoint set by marker ("-m"), + zero otherwise. */ =20 -static int strace_marker_p (struct breakpoint *b); +static bool strace_marker_p (struct breakpoint *b); =20 static void bkpt_probe_create_sals_from_location_spec (location_spec *locspec, @@ -593,7 +593,7 @@ breakpoint_condition_evaluation_mode (void) /* Return true if GDB should evaluate breakpoint conditions or false otherwise. */ =20 -static int +static bool gdb_evaluates_breakpoint_condition_p (void) { const char *mode =3D breakpoint_condition_evaluation_mode (); @@ -758,7 +758,7 @@ static struct cmd_list_element *breakpoint_show_cmdlist; struct cmd_list_element *save_cmdlist; =20 /* Return whether a breakpoint is an active enabled breakpoint. */ -static int +static bool breakpoint_enabled (struct breakpoint *b) { return (b->enable_state =3D=3D bp_enabled); @@ -1556,19 +1556,19 @@ commands_from_control_command (const char *arg, str= uct command_line *cmd) return simple_control; } =20 -/* Return non-zero if BL->TARGET_INFO contains valid information. */ +/* Return true if BL->TARGET_INFO contains valid information. */ =20 -static int +static bool bp_location_has_shadow (struct bp_location *bl) { if (bl->loc_type !=3D bp_loc_software_breakpoint) - return 0; + return false; if (!bl->inserted) - return 0; + return false; if (bl->target_info.shadow_len =3D=3D 0) /* BL isn't valid, or doesn't shadow memory. */ - return 0; - return 1; + return false; + return true; } =20 /* Update BUF, which is LEN bytes read from the target address @@ -1806,7 +1806,7 @@ is_watchpoint (const struct breakpoint *bpt) and in any state. It is presently left to the target allowing memory accesses when threads are running. */ =20 -static int +static bool watchpoint_in_thread_scope (struct watchpoint *b) { return (b->pspace =3D=3D current_program_space @@ -1870,7 +1870,7 @@ add_dummy_location (struct breakpoint *b, } =20 /* Assuming that B is a watchpoint: - - Reparse watchpoint expression, if REPARSE is non-zero + - Reparse watchpoint expression, if REPARSE is true - Evaluate expression and store the result in B->val - Evaluate the condition if there is one, and store the result in b->loc->cond. @@ -1922,7 +1922,7 @@ add_dummy_location (struct breakpoint *b, watchpoint removal from inferior. */ =20 static void -update_watchpoint (struct watchpoint *b, int reparse) +update_watchpoint (struct watchpoint *b, bool reparse) { bool within_current_scope; =20 @@ -2226,27 +2226,27 @@ in which its expression is valid.\n"), } } =20 - -/* Returns 1 iff breakpoint location should be +/* Returns true iff breakpoint location should be inserted in the inferior. We don't differentiate the type of BL's owner (breakpoint vs. tracepoint), although insert_location in tracepoint's breakpoint_ops is not defined, because in insert_bp_location, tracepoint's insert_location will not be called. */ -static int + +static bool should_be_inserted (struct bp_location *bl) { if (bl->owner =3D=3D NULL || !breakpoint_enabled (bl->owner)) - return 0; + return false; =20 if (bl->owner->disposition =3D=3D disp_del_at_next_stop) - return 0; + return false; =20 if (!bl->enabled || bl->disabled_by_cond || bl->shlib_disabled || bl->duplicate) - return 0; + return false; =20 if (user_breakpoint_p (bl->owner) && bl->pspace->executing_startup) - return 0; + return false; =20 /* This is set for example, when we're attached to the parent of a vfork, and have detached from the child. The child is running @@ -2257,7 +2257,7 @@ should_be_inserted (struct bp_location *bl) the child could still trip on the parent's breakpoints. Since the parent is blocked anyway, it won't miss any breakpoint. */ if (bl->pspace->breakpoints_not_allowed) - return 0; + return false; =20 /* Don't insert a breakpoint if we're trying to step past its location, except if the breakpoint is a single-step breakpoint, @@ -2279,7 +2279,7 @@ should_be_inserted (struct bp_location *bl) { infrun_debug_printf ("skipping breakpoint: stepping past insn at: %s= ", paddress (bl->gdbarch, bl->address)); - return 0; + return false; } =20 /* Don't insert watchpoints if we're trying to step past the @@ -2290,10 +2290,10 @@ should_be_inserted (struct bp_location *bl) infrun_debug_printf ("stepping past non-steppable watchpoint. " "skipping watchpoint at %s:%d", paddress (bl->gdbarch, bl->address), bl->length); - return 0; + return false; } =20 - return 1; + return true; } =20 /* Same as should_be_inserted but does the check assuming @@ -2348,7 +2348,7 @@ parse_cond_to_aexpr (CORE_ADDR scope, struct expressi= on *cond) static void build_target_condition_list (struct bp_location *bl) { - int null_condition_or_parse_error =3D 0; + bool null_condition_or_parse_error =3D false; int modified =3D bl->needs_update; =20 /* Release conditions left over from a previous insert. */ @@ -2391,7 +2391,7 @@ build_target_condition_list (struct bp_location *bl) went wrong or we have a null condition expression. */ if (!loc->cond_bytecode) { - null_condition_or_parse_error =3D 1; + null_condition_or_parse_error =3D true; break; } } @@ -2525,7 +2525,7 @@ parse_cmd_to_aexpr (CORE_ADDR scope, char *cmd) static void build_target_command_list (struct bp_location *bl) { - int null_command_or_parse_error =3D 0; + bool null_command_or_parse_error =3D false; int modified =3D bl->needs_update; =20 /* Clear commands left over from a previous insert. */ @@ -2574,7 +2574,7 @@ build_target_command_list (struct bp_location *bl) went wrong or we have a null command expression. */ if (!loc->cmd_bytecode) { - null_command_or_parse_error =3D 1; + null_command_or_parse_error =3D true; break; } } @@ -3019,7 +3019,7 @@ insert_breakpoints (void) { struct watchpoint *w =3D (struct watchpoint *) bpt; =20 - update_watchpoint (w, 0 /* don't reparse. */); + update_watchpoint (w, false /* don't reparse. */); } =20 /* Updating watchpoints creates new locations, so update the global @@ -3140,7 +3140,7 @@ insert_breakpoint_locations (void) them, as half-inserted watchpoint is of limited use. */ for (breakpoint *bpt : all_breakpoints ()) { - int some_failed =3D 0; + bool some_failed =3D false; =20 if (!is_hardware_watchpoint (bpt)) continue; @@ -3154,7 +3154,7 @@ insert_breakpoint_locations (void) for (bp_location *loc : bpt->locations ()) if (!loc->inserted && should_be_inserted (loc)) { - some_failed =3D 1; + some_failed =3D true; break; } =20 @@ -3321,7 +3321,7 @@ static struct minimal_symbol msym_not_found; =20 /* Returns TRUE if MSYM point to the "not found" sentinel. */ =20 -static int +static bool msym_not_found_p (const struct minimal_symbol *msym) { return msym =3D=3D &msym_not_found; @@ -3683,7 +3683,7 @@ create_exception_master_breakpoint (void) =20 /* Does B have a location spec? */ =20 -static int +static bool breakpoint_location_spec_empty_p (const struct breakpoint *b) { return (b->locspec !=3D nullptr && b->locspec->empty_p ()); @@ -4142,7 +4142,7 @@ breakpoint_init_inferior (enum inf_context context) enum breakpoint_here breakpoint_here_p (const address_space *aspace, CORE_ADDR pc) { - int any_breakpoint_here =3D 0; + bool any_breakpoint_here =3D false; =20 for (bp_location *bl : all_bp_locations ()) { @@ -4162,7 +4162,7 @@ breakpoint_here_p (const address_space *aspace, CORE_= ADDR pc) else if (bl->permanent) return permanent_breakpoint_here; else - any_breakpoint_here =3D 1; + any_breakpoint_here =3D true; } } =20 @@ -4213,10 +4213,9 @@ moribund_breakpoint_here_p (const address_space *asp= ace, CORE_ADDR pc) return 0; } =20 -/* Returns non-zero iff BL is inserted at PC, in address space - ASPACE. */ +/* Returns true iff BL is inserted at PC, in address space ASPACE. */ =20 -static int +static bool bp_location_inserted_here_p (const struct bp_location *bl, const address_space *aspace, CORE_ADDR pc) { @@ -4224,14 +4223,12 @@ bp_location_inserted_here_p (const struct bp_locati= on *bl, && breakpoint_address_match (bl->pspace->aspace, bl->address, aspace, pc)) { - if (overlay_debugging - && section_is_overlay (bl->section) - && !section_is_mapped (bl->section)) - return 0; /* unmapped overlay -- can't be a match */ - else - return 1; + /* An unmapped overlay can't be a match. */ + return !(overlay_debugging + && section_is_overlay (bl->section) + && !section_is_mapped (bl->section)); } - return 0; + return false; } =20 /* Returns non-zero iff there's a breakpoint inserted at PC. */ @@ -4494,10 +4491,10 @@ breakpoint_about_to_proceed (void) breakpoint_proceeded =3D 1; } =20 -/* Return non-zero iff CMD as the first line of a command sequence is `sil= ent' +/* Return true iff CMD as the first line of a command sequence is `silent' or its equivalent. */ =20 -static int +static bool command_line_is_silent (struct command_line *cmd) { return cmd && (strcmp ("silent", cmd->line) =3D=3D 0); @@ -4512,16 +4509,16 @@ command_line_is_silent (struct command_line *cmd) case, it is the caller's responsibility to recall it again with the bpstat of the current thread. */ =20 -static int +static bool bpstat_do_actions_1 (bpstat **bsp) { bpstat *bs; - int again =3D 0; + bool again =3D false; =20 /* Avoid endless recursion if a `source' command is contained in bs->commands. */ if (executing_breakpoint_commands) - return 0; + return false; =20 scoped_restore save_executing =3D make_scoped_restore (&executing_breakpoint_commands, 1); @@ -4587,7 +4584,7 @@ bpstat_do_actions_1 (bpstat **bsp) command, and can easily blow up GDB stack. Instead, we return true, which will trigger the caller to recall us with the new stop_bpstat. */ - again =3D 1; + again =3D true; break; } } @@ -4958,7 +4955,7 @@ watchpoint_check (bpstat *bs) { struct watchpoint *b; frame_info_ptr fr; - int within_current_scope; + bool within_current_scope; =20 /* BS is built from an existing struct breakpoint. */ gdb_assert (bs->breakpoint_at !=3D NULL); @@ -4971,7 +4968,7 @@ watchpoint_check (bpstat *bs) return WP_IGNORE; =20 if (b->exp_valid_block =3D=3D NULL) - within_current_scope =3D 1; + within_current_scope =3D true; else { frame_info_ptr frame =3D get_current_frame (); @@ -5002,7 +4999,7 @@ watchpoint_check (bpstat *bs) function =3D get_frame_function (fr); if (function =3D=3D NULL || !contained_in (b->exp_valid_block, function->value_block ())) - within_current_scope =3D 0; + within_current_scope =3D false; } =20 if (within_current_scope) @@ -5098,7 +5095,7 @@ watchpoint_check (bpstat *bs) breakpoint location BL. This function does not check if we should stop, only if BL explains the stop. */ =20 -static int +static bool bpstat_check_location (const struct bp_location *bl, const address_space *aspace, CORE_ADDR bp_addr, const target_waitstatus &ws) @@ -5127,24 +5124,24 @@ bpstat_check_watchpoint (bpstat *bs) gdb_assert (b !=3D NULL); =20 { - int must_check_value =3D 0; - =20 + bool must_check_value =3D false; + if (b->type =3D=3D bp_watchpoint) /* For a software watchpoint, we must always check the watched value. */ - must_check_value =3D 1; + must_check_value =3D true; else if (b->watchpoint_triggered =3D=3D watch_triggered_yes) /* We have a hardware watchpoint (read, write, or access) and the target earlier reported an address watched by this watchpoint. */ - must_check_value =3D 1; + must_check_value =3D true; else if (b->watchpoint_triggered =3D=3D watch_triggered_unknown && b->type =3D=3D bp_hardware_watchpoint) /* We were stopped by a hardware watchpoint, but the target could not report the data address. We must check the watchpoint's value. Access and read watchpoints are out of luck; without a data address, we can't figure it out. */ - must_check_value =3D 1; + must_check_value =3D true; =20 if (must_check_value) { @@ -5266,7 +5263,7 @@ bpstat_check_watchpoint (bpstat *bs) break; } } - else /* must_check_value =3D=3D 0 */ + else /* !must_check_value */ { /* This is a case where some watchpoint(s) triggered, but not at the address of this watchpoint, or else no @@ -5346,7 +5343,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, threa= d_info *thread) =20 if (cond !=3D nullptr && b->disposition !=3D disp_del_at_next_stop) { - int within_current_scope =3D 1; + bool within_current_scope =3D true; struct watchpoint * w; =20 /* We use scoped_value_mark because it could be a long time @@ -5390,7 +5387,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, threa= d_info *thread) if (frame !=3D NULL) select_frame (frame); else - within_current_scope =3D 0; + within_current_scope =3D false; } if (within_current_scope) { @@ -5441,7 +5438,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, threa= d_info *thread) /* Returns true if we need to track moribund locations of LOC's type on the current target. */ =20 -static int +static bool need_moribund_for_location_type (const struct bp_location *loc) { return ((loc->loc_type =3D=3D bp_loc_software_breakpoint @@ -5623,7 +5620,7 @@ bpstat_stop_status (const address_space *aspace, { struct watchpoint *w =3D (struct watchpoint *) bs->breakpoint_at; =20 - update_watchpoint (w, 0 /* don't reparse. */); + update_watchpoint (w, false /* don't reparse. */); need_remove_insert =3D 1; } =20 @@ -6184,8 +6181,8 @@ print_one_breakpoint_location (struct breakpoint *b, static char bpenables[] =3D "nynny"; =20 struct ui_out *uiout =3D current_uiout; - int header_of_multiple =3D 0; - int part_of_multiple =3D (loc !=3D NULL); + bool header_of_multiple =3D false; + bool part_of_multiple =3D (loc !=3D NULL); struct value_print_options opts; =20 get_user_print_options (&opts); @@ -6197,7 +6194,7 @@ print_one_breakpoint_location (struct breakpoint *b, && (b->loc !=3D NULL=20 && (b->loc->next !=3D NULL || !b->loc->enabled || b->loc->disabled_by_cond))) - header_of_multiple =3D 1; + header_of_multiple =3D true; if (loc =3D=3D NULL) loc =3D b->loc; =20 @@ -6856,7 +6853,7 @@ maintenance_info_breakpoints (const char *args, int f= rom_tty) default_collect_info (); } =20 -static int +static bool breakpoint_has_pc (struct breakpoint *b, struct program_space *pspace, CORE_ADDR pc, struct obj_section *section) @@ -6866,9 +6863,9 @@ breakpoint_has_pc (struct breakpoint *b, if (bl->pspace =3D=3D pspace && bl->address =3D=3D pc && (!overlay_debugging || bl->section =3D=3D section)) - return 1; =20 + return true; } - return 0; + return false; } =20 /* See breakpoint.h. */ @@ -6934,7 +6931,7 @@ bl_address_is_meaningful (bp_location *loc) /* Assuming LOC1 and LOC2's owners are hardware watchpoints, returns true if LOC1 and LOC2 represent the same watchpoint location. */ =20 -static int +static bool watchpoint_locations_match (const struct bp_location *loc1, const struct bp_location *loc2) { @@ -6961,7 +6958,7 @@ watchpoint_locations_match (const struct bp_location = *loc1, loc2->length, loc2->watchpoint_type, w2->cond_exp.get ()))) - return 0; + return false; =20 /* Note that this checks the owner's type, not the location's. In case the target does not support read watchpoints, but does @@ -6991,7 +6988,7 @@ breakpoint_address_match (const address_space *aspace= 1, CORE_ADDR addr1, matches ASPACE2. On targets that have global breakpoints, the address space doesn't really matter. */ =20 -static int +static bool breakpoint_address_match_range (const address_space *aspace1, CORE_ADDR addr1, int len1, const address_space *aspace2, @@ -7007,7 +7004,7 @@ breakpoint_address_match_range (const address_space *= aspace1, matches the breakpoint's address space. On targets that have global breakpoints, the address space doesn't really matter. */ =20 -static int +static bool breakpoint_location_address_match (struct bp_location *bl, const address_space *aspace, CORE_ADDR addr) @@ -7026,7 +7023,7 @@ breakpoint_location_address_match (struct bp_location= *bl, space. On targets that have global breakpoints, the address space doesn't really matter. */ =20 -static int +static bool breakpoint_location_address_range_overlap (struct bp_location *bl, const address_space *aspace, CORE_ADDR addr, int len) @@ -7046,7 +7043,7 @@ breakpoint_location_address_range_overlap (struct bp_= location *bl, Then, if LOC1 and LOC2 represent the same tracepoint location, returns true, otherwise returns false. */ =20 -static int +static bool tracepoint_locations_match (const struct bp_location *loc1, const struct bp_location *loc2) { @@ -7056,7 +7053,7 @@ tracepoint_locations_match (const struct bp_location = *loc1, different locations. */ return (loc1->address =3D=3D loc2->address && loc1->owner =3D=3D loc2-= >owner); else - return 0; + return false; } =20 /* Assuming LOC1 and LOC2's types' have meaningful target addresses @@ -7065,7 +7062,7 @@ tracepoint_locations_match (const struct bp_location = *loc1, breakpoint locations and hardware breakpoint locations match, otherwise they don't. */ =20 -static int +static bool breakpoint_locations_match (const struct bp_location *loc1, const struct bp_location *loc2, bool sw_hw_bps_match) @@ -7080,7 +7077,7 @@ breakpoint_locations_match (const struct bp_location = *loc1, hw_point2 =3D is_hardware_watchpoint (loc2->owner); =20 if (hw_point1 !=3D hw_point2) - return 0; + return false; else if (hw_point1) return watchpoint_locations_match (loc1, loc2); else if (is_tracepoint (loc1->owner) || is_tracepoint (loc2->owner)) @@ -7097,7 +7094,7 @@ breakpoint_locations_match (const struct bp_location = *loc1, =20 static void breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr, - int bnum, int have_bnum) + int bnum, bool have_bnum) { /* The longest string possibly returned by hex_string_custom is 50 chars. These must be at least that big for safety. */ @@ -7169,7 +7166,7 @@ adjust_breakpoint_address (struct gdbarch *gdbarch, a user's expectations. Print a warning if an adjustment is required. */ if (adjusted_bpaddr !=3D bpaddr) - breakpoint_adjustment_warning (bpaddr, adjusted_bpaddr, 0, 0); + breakpoint_adjustment_warning (bpaddr, adjusted_bpaddr, 0, false); =20 return adjusted_bpaddr; } @@ -7679,7 +7676,7 @@ disable_breakpoints_in_shlibs (void) static void disable_breakpoints_in_unloaded_shlib (struct so_list *solib) { - int disabled_shlib_breaks =3D 0; + bool disabled_shlib_breaks =3D false; =20 for (bp_location *loc : all_bp_locations ()) { @@ -7712,7 +7709,7 @@ disable_breakpoints_in_unloaded_shlib (struct so_list= *solib) "for unloaded shared library \"%s\""), solib->so_name); } - disabled_shlib_breaks =3D 1; + disabled_shlib_breaks =3D true; } } } @@ -7744,7 +7741,7 @@ disable_breakpoints_in_freed_objfile (struct objfile = *objfile) =20 for (breakpoint *b : all_breakpoints ()) { - int bp_modified =3D 0; + bool bp_modified =3D false; =20 if (!is_breakpoint (b) && !is_tracepoint (b)) continue; @@ -7778,7 +7775,7 @@ disable_breakpoints_in_freed_objfile (struct objfile = *objfile) =20 mark_breakpoint_location_modified (loc); =20 - bp_modified =3D 1; + bp_modified =3D true; } } =20 @@ -8813,7 +8810,7 @@ create_breakpoint (struct gdbarch *gdbarch, unsigned flags) { struct linespec_result canonical; - int pending =3D 0; + bool pending =3D false; int task =3D 0; int prev_bkpt_count =3D breakpoint_count; =20 @@ -8852,7 +8849,7 @@ create_breakpoint (struct gdbarch *gdbarch, a pending breakpoint and selected yes, or pending breakpoint behavior is on and thus a pending breakpoint is defaulted on behalf of the user. */ - pending =3D 1; + pending =3D true; } else throw; @@ -9446,7 +9443,7 @@ watchpoint::re_set () =20 Don't do anything about disabled watchpoints, since they will be reevaluated again when enabled. */ - update_watchpoint (this, 1 /* reparse */); + update_watchpoint (this, true /* reparse */); } =20 /* Implement the "insert" method for hardware watchpoints. */ @@ -10183,7 +10180,7 @@ watch_command_1 (const char *arg, int accessflag, i= nt from_tty, =20 /* Finally update the new watchpoint. This creates the locations that should be inserted. */ - update_watchpoint (w.get (), 1); + update_watchpoint (w.get (), true /* reparse */); =20 install_breakpoint (internal, std::move (w), 1); } @@ -10834,7 +10831,7 @@ download_tracepoint_locations (void) for (breakpoint *b : all_tracepoints ()) { struct tracepoint *t; - int bp_location_downloaded =3D 0; + bool bp_location_downloaded =3D false; =20 if ((b->type =3D=3D bp_fast_tracepoint ? !may_insert_fast_tracepoints @@ -10865,7 +10862,7 @@ download_tracepoint_locations (void) target_download_tracepoint (bl); =20 bl->inserted =3D 1; - bp_location_downloaded =3D 1; + bp_location_downloaded =3D true; } t =3D (struct tracepoint *) b; t->number_on_target =3D b->number; @@ -11009,10 +11006,10 @@ update_global_location_list (enum ugll_insert_mod= e insert_mode) { /* Tells if 'old_loc' is found among the new locations. If not, we have to free it. */ - int found_object =3D 0; + bool found_object =3D false; /* Tells if the location should remain inserted in the target. */ - int keep_in_target =3D 0; - int removed =3D 0; + bool keep_in_target =3D false; + bool removed =3D false; =20 /* Skip LOCP entries which will definitely never be needed. Stop either at or being the one matching OLD_LOC. */ @@ -11038,7 +11035,7 @@ update_global_location_list (enum ugll_insert_mode = insert_mode) } =20 if (bp_locations[loc2_i] =3D=3D old_loc) - found_object =3D 1; + found_object =3D true; } =20 /* We have already handled this address, update it so that we don't @@ -11064,7 +11061,7 @@ update_global_location_list (enum ugll_insert_mode = insert_mode) { /* The location is still present in the location list, and still should be inserted. Don't do anything. */ - keep_in_target =3D 1; + keep_in_target =3D true; } else { @@ -11107,7 +11104,7 @@ update_global_location_list (enum ugll_insert_mode = insert_mode) if (unduplicated_should_be_inserted (loc2)) { swap_insertion (old_loc, loc2); - keep_in_target =3D 1; + keep_in_target =3D true; break; } } @@ -11131,7 +11128,7 @@ update_global_location_list (enum ugll_insert_mode = insert_mode) "breakpoint %d\n"),=20 old_loc->owner->number); } - removed =3D 1; + removed =3D true; } } =20 @@ -11605,7 +11602,7 @@ ordinary_breakpoint::print_it (const bpstat *bs) co= nst if (bl->address !=3D bl->requested_address) breakpoint_adjustment_warning (bl->requested_address, bl->address, - number, 1); + number, true); annotate_breakpoint (number); maybe_print_thread_hit_breakpoint (uiout); =20 @@ -12098,7 +12095,7 @@ static struct breakpoint_ops strace_marker_breakpoi= nt_ops =3D strace_marker_create_breakpoints_sal, }; =20 -static int +static bool strace_marker_p (struct breakpoint *b) { return b->type =3D=3D bp_static_marker_tracepoint; @@ -12270,7 +12267,7 @@ delete_command (const char *arg, int from_tty) PSPACE is NULL, all locations of all program spaces are considered. */ =20 -static int +static bool all_locations_are_pending (struct breakpoint *b, struct program_space *psp= ace) { for (bp_location *loc : b->locations ()) @@ -12278,15 +12275,15 @@ all_locations_are_pending (struct breakpoint *b, = struct program_space *pspace) || loc->pspace =3D=3D pspace) && !loc->shlib_disabled && !loc->pspace->executing_startup) - return 0; - return 1; + return false; + return true; } =20 /* Subroutine of update_breakpoint_locations to simplify it. - Return non-zero if multiple fns in list LOC have the same name. + Return true if multiple fns in list LOC have the same name. Null names are ignored. */ =20 -static int +static bool ambiguous_names_p (struct bp_location *loc) { struct bp_location *l; @@ -12307,11 +12304,11 @@ ambiguous_names_p (struct bp_location *loc) /* NOTE: We can assume slot !=3D NULL here because xcalloc never returns NULL. */ if (*slot !=3D NULL) - return 1; + return true; *slot =3D name; } =20 - return 0; + return false; } =20 /* When symbols change, it probably means the sources changed as well, @@ -12438,34 +12435,34 @@ update_static_tracepoint (struct breakpoint *b, s= truct symtab_and_line sal) return sal; } =20 -/* Returns 1 iff locations A and B are sufficiently same that +/* Returns true iff locations A and B are sufficiently same that we don't need to report breakpoint as changed. */ =20 -static int +static bool locations_are_equal (struct bp_location *a, struct bp_location *b) { while (a && b) { if (a->address !=3D b->address) - return 0; + return false; =20 if (a->shlib_disabled !=3D b->shlib_disabled) - return 0; + return false; =20 if (a->enabled !=3D b->enabled) - return 0; + return false; =20 if (a->disabled_by_cond !=3D b->disabled_by_cond) - return 0; + return false; =20 a =3D a->next; b =3D b->next; } =20 if ((a =3D=3D NULL) !=3D (b =3D=3D NULL)) - return 0; + return false; =20 - return 1; + return true; } =20 /* Split all locations of B that are bound to PSPACE out of B's @@ -12650,7 +12647,7 @@ code_breakpoint::location_spec_to_sals (location_sp= ec *locspec, } catch (gdb_exception_error &e) { - int not_found_and_ok =3D 0; + int not_found_and_ok =3D false; =20 /* For pending breakpoints, it's expected that parsing will fail until the right shared library is loaded. User has @@ -12667,7 +12664,7 @@ code_breakpoint::location_spec_to_sals (location_sp= ec *locspec, || (loc && loc->shlib_disabled) || (loc && loc->pspace->executing_startup) || enable_state =3D=3D bp_disabled)) - not_found_and_ok =3D 1; + not_found_and_ok =3D true; =20 if (!not_found_and_ok) { @@ -13327,7 +13324,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enu= m bpdisp disposition, =20 orig_enable_state =3D bpt->enable_state; bpt->enable_state =3D bp_enabled; - update_watchpoint (w, 1 /* reparse */); + update_watchpoint (w, true /* reparse */); } catch (const gdb_exception &e) { @@ -13969,7 +13966,7 @@ static void save_breakpoints (const char *filename, int from_tty, bool (*filter) (const struct breakpoint *)) { - int any =3D 0; + bool any =3D false; int extra_trace_bits =3D 0; =20 if (filename =3D=3D 0 || *filename =3D=3D 0) @@ -13986,7 +13983,7 @@ save_breakpoints (const char *filename, int from_tt= y, if (filter && !filter (tp)) continue; =20 - any =3D 1; + any =3D true; =20 if (is_tracepoint (tp)) { @@ -14174,18 +14171,15 @@ add_catch_command (const char *name, const char *= docstring, set_cmd_completer (command, completer); } =20 -/* Zero if any of the breakpoint's locations could be a location where - functions have been inlined, nonzero otherwise. */ +/* False if any of the breakpoint's locations could be a location where + functions have been inlined, true otherwise. */ =20 -static int +static bool is_non_inline_function (struct breakpoint *b) { /* The shared library event breakpoint is set on the address of a non-inline function. */ - if (b->type =3D=3D bp_shlib_event) - return 1; - - return 0; + return (b->type =3D=3D bp_shlib_event); } =20 /* Nonzero if the specified PC cannot be a location where functions