This repository has been archived by the owner on Jan 30, 2024. It is now read-only.
[PoC] spawn a GDB server on panics and hardfaults #315
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
when the
--gdb
flag is passed,probe-run
will spawn a GDB server whenthe program panics or encounters a hardware fault (HardFault)
a GDB client can then connect to inspect the failure
blockers
gdbstub
instead. another advantage of usinggdbstub
is that we could forbid operations likefinish
,step
andnext
which don't make sense in postmortem context as it's no longer possible to continue executing the programopen questions
backtrace
. however, it's still possible to read CPU registers though it may be hard to map these back to meaningful variables as theframe
command won't work in this context (see code block below)alternative / possible extension
gdb-server
is that its API is hard-coded to usestd::sync::Mutex
which is not guaranteed to be a fair mutex on all platforms. the defmt logs are collected in a tight loop, via RTT, and that loop also needs to access the mutex thatgdb-server
uses. the like outcome is that the RTT loop "hogs" the mutex and starves thegdb-server
thread. agdbstub
implementation that uses a fair mutex (e.g.parking_lot::FairMutex
) would not run into such problem