From 9ab8741a48294e19d514721c710c81bba46db7f2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 4 Apr 2019 17:03:27 -0600 Subject: Consistently use bool for fake_pid_p 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/ChangeLog b/gdb/ChangeLog index 8e32546..6ee8d05 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +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. + 2019-04-09 Simon Marchi * infcmd.c (run_command_1): Pass -qualified to tbreak when using diff --git a/gdb/corelow.c b/gdb/corelow.c index 22fe7de..3ce612d 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 e995af8..e7b4937 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 9bbf458..69b479b 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); -- cgit v1.1