]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Small get_tib_address cleanups
authorTom Tromey <tromey@adacore.com>
Wed, 19 Feb 2025 15:55:37 +0000 (08:55 -0700)
committerTom Tromey <tromey@adacore.com>
Thu, 20 Feb 2025 14:39:41 +0000 (07:39 -0700)
I noticed a non-bool-like use of target_get_tib_address in
windows-tdep.c.  After fixing this I thought it would be good to
document the target method; and this also lead to some non-bool-like
commentary in remote.c.  This patch fixes all of these nits.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/remote.c
gdb/target.h
gdb/windows-tdep.c

index 46359400fb23de57eeb6463abd66baf5555a7e5c..9dfc372fc41b4c9f448926b817999b850087989c 100644 (file)
@@ -12473,9 +12473,6 @@ remote_target::get_thread_local_address (ptid_t ptid, CORE_ADDR lm,
   return 0;
 }
 
-/* Provide thread local base, i.e. Thread Information Block address.
-   Returns 1 if ptid is found and thread_local_base is non zero.  */
-
 bool
 remote_target::get_tib_address (ptid_t ptid, CORE_ADDR *addr)
 {
index 5b45f152b51fd917758c2ee19a696d9e038d409e..d46b288fd162161a6a6a99af742600ed84235672 100644 (file)
@@ -1162,8 +1162,12 @@ struct target_ops
                               CORE_ADDR memaddr, ULONGEST size)
       TARGET_DEFAULT_FUNC (default_verify_memory);
 
-    /* Return the address of the start of the Thread Information Block
-       a Windows OS specific feature.  */
+    /* Set *ADDR to the address of the start of the Thread Information
+       Block (TIB) for thread PTID.  Return true on success and false
+       otherwise.
+
+       ADDR may be nullptr, in which case the checks will be done but
+       the result will be discarded.  */
     virtual bool get_tib_address (ptid_t ptid, CORE_ADDR *addr)
       TARGET_DEFAULT_NORETURN (tcomplain ());
 
@@ -2338,6 +2342,8 @@ extern void target_set_trace_buffer_size (LONGEST val);
 extern bool target_set_trace_notes (const char *user, const char *notes,
                                    const char *stopnotes);
 
+/* A wrapper that calls get_tib_address on the top target of the
+   current inferior.  */
 extern bool target_get_tib_address (ptid_t ptid, CORE_ADDR *addr);
 
 extern void target_set_permissions ();
index a5243dc8715955a83d85dc51e65ccfd31011e778..1302b25ed1bee598fcd7e6eaf22a805a7b7b423d 100644 (file)
@@ -478,7 +478,7 @@ display_one_tib (ptid_t ptid)
   
   tib = (gdb_byte *) alloca (tib_size);
 
-  if (target_get_tib_address (ptid, &thread_local_base) == 0)
+  if (!target_get_tib_address (ptid, &thread_local_base))
     {
       gdb_printf (_("Unable to get thread local base for %s\n"),
                  target_pid_to_str (ptid).c_str ());