lldb: dereference stoppcbs based on target kernel version

As of 9fb6718d1b / __FreeBSD_version 1400089 stoppcbs is a pointer to
the pcbs array.  Dereference stoppcbs on sufficiently new kernels.

Reviewed by:	markj (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39939
This commit is contained in:
Ed Maste 2023-05-02 16:24:46 -04:00
parent db289ababf
commit 0f2bb40bc7

View File

@ -178,6 +178,11 @@ bool ProcessFreeBSDKernel::DoUpdateThreadList(ThreadList &old_thread_list,
int32_t pcbsize =
ReadSignedIntegerFromMemory(FindSymbol("pcb_size"), 4, -1, error);
lldb::addr_t stoppcbs = FindSymbol("stoppcbs");
// In later FreeBSD versions stoppcbs is a pointer to the array.
int32_t osreldate =
ReadSignedIntegerFromMemory(FindSymbol("osreldate"), 4, -1, error);
if (stoppcbs != LLDB_INVALID_ADDRESS && osreldate >= 1400089)
stoppcbs = ReadPointerFromMemory(stoppcbs, error);
// from FreeBSD sys/param.h
constexpr size_t fbsd_maxcomlen = 19;