- Improve fallback handling for the read of pcb_size.
If for some reason kgdb has only the kernel's debug info, a read of pcb_size will simply return 0, resulting in an exception when unwinding the stack of a thread that was on a CPU at the time the dump was created. In this case, fall back to using sizeof(struct pcb). - Always supply a value for the PC register on x86.
A thread's PCB may have been swapped out, and a dummy value ensures that we don't get an exception while enumerating threads in a dump. - Mark all 64-bit address bits as valid for aarch64 kernels.
ARMv8 supports pointer tagging in which case the upper 8 bits of VAs are ignored, but FreeBSD kernels are linked such that they depend on those upper 8 bits being set to 1. GDB was stripping those bits by default causing KVAs to be mapped to invalid addresses. - Rework kgdb -w support to only open /dev/mem writable.
Don't depend on the gdb global 'write_files' option which tries to rewrite the kernel binary on close which can crash. Instead, add an optional '-w' flag to 'target vmcore' which opens the vmcore with O_RDWR instead of O_RDONLY. Change the kgdb '-w' option to set this flag in the nested 'target vmcore' command rather than passing the global '-w' option to gdb. - Garbage collect old code for reading dumptid.
- First cut at FreeBSD/arm kernel support.
Tested on live kernel on my RPi, but not against a crashdump, and only trapframes from userland, not a nested trap.
Submitted by: markj (1, 2)