Page MenuHomeFreeBSD

[PPC] Fix kgdb symbol resolution and backtrace
Needs ReviewPublic

Authored by luporl on Tue, Oct 8, 8:02 PM.

Details

Summary

PowerPC kernels are fully relocatable and may be loaded at any memory address.
In order to resolve symbols properly, GDB must load the kernel symbol file relative to the base offset where it was loaded in memory.

The backtrace command wasn't working because of the following issues:

  • Wrong indexing of pcb.pcb_context[]
  • Initial PC register was not being supplied
Test Plan

This change depends on D21555 for minidump support.

With this change, it is possible to get backtraces from kernel threads, with proper symbol resolution.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 26934
Build 25238: arc lint + arc unit

Event Timeline

luporl created this revision.Tue, Oct 8, 8:02 PM
luporl added a subscriber: linimon.Tue, Oct 8, 8:09 PM
jhb added a comment.Tue, Oct 8, 10:51 PM

The relocation needs to be done a different way to support, e.g. remote debugging (e.g. attaching gdb to qemu's debug stub). Also, kgdb_main.c is just a simpler wrapper, and 'target vmcore /path/to/vmcore' in plain gdb should also work. I'll have to think about how this might be doable, but this approach is rather hacky. It also won't work for cross-debugging (examining a ppc vmcore on a non-ppc host which kgdb generally supports for other architectures). For PIE executables gdb relies on using the ELF auxv values to find the relocated binary.