Use false/true for some inferior class members instead of 0/1
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 27 Nov 2022 16:57:08 +0000 (17:57 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Sun, 27 Nov 2022 20:06:18 +0000 (21:06 +0100)
Some class members were changed to bool, but there was
still some assignments or comparisons using 0/1.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/auxv.c
gdb/darwin-nat.c
gdb/gnu-nat.c
gdb/inf-ptrace.c
gdb/infcmd.c
gdb/inferior.c
gdb/infrun.c
gdb/nto-procfs.c
gdb/procfs.c
gdb/remote.c
gdb/target.c

index 51723f9b17cbd6c73b4b833ecaf298a7a794fdef..0ac74826aebbc116b4a258c5f5eeee0b05c53bc3 100644 (file)
@@ -234,7 +234,7 @@ memory_xfer_auxv (struct target_ops *ops,
       this function only when attaching to a process.
       */
 
-  if (current_inferior ()->attach_flag != 0)
+  if (current_inferior ()->attach_flag)
     {
       enum target_xfer_status ret;
 
index eca97c9bde989ce93f6b78f5e787cb18cd82eb1e..66b3a152374b3012773c6fe873deb5cc40d99c1d 100644 (file)
@@ -2037,7 +2037,7 @@ darwin_nat_target::attach (const char *args, int from_tty)
 
   inf = current_inferior ();
   inferior_appeared (inf, pid);
-  inf->attach_flag = 1;
+  inf->attach_flag = true;
 
   darwin_attach_pid (inf);
 
index ae049cab3de9062ef3c172436c5f34e8adee7f51..abbf4523de639545643a1a7a86383e79d55b6cd6 100644 (file)
@@ -2183,7 +2183,7 @@ gnu_nat_target::attach (const char *args, int from_tty)
   inferior->push_target (this);
 
   inferior_appeared (inferior, pid);
-  inferior->attach_flag = 1;
+  inferior->attach_flag = true;
 
   inf_update_procs (inf);
 
index 8995ef517dddd4d6ee6530c0318ee375770d03bf..ab669a7acc2e9d85d1aaa10e274feef466f188ad 100644 (file)
@@ -163,7 +163,7 @@ inf_ptrace_target::attach (const char *args, int from_tty)
 #endif
 
   inferior_appeared (inf, pid);
-  inf->attach_flag = 1;
+  inf->attach_flag = true;
 
   /* Always add a main thread.  If some target extends the ptrace
      target, it should decorate the ptid later with more info.  */
index f7bce0d0399d5e8edc55a29b79d0dcbbf4b3e025..a27d3577b3aa8e24b4498b783724050289516d8f 100644 (file)
@@ -2494,7 +2494,7 @@ setup_inferior (int from_tty)
   struct inferior *inferior;
 
   inferior = current_inferior ();
-  inferior->needs_setup = 0;
+  inferior->needs_setup = false;
 
   /* If no exec file is yet known, try to determine it from the
      process itself.  */
@@ -2677,7 +2677,7 @@ attach_command (const char *args, int from_tty)
      wait_for_inferior as soon as the target reports a stop.  */
   init_wait_for_inferior ();
 
-  inferior->needs_setup = 1;
+  inferior->needs_setup = true;
 
   if (target_is_non_stop_p ())
     {
index 7eb2bd97907832df22b485a1eb227de2afcc778e..23cbfd63bde0823f414c2c331750df420306c5f8 100644 (file)
@@ -223,7 +223,7 @@ exit_inferior_1 (struct inferior *inf, int silent)
       inf->vfork_child = NULL;
     }
 
-  inf->pending_detach = 0;
+  inf->pending_detach = false;
   /* Reset it.  */
   inf->control = inferior_control_state (NO_STOP_QUIETLY);
 
@@ -270,7 +270,7 @@ inferior_appeared (struct inferior *inf, int pid)
     init_thread_list ();
 
   inf->pid = pid;
-  inf->has_exit_code = 0;
+  inf->has_exit_code = false;
   inf->exit_code = 0;
 
   gdb::observers::inferior_appeared.notify (inf);
index 96346e1f25b15c43761659686d276baecefb004d..3613a4af79b0c45e11bdedb7bc7b094beb6e4d70 100644 (file)
@@ -495,15 +495,15 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
                 with the shared region.  Keep track of the
                 parent.  */
              child_inf->vfork_parent = parent_inf;
-             child_inf->pending_detach = 0;
+             child_inf->pending_detach = false;
              parent_inf->vfork_child = child_inf;
-             parent_inf->pending_detach = 0;
+             parent_inf->pending_detach = false;
            }
          else
            {
              child_inf->aspace = new address_space ();
              child_inf->pspace = new program_space (child_inf->aspace);
-             child_inf->removable = 1;
+             child_inf->removable = true;
              clone_program_space (child_inf->pspace, parent_inf->pspace);
            }
        }
@@ -585,7 +585,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
        {
          child_inf->aspace = new address_space ();
          child_inf->pspace = new program_space (child_inf->aspace);
-         child_inf->removable = 1;
+         child_inf->removable = true;
          child_inf->symfile_flags = SYMFILE_NO_READ;
          clone_program_space (child_inf->pspace, parent_inf->pspace);
        }
@@ -647,7 +647,7 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
          gdb_assert (child_inf->vfork_parent == nullptr);
          gdb_assert (parent_inf->vfork_child == nullptr);
          child_inf->vfork_parent = parent_inf;
-         child_inf->pending_detach = 0;
+         child_inf->pending_detach = false;
          parent_inf->vfork_child = child_inf;
          parent_inf->pending_detach = detach_fork;
        }
@@ -942,7 +942,7 @@ handle_vfork_child_exec_or_exit (int exec)
 
          /* follow-fork child, detach-on-fork on.  */
 
-         vfork_parent->pending_detach = 0;
+         vfork_parent->pending_detach = false;
 
          scoped_restore_current_pspace_and_thread restore_thread;
 
@@ -998,7 +998,7 @@ handle_vfork_child_exec_or_exit (int exec)
             child a new address space.  */
          inf->pspace = new program_space (maybe_new_address_space ());
          inf->aspace = inf->pspace->aspace;
-         inf->removable = 1;
+         inf->removable = true;
          set_current_program_space (inf->pspace);
 
          resume_parent = vfork_parent;
@@ -1023,7 +1023,7 @@ handle_vfork_child_exec_or_exit (int exec)
          inf->pspace = new program_space (maybe_new_address_space ());
          inf->aspace = inf->pspace->aspace;
          set_current_program_space (inf->pspace);
-         inf->removable = 1;
+         inf->removable = true;
          inf->symfile_flags = SYMFILE_NO_READ;
          clone_program_space (inf->pspace, vfork_parent->pspace);
 
@@ -5563,7 +5563,7 @@ handle_inferior_event (struct execution_control_state *ecs)
                                   (LONGEST) ecs->ws.exit_status ());
 
          /* Also record this in the inferior itself.  */
-         current_inferior ()->has_exit_code = 1;
+         current_inferior ()->has_exit_code = true;
          current_inferior ()->exit_code = (LONGEST) ecs->ws.exit_status ();
 
          /* Support the --return-child-result option.  */
index ef9e0f05261254765570eb150bcf50813e0ac552..4a2968ea1798bc9664acd161930ad2a66f8e9c37 100644 (file)
@@ -706,7 +706,7 @@ nto_procfs_target::attach (const char *args, int from_tty)
   ptid_t ptid = do_attach (ptid_t (pid));
   inf = current_inferior ();
   inferior_appeared (inf, pid);
-  inf->attach_flag = 1;
+  inf->attach_flag = true;
 
   if (!inf->target_is_pushed (ops))
     inf->push_target (ops);
@@ -1286,7 +1286,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
 
   inf = current_inferior ();
   inferior_appeared (inf, pid);
-  inf->attach_flag = 0;
+  inf->attach_flag = false;
 
   flags = _DEBUG_FLAG_KLC;     /* Kill-on-Last-Close flag.  */
   errn = devctl (ctl_fd, DCMD_PROC_SET_FLAG, &flags, sizeof (flags), 0);
index 141db3dd7932e249696849a356b0af47e8afe899..ac3d60ebf1c82de3b58ad00d05043adb7002009b 100644 (file)
@@ -1849,7 +1849,7 @@ do_attach (ptid_t ptid)
   inf = current_inferior ();
   inferior_appeared (inf, pi->pid);
   /* Let GDB know that the inferior was attached.  */
-  inf->attach_flag = 1;
+  inf->attach_flag = true;
 
   /* Create a procinfo for the current lwp.  */
   lwpid = proc_get_current_thread (pi);
index 5118ecd0a31254cf551f01292651284bfe42e1d9..53c4f19c5a473fad87849e2446568956ab9430d6 100644 (file)
@@ -4625,7 +4625,7 @@ remote_target::process_initial_stop_replies (int from_tty)
      registers/memory.  */
   for (inferior *inf : all_non_exited_inferiors (this))
     {
-      inf->needs_setup = 1;
+      inf->needs_setup = true;
 
       if (non_stop)
        {
index 74925e139dc148f286e96eefc826dab5c8e3997e..b88df0f678b50946132a9f04d32afd90f950ca12 100644 (file)
@@ -2489,7 +2489,7 @@ target_pre_inferior (int from_tty)
 
   /* attach_flag may be set if the previous process associated with
      the inferior was attached to.  */
-  current_inferior ()->attach_flag = 0;
+  current_inferior ()->attach_flag = false;
 
   current_inferior ()->highest_thread_num = 0;