diff options
author | Tom Tromey <tromey@adacore.com> | 2025-02-19 08:55:37 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-02-20 07:39:41 -0700 |
commit | 904d3768c88a6591204969826f47d706f6da504a (patch) | |
tree | 6167abd24e2b61414b25b894b958adc3e73d91b6 | |
parent | 67c2a95af353239e5771000c08126914349043f4 (diff) | |
download | binutils-904d3768c88a6591204969826f47d706f6da504a.zip binutils-904d3768c88a6591204969826f47d706f6da504a.tar.gz binutils-904d3768c88a6591204969826f47d706f6da504a.tar.bz2 |
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>
-rw-r--r-- | gdb/remote.c | 3 | ||||
-rw-r--r-- | gdb/target.h | 10 | ||||
-rw-r--r-- | gdb/windows-tdep.c | 2 |
3 files changed, 9 insertions, 6 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 4635940..9dfc372 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -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) { diff --git a/gdb/target.h b/gdb/target.h index 5b45f15..d46b288 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -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 (); diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index a5243dc..1302b25 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -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 ()); |