Small get_tib_address cleanups

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>
This commit is contained in:
Tom Tromey 2025-02-19 08:55:37 -07:00
parent 67c2a95af3
commit 904d3768c8
3 changed files with 9 additions and 6 deletions

View 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)
{

View 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 ();

View 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 ());