From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id A1A4F385842A for ; Thu, 19 Aug 2021 09:49:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A1A4F385842A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x32a.google.com with SMTP id j12-20020a05600c1c0c00b002e6d80c902dso3659001wms.4 for ; Thu, 19 Aug 2021 02:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CK6v9m1aOGP//iz1idbiwDu3mlAyulSPDR9xg3+hfz0=; b=hPQZyG1zlr6Rrp5SUprAY8LAEM4gnmwf9QWr91ALmY+4abXo93UZai3+l/rY2ylk+W Y0P6g118BUbdhhnvNQzKsVwbR4Zw6D1XskkO7P5kb5RbmwzWfcR6aqAbgUg351Meun6i Vs792I6vHMqgf9H+qc/q6yOqLwOQgYlZa34JEhbVSmxmWh4v1rxSr3aR56uHyDwBnXF4 XMpDmoJGanLKgiKC+il3Ol8t7cxWWZTAJw5NIL/4d56cdRZJbGDnT0IojiVV//lUzudg 5+nxpMeKnQ2BlljtBs3s61vRDmUi1NUVzNFs+lGZQE/P06vt/2MJpSpD28WqG6tVCBRv b+OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CK6v9m1aOGP//iz1idbiwDu3mlAyulSPDR9xg3+hfz0=; b=N8SURGA7PPzbr4wApbhiHXXhQYzEFRRAMK+/9paTkSTZIQ1uKMk8hL0ZapT5JQ+hr9 558Pw3g0Dk2QQqbN79ATtSXs2aY96g6O5j2wxhYP82WH6Dl7zMTjoRy23eERD6HCuwRC NAbaFsrERgXFU9LHP3kJEj3H1zBb5EYfylRm5GRmGiCp+G07HuIAd0tWgkvw+CIKuqGO 0zp9alY623jPAtFWlvAE9byRIGtd2yD1Vn5KCh18sVGwqJQYlKcdyMNriRrqnysAFwjw vvkInrtqXUPU29YCOnZCKOjGDGrVFOJ2M2YYpJ4aDmXjoEoaXE9ghZTdE9CnVJEgmmSA vqXA== X-Gm-Message-State: AOAM531s3XwOgU0uBEavXCA733amNJy/L5XtBDmkh30Xk+vAVbhanW+s /BeX+dFI/hMZtTsGx2e68u3qjExi84TlGg== X-Google-Smtp-Source: ABdhPJybnuQMqB4vCpMAF11JLsyoXH1QfrpvrufxiVMW+lUVpe2EbUe+JldTRJDb05tppBut9CCdmw== X-Received: by 2002:a7b:ca45:: with SMTP id m5mr12771484wml.158.1629366577569; Thu, 19 Aug 2021 02:49:37 -0700 (PDT) Received: from localhost (host86-188-49-44.range86-188.btcentralplus.com. [86.188.49.44]) by smtp.gmail.com with ESMTPSA id j17sm2354555wrt.69.2021.08.19.02.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Aug 2021 02:49:37 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: [PATCH 1/6] gdb: use bool instead of int in struct internal_problem Date: Thu, 19 Aug 2021 10:49:26 +0100 Message-Id: <2f8d9b07e5d548eedc58bd73594cafb135b46963.1629366146.git.andrew.burgess@embecosm.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Aug 2021 09:49:48 -0000 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 1c226d5d85e..3916ae5a1c9 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.25.4