[lldb-dev] Adding support for FreeBSD kernel coredumps (and live memory lookup)

Ed Maste via lldb-dev lldb-dev at lists.llvm.org
Tue Dec 14 11:09:05 PST 2021


On Tue, 14 Dec 2021 at 10:58, Pavel Labath via lldb-dev
<lldb-dev at lists.llvm.org> wrote:
>
> So how would this be represented in lldb? Would there be any threads,
> registers? Just a process with a bunch of modules ?

Using GDB (kgdb) as an example - it lists a thread for every
kernel/userspace thread. For example,
...
  593  Thread 100691 (PID=20798: sleep)
sched_switch (td=0xfffffe0118579100, flags=<optimized out>)
    at /usr/home/emaste/src/freebsd-git/laptop/sys/kern/sched_ule.c:2147
...

and it can fetch per-thread register state:

(kgdb) thread 593
[Switching to thread 593 (Thread 100691)]
#0  sched_switch (td=0xfffffe0118579100, flags=<optimized out>) at
/usr/home/emaste/src/freebsd-git/laptop/sys/kern/sched_ule.c:2147
2147                    cpuid = td->td_oncpu = PCPU_GET(cpuid);
(kgdb) info reg
rax            <unavailable>
rbx            0x882c545e          2284606558
rcx            <unavailable>
rdx            <unavailable>
rsi            <unavailable>
rdi            <unavailable>
rbp            0xfffffe01172617d0  0xfffffe01172617d0
rsp            0xfffffe0117261708  0xfffffe0117261708
....

(kgdb) bt
#0  sched_switch (td=0xfffffe0118579100, flags=<optimized out>) at
/usr/home/emaste/src/freebsd-git/laptop/sys/kern/sched_ule.c:2147
#1  0xffffffff80ba4261 in mi_switch (flags=flags at entry=260) at
/usr/home/emaste/src/freebsd-git/laptop/sys/kern/kern_synch.c:542
#2  0xffffffff80bf428e in sleepq_switch
(wchan=wchan at entry=0xffffffff81c8db21 <nanowait+1>, pri=pri at entry=108)
    at /usr/home/emaste/src/freebsd-git/laptop/sys/kern/subr_sleepqueue.c:608
...


More information about the lldb-dev mailing list