Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jan 2024 23:08:05 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 104cc21de8d6 - stable/13 - lldb: dereference stoppcbs based on target kernel version
Message-ID:  <202401072308.407N85NC052883@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=104cc21de8d688905d67f4a9150b2a0511243273

commit 104cc21de8d688905d67f4a9150b2a0511243273
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2023-05-02 20:24:46 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-01-07 23:04:33 +0000

    lldb: dereference stoppcbs based on target kernel version
    
    As of 9fb6718d1b18 / __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
    
    (cherry picked from commit 0f2bb40bc7ddee7ba329d9b344623e2a186b4046)
---
 .../source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp    | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp b/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
index e3707365a9c3..30eace1ba94f 100644
--- a/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
+++ b/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSDKernel/ProcessFreeBSDKernel.cpp
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202401072308.407N85NC052883>