From patchwork Tue Apr 9 16:45:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 32223 Received: (qmail 3831 invoked by alias); 9 Apr 2019 16:45:30 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3063 invoked by uid 89); 9 Apr 2019 16:45:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=silent, noticed, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Apr 2019 16:45:27 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E4C185609E; Tue, 9 Apr 2019 12:45:25 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id z-LFWxHcVEFP; Tue, 9 Apr 2019 12:45:25 -0400 (EDT) Received: from murgatroyd.Home (174-29-37-56.hlrn.qwest.net [174.29.37.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 907E25609D; Tue, 9 Apr 2019 12:45:25 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Consistently use bool for fake_pid_p Date: Tue, 9 Apr 2019 10:45:24 -0600 Message-Id: <20190409164524.28855-1-tromey@adacore.com> MIME-Version: 1.0 I noticed a few spots where fake_pid_p is handled as an int, whereas the field in struct inferior has type bool. This patch changes the remaining places to use bool as well. Tested by the buildbot. gdb/ChangeLog 2019-04-09 Tom Tromey * remote.c (remote_target::remote_add_inferior): Change fake_pid_p to bool. (extended_remote_target::attach): Update. (remote_target::remote_notice_new_inferior): Update. (remote_target::add_current_inferior_and_thread): Update. * inferior.c (exit_inferior_1): Use "false". * corelow.c (add_to_thread_list): Make fake_pid_p bool. --- gdb/ChangeLog | 10 ++++++++++ gdb/corelow.c | 4 ++-- gdb/inferior.c | 2 +- gdb/remote.c | 14 +++++++------- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/gdb/corelow.c b/gdb/corelow.c index 22fe7de020c..3ce612d31b4 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -285,7 +285,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) int core_tid; int pid, lwpid; asection *reg_sect = (asection *) reg_sect_arg; - int fake_pid_p = 0; + bool fake_pid_p = false; struct inferior *inf; if (!startswith (bfd_section_name (abfd, asect), ".reg/")) @@ -296,7 +296,7 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) pid = bfd_core_file_pid (core_bfd); if (pid == 0) { - fake_pid_p = 1; + fake_pid_p = true; pid = CORELOW_PID; } diff --git a/gdb/inferior.c b/gdb/inferior.c index e995af816c1..e7b49376e93 100644 --- a/gdb/inferior.c +++ b/gdb/inferior.c @@ -191,7 +191,7 @@ exit_inferior_1 (struct inferior *inftoex, int silent) gdb::observers::inferior_exit.notify (inf); inf->pid = 0; - inf->fake_pid_p = 0; + inf->fake_pid_p = false; inf->priv = NULL; if (inf->vfork_parent != NULL) diff --git a/gdb/remote.c b/gdb/remote.c index 9bbf458b637..69b479b40c1 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -767,7 +767,7 @@ public: /* Remote specific methods. */ char *remote_get_noisy_reply (); int remote_query_attached (int pid); - inferior *remote_add_inferior (int fake_pid_p, int pid, int attached, + inferior *remote_add_inferior (bool fake_pid_p, int pid, int attached, int try_open_exec); ptid_t remote_current_thread (ptid_t oldpid); @@ -2354,7 +2354,7 @@ remote_target::remote_query_attached (int pid) if no main executable is open already. */ inferior * -remote_target::remote_add_inferior (int fake_pid_p, int pid, int attached, +remote_target::remote_add_inferior (bool fake_pid_p, int pid, int attached, int try_open_exec) { struct inferior *inf; @@ -2495,7 +2495,7 @@ remote_target::remote_notice_new_inferior (ptid_t currthread, int executing) if (find_inferior_pid (currthread.pid ()) == NULL) { struct remote_state *rs = get_remote_state (); - int fake_pid_p = !remote_multi_process_p (rs); + bool fake_pid_p = !remote_multi_process_p (rs); inf = remote_add_inferior (fake_pid_p, currthread.pid (), -1, 1); @@ -4311,7 +4311,7 @@ void remote_target::add_current_inferior_and_thread (char *wait_status) { struct remote_state *rs = get_remote_state (); - int fake_pid_p = 0; + bool fake_pid_p = false; inferior_ptid = null_ptid; @@ -4321,7 +4321,7 @@ remote_target::add_current_inferior_and_thread (char *wait_status) if (curr_ptid != null_ptid) { if (!remote_multi_process_p (rs)) - fake_pid_p = 1; + fake_pid_p = true; } else { @@ -4330,7 +4330,7 @@ remote_target::add_current_inferior_and_thread (char *wait_status) double duty as both the pid of the target process (if it has such), and as a flag indicating that a target is active. */ curr_ptid = magic_null_ptid; - fake_pid_p = 1; + fake_pid_p = true; } remote_add_inferior (fake_pid_p, curr_ptid.pid (), -1, 1); @@ -5847,7 +5847,7 @@ extended_remote_target::attach (const char *args, int from_tty) target_pid_to_str (ptid_t (pid)).c_str ()); } - set_current_inferior (remote_add_inferior (0, pid, 1, 0)); + set_current_inferior (remote_add_inferior (false, pid, 1, 0)); inferior_ptid = ptid_t (pid);