From 90f4cc60f1b91746132ad136a9ed538b53d2a83f Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Tue, 17 Aug 2021 11:54:51 +0100 Subject: [PATCH] gdb: use bool instead of int in struct internal_problem Change struct internal_problem (gdb/utils.c) to use bool instead of int, update the 3 static instances of this structure that we create to use true/false instead of 1/0. I've also updated the comments on struct internal_problem as the existing comment doesn't seem to be referring to the structure, it talks about returning something, which doesn't make sense in this context. There should be no user visible changes after this commit. --- gdb/utils.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/gdb/utils.c b/gdb/utils.c index ae6fb594dbb..0009cb10d87 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -280,16 +280,29 @@ static const char *const internal_problem_modes[] = NULL }; -/* Print a message reporting an internal error/warning. Ask the user - if they want to continue, dump core, or just exit. Return - something to indicate a quit. */ +/* Data structure used to control how the internal_vproblem function + should behave. An instance of this structure is created for each + problem type that GDB supports. */ struct internal_problem { + /* The name of this problem type. This must not contain white space as + this string is used to build command names. */ const char *name; - int user_settable_should_quit; + + /* When this is true then a user command is created (based on NAME) that + allows the SHOULD_QUIT field to be modified, otherwise, SHOULD_QUIT + can't be changed from its default value by the user. */ + bool user_settable_should_quit; + + /* Reference a value from internal_problem_modes to indicate if GDB + should quit when it hits a problem of this type. */ const char *should_quit; - int user_settable_should_dump_core; + + /* Like USER_SETTABLE_SHOULD_QUIT but for SHOULD_DUMP_CORE. */ + bool user_settable_should_dump_core; + + /* Like SHOULD_QUIT, but whether GDB should dump core. */ const char *should_dump_core; }; @@ -435,7 +448,7 @@ internal_vproblem (struct internal_problem *problem, } static struct internal_problem internal_error_problem = { - "internal-error", 1, internal_problem_ask, 1, internal_problem_ask + "internal-error", true, internal_problem_ask, true, internal_problem_ask, }; void @@ -446,7 +459,7 @@ internal_verror (const char *file, int line, const char *fmt, va_list ap) } static struct internal_problem internal_warning_problem = { - "internal-warning", 1, internal_problem_ask, 1, internal_problem_ask + "internal-warning", true, internal_problem_ask, true, internal_problem_ask, }; void @@ -456,7 +469,7 @@ internal_vwarning (const char *file, int line, const char *fmt, va_list ap) } static struct internal_problem demangler_warning_problem = { - "demangler-warning", 1, internal_problem_ask, 0, internal_problem_no + "demangler-warning", true, internal_problem_ask, false, internal_problem_no, }; void -- 2.30.2