]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: int to bool conversion in linux-thread-db.c
authorAndrew Burgess <aburgess@redhat.com>
Sat, 4 Apr 2026 10:45:23 +0000 (11:45 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 15 May 2026 14:18:55 +0000 (15:18 +0100)
Some 'int' to 'bool' cleanup in linux-thread-db.c.  There should be no
user visible changes after this commit.

Reviewed-By: Keith Seitz <keiths@redhat.com>
gdb/linux-nat.h
gdb/linux-thread-db.c

index 0f128892735e19d26c53c52f9e02743c386652a4..180059a949675a701ac7e4867c3d2bdc7b583590 100644 (file)
@@ -316,7 +316,7 @@ lwp_info_safe_range all_lwps_safe ();
    does whatever is required to have the child LWP under the
    thread_db's control --- e.g., enabling event reporting.  Returns
    true on success, false if the process isn't using libpthread.  */
-extern int thread_db_notice_clone (ptid_t parent, ptid_t child);
+extern bool thread_db_notice_clone (ptid_t parent, ptid_t child);
 
 /* Return the number of signals used by the threads library.  */
 extern unsigned int lin_thread_get_thread_signal_num (void);
index 55b9953ae4f8a7a987b6e77a42af36e6106c207b..5e506c4f497da2a6b69b90d114b4d15b94fa4435 100644 (file)
@@ -429,7 +429,7 @@ thread_from_lwp (thread_info *stopped, ptid_t ptid)
 
 /* See linux-nat.h.  */
 
-int
+bool
 thread_db_notice_clone (ptid_t parent, ptid_t child)
 {
   struct thread_db_info *info;
@@ -437,7 +437,7 @@ thread_db_notice_clone (ptid_t parent, ptid_t child)
   info = get_thread_db_info (linux_target, child.pid ());
 
   if (info == NULL)
-    return 0;
+    return false;
 
   thread_info *stopped = linux_target->find_thread (parent);
 
@@ -446,7 +446,7 @@ thread_db_notice_clone (ptid_t parent, ptid_t child)
   /* If we do not know about the main thread's pthread info yet, this
      would be a good time to find it.  */
   thread_from_lwp (stopped, parent);
-  return 1;
+  return true;
 }
 
 static void *
@@ -460,10 +460,10 @@ verbose_dlsym (void *handle, const char *name)
 }
 
 /* Verify inferior's '\0'-terminated symbol VER_SYMBOL starts with "%d.%d" and
-   return 1 if this version is lower (and not equal) to
-   VER_MAJOR_MIN.VER_MINOR_MIN.  Return 0 in all other cases.  */
+   return true if this version is lower (and not equal) to
+   VER_MAJOR_MIN.VER_MINOR_MIN.  Return false in all other cases.  */
 
-static int
+static bool
 inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
 {
   CORE_ADDR version_addr;
@@ -472,7 +472,7 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
   bound_minimal_symbol version_msym
     = lookup_minimal_symbol (current_program_space, ver_symbol);
   if (version_msym.minsym == NULL)
-    return 0;
+    return false;
 
   version_addr = version_msym.value_address ();
   gdb::unique_xmalloc_ptr<char> version
@@ -493,10 +493,10 @@ inferior_has_bug (const char *ver_symbol, int ver_major_min, int ver_minor_min)
 /* Similar as thread_db_find_new_threads_1, but try to silently ignore errors
    if appropriate.
 
-   Return 1 if the caller should abort libthread_db initialization.  Return 0
-   otherwise.  */
+   Return true if the caller should abort libthread_db initialization.
+   Return false otherwise.  */
 
-static int
+static bool
 thread_db_find_new_threads_silently (thread_info *stopped)
 {
 
@@ -518,25 +518,25 @@ thread_db_find_new_threads_silently (thread_info *stopped)
         itself.
 
         If the nptl bug is NOT present in the inferior and still thread_db
-        reports an error return 1.  It means the inferior has corrupted thread
-        list and GDB should fall back only to LWPs.
+        reports an error return true.  It means the inferior has corrupted
+        thread list and GDB should fall back only to LWPs.
 
-        If the nptl bug is present in the inferior return 0 to silently ignore
-        such errors, and let gdb enumerate threads again later.  In such case
-        GDB cannot properly display LWPs if the inferior thread list is
-        corrupted.  For core files it does not apply, no 'later enumeration'
-        is possible.  */
+        If the nptl bug is present in the inferior return false to
+        silently ignore such errors, and let gdb enumerate threads again
+        later.  In such case GDB cannot properly display LWPs if the
+        inferior thread list is corrupted.  For core files it does not
+        apply, no 'later enumeration' is possible.  */
 
       if (!target_has_execution () || !inferior_has_bug ("nptl_version", 2, 7))
        {
          exception_fprintf (gdb_stderr, except,
                             _("Warning: couldn't activate thread debugging "
                               "using libthread_db: "));
-         return 1;
+         return true;
        }
     }
 
-  return 0;
+  return false;
 }
 
 /* Lookup a library in which given symbol resides.
@@ -924,7 +924,7 @@ try_thread_db_load_1 (struct thread_db_info *info)
 
       linux_unstop_all_lwps ();
     }
-  else if (thread_db_find_new_threads_silently (inferior_thread ()) != 0)
+  else if (thread_db_find_new_threads_silently (inferior_thread ()))
     {
       /* Even if libthread_db initializes, if the thread list is
         corrupted, we'd not manage to list any threads.  Better reject this