MFC after: 2 weeks
MFC to: stable/14, stable/15
Sponsored by: FreeBSD Foundation
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 76858 Build 73741: arc lint + arc unit
Event Timeline
Early in this year, I created a PR on lldb side that does trapframe unwinding similar to what KGDB does, but one contributors from Apple was against it. Instead, he suggested using CFI directives for unwinding special frames which is what Apple folks do for debugging Darwin. I thought it was a good idea because a) no major changes needed on LLDB side and b) this is more "standard" (DWARF) way of debugging across call frames.
I've tested trapframe unwinding on amd64 with fully CFI-patched kernel and lldb. It gives equivalent result to KGDB for backtrace and more accurate result for inspecting registers as KGDB displays some amd64 GPRs with values from earlier frames instead of marking them unavailable. I haven't tested the fully CFI-patched kernel for other architectures, but this revision only introduces necessary helpers and doesn't add anything to the kernel binary, so I think it's fine. If you want to see the full series of patches, see here. I'll upstream these once I finish all the tests (currently CFI looks fine on ELF inspection, but I need to run the kernels)