Use bool in bpstat

This changes bpstat to use 'bool' rather than 'char', and updates the
uses.
This commit is contained in:
Tom Tromey
2022-11-11 14:50:50 -07:00
parent dad6b350f9
commit 4ec2227afb
6 changed files with 31 additions and 30 deletions

View File

@ -134,7 +134,7 @@ solib_catchpoint::check_status (struct bpstat *bs)
} }
} }
bs->stop = 0; bs->stop = false;
bs->print_it = print_it_noop; bs->print_it = print_it_noop;
} }

View File

@ -172,7 +172,7 @@ exception_catchpoint::check_status (struct bpstat *bs)
std::string type_name; std::string type_name;
this->breakpoint::check_status (bs); this->breakpoint::check_status (bs);
if (bs->stop == 0) if (!bs->stop)
return; return;
if (self->pattern == NULL) if (self->pattern == NULL)
@ -200,7 +200,7 @@ exception_catchpoint::check_status (struct bpstat *bs)
if (name != nullptr) if (name != nullptr)
{ {
if (self->pattern->exec (name, 0, NULL, 0) != 0) if (self->pattern->exec (name, 0, NULL, 0) != 0)
bs->stop = 0; bs->stop = false;
} }
} }

View File

@ -5253,7 +5253,7 @@ bpstat_check_location (const struct bp_location *bl,
} }
/* Determine if the watched values have actually changed, and we /* Determine if the watched values have actually changed, and we
should stop. If not, set BS->stop to 0. */ should stop. If not, set BS->stop to false. */
static void static void
bpstat_check_watchpoint (bpstat *bs) bpstat_check_watchpoint (bpstat *bs)
@ -5320,7 +5320,7 @@ bpstat_check_watchpoint (bpstat *bs)
break; break;
case WP_IGNORE: case WP_IGNORE:
bs->print_it = print_it_noop; bs->print_it = print_it_noop;
bs->stop = 0; bs->stop = false;
break; break;
case WP_VALUE_CHANGED: case WP_VALUE_CHANGED:
if (b->type == bp_read_watchpoint) if (b->type == bp_read_watchpoint)
@ -5387,7 +5387,7 @@ bpstat_check_watchpoint (bpstat *bs)
updated it, so this trap must be for a write. updated it, so this trap must be for a write.
Ignore it. */ Ignore it. */
bs->print_it = print_it_noop; bs->print_it = print_it_noop;
bs->stop = 0; bs->stop = false;
} }
} }
break; break;
@ -5398,7 +5398,7 @@ bpstat_check_watchpoint (bpstat *bs)
/* Don't stop: write watchpoints shouldn't fire if /* Don't stop: write watchpoints shouldn't fire if
the value hasn't changed. */ the value hasn't changed. */
bs->print_it = print_it_noop; bs->print_it = print_it_noop;
bs->stop = 0; bs->stop = false;
} }
/* Stop. */ /* Stop. */
break; break;
@ -5414,7 +5414,7 @@ bpstat_check_watchpoint (bpstat *bs)
watchpoint triggered after all. So don't print watchpoint triggered after all. So don't print
anything for this watchpoint. */ anything for this watchpoint. */
bs->print_it = print_it_noop; bs->print_it = print_it_noop;
bs->stop = 0; bs->stop = false;
} }
} }
} }
@ -5457,7 +5457,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
infrun_debug_printf ("incorrect frame %s not %s, not stopping", infrun_debug_printf ("incorrect frame %s not %s, not stopping",
get_stack_frame_id (get_current_frame ()).to_string ().c_str (), get_stack_frame_id (get_current_frame ()).to_string ().c_str (),
b->frame_id.to_string ().c_str ()); b->frame_id.to_string ().c_str ());
bs->stop = 0; bs->stop = false;
return; return;
} }
@ -5468,7 +5468,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
|| (b->task != 0 && b->task != ada_get_task_number (thread))) || (b->task != 0 && b->task != ada_get_task_number (thread)))
{ {
infrun_debug_printf ("incorrect thread or task, not stopping"); infrun_debug_printf ("incorrect thread or task, not stopping");
bs->stop = 0; bs->stop = false;
return; return;
} }
@ -5558,7 +5558,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
if (cond != nullptr && !condition_result) if (cond != nullptr && !condition_result)
{ {
infrun_debug_printf ("condition_result = false, not stopping"); infrun_debug_printf ("condition_result = false, not stopping");
bs->stop = 0; bs->stop = false;
return; return;
} }
else if (b->ignore_count > 0) else if (b->ignore_count > 0)
@ -5566,7 +5566,7 @@ bpstat_check_breakpoint_conditions (bpstat *bs, thread_info *thread)
infrun_debug_printf ("ignore count %d, not stopping", infrun_debug_printf ("ignore count %d, not stopping",
b->ignore_count); b->ignore_count);
b->ignore_count--; b->ignore_count--;
bs->stop = 0; bs->stop = false;
/* Increase the hit count even though we don't stop. */ /* Increase the hit count even though we don't stop. */
++(b->hit_count); ++(b->hit_count);
gdb::observers::breakpoint_modified.notify (b); gdb::observers::breakpoint_modified.notify (b);
@ -5629,8 +5629,8 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
/* Assume we stop. Should we find a watchpoint that is not /* Assume we stop. Should we find a watchpoint that is not
actually triggered, or if the condition of the breakpoint actually triggered, or if the condition of the breakpoint
evaluates as false, we'll reset 'stop' to 0. */ evaluates as false, we'll reset 'stop' to 0. */
bs->stop = 1; bs->stop = true;
bs->print = 1; bs->print = true;
/* If this is a scope breakpoint, mark the associated /* If this is a scope breakpoint, mark the associated
watchpoint as triggered so that we will handle the watchpoint as triggered so that we will handle the
@ -5656,8 +5656,8 @@ build_bpstat_chain (const address_space *aspace, CORE_ADDR bp_addr,
{ {
bpstat *bs = new bpstat (loc, &bs_link); bpstat *bs = new bpstat (loc, &bs_link);
/* For hits of moribund locations, we should just proceed. */ /* For hits of moribund locations, we should just proceed. */
bs->stop = 0; bs->stop = false;
bs->print = 0; bs->print = false;
bs->print_it = print_it_noop; bs->print_it = print_it_noop;
} }
} }
@ -5734,11 +5734,11 @@ bpstat_stop_status (const address_space *aspace,
} }
gdb::observers::breakpoint_modified.notify (b); gdb::observers::breakpoint_modified.notify (b);
if (b->silent) if (b->silent)
bs->print = 0; bs->print = false;
bs->commands = b->commands; bs->commands = b->commands;
if (command_line_is_silent (bs->commands if (command_line_is_silent (bs->commands
? bs->commands.get () : NULL)) ? bs->commands.get () : NULL))
bs->print = 0; bs->print = false;
b->after_condition_true (bs); b->after_condition_true (bs);
} }
@ -11882,11 +11882,11 @@ internal_breakpoint::check_status (bpstat *bs)
events. This allows the user to get control and place events. This allows the user to get control and place
breakpoints in initializer routines for dynamically loaded breakpoints in initializer routines for dynamically loaded
objects (among other things). */ objects (among other things). */
bs->stop = stop_on_solib_events; bs->stop = stop_on_solib_events != 0;
bs->print = stop_on_solib_events; bs->print = stop_on_solib_events != 0;
} }
else else
bs->stop = 0; bs->stop = false;
} }
enum print_stop_action enum print_stop_action
@ -12133,7 +12133,7 @@ dprintf_breakpoint::after_condition_true (struct bpstat *bs)
/* dprintf's never cause a stop. This wasn't set in the /* dprintf's never cause a stop. This wasn't set in the
check_status hook instead because that would make the dprintf's check_status hook instead because that would make the dprintf's
condition not be evaluated. */ condition not be evaluated. */
bs->stop = 0; bs->stop = false;
/* Run the command list here. Take ownership of it instead of /* Run the command list here. Take ownership of it instead of
copying. We never want these commands to run later in copying. We never want these commands to run later in

View File

@ -664,7 +664,8 @@ struct breakpoint
const target_waitstatus &ws); const target_waitstatus &ws);
/* Check internal conditions of the breakpoint referred to by BS. /* Check internal conditions of the breakpoint referred to by BS.
If we should not stop for this breakpoint, set BS->stop to 0. */ If we should not stop for this breakpoint, set BS->stop to
false. */
virtual void check_status (struct bpstat *bs) virtual void check_status (struct bpstat *bs)
{ {
/* Always stop. */ /* Always stop. */
@ -1326,11 +1327,11 @@ struct bpstat
/* Old value associated with a watchpoint. */ /* Old value associated with a watchpoint. */
value_ref_ptr old_val; value_ref_ptr old_val;
/* Nonzero if this breakpoint tells us to print the frame. */ /* True if this breakpoint tells us to print the frame. */
char print; bool print;
/* Nonzero if this breakpoint tells us to stop. */ /* True if this breakpoint tells us to stop. */
char stop; bool stop;
/* Tell bpstat_print and print_bp_stop_message how to print stuff /* Tell bpstat_print and print_bp_stop_message how to print stuff
associated with this element of the bpstat chain. */ associated with this element of the bpstat chain. */

View File

@ -598,7 +598,7 @@ get_breakpoint_cond_ext_lang (struct breakpoint *b,
/* Return whether a stop condition for breakpoint B says to stop. /* Return whether a stop condition for breakpoint B says to stop.
True is also returned if there is no stop condition for B. */ True is also returned if there is no stop condition for B. */
int bool
breakpoint_ext_lang_cond_says_stop (struct breakpoint *b) breakpoint_ext_lang_cond_says_stop (struct breakpoint *b)
{ {
enum ext_lang_bp_stop stop = EXT_LANG_BP_STOP_UNSET; enum ext_lang_bp_stop stop = EXT_LANG_BP_STOP_UNSET;
@ -627,7 +627,7 @@ breakpoint_ext_lang_cond_says_stop (struct breakpoint *b)
} }
} }
return stop == EXT_LANG_BP_STOP_NO ? 0 : 1; return stop != EXT_LANG_BP_STOP_NO;
} }
/* ^C/SIGINT support. /* ^C/SIGINT support.

View File

@ -300,7 +300,7 @@ extern void preserve_ext_lang_values (struct objfile *, htab_t copied_types);
extern const struct extension_language_defn *get_breakpoint_cond_ext_lang extern const struct extension_language_defn *get_breakpoint_cond_ext_lang
(struct breakpoint *b, enum extension_language skip_lang); (struct breakpoint *b, enum extension_language skip_lang);
extern int breakpoint_ext_lang_cond_says_stop (struct breakpoint *); extern bool breakpoint_ext_lang_cond_says_stop (struct breakpoint *);
/* If a method with name METHOD_NAME is to be invoked on an object of type /* If a method with name METHOD_NAME is to be invoked on an object of type
TYPE, then all extension languages are searched for implementations of TYPE, then all extension languages are searched for implementations of