Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/ntfc/device/nuttx.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ class DeviceNuttx(OSCommon):
b"up_dump_register",
b"dump_tasks",
],
# kernel-mode (CONFIG_BUILD_KERNEL) user task faults: the kernel
# kills the offending task and keeps running, so the console
# message is the only crash evidence
CrashType.SEGFAULT: [
b"Segmentation fault in",
b"PANIC: Unhandled user exception",
],
}
_PANIC_CHAR = r"/"

Expand Down
16 changes: 16 additions & 0 deletions tests/device/test_nuttx.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ def test_device_nuttx_init():
assert CrashType.ASSERTION in sigs
assert all(isinstance(v, list) for v in sigs.values())

# kernel-mode user task faults kill only the task; the console
# message is the only crash evidence
assert CrashType.SEGFAULT in sigs
assert b"Segmentation fault in" in sigs[CrashType.SEGFAULT]
assert b"PANIC: Unhandled user exception" in sigs[CrashType.SEGFAULT]

# real rv-virt knsh64 console output is classified as SEGFAULT
from ntfc.device.state import DeviceStateManager

mgr = DeviceStateManager(crash_signatures=sigs)
line = (
b"[ 2.966000] riscv_fault_handler: "
b"Segmentation fault in getprime (PID 4: getprime)"
)
assert mgr._detect_crash_type(line) is CrashType.SEGFAULT

config.kv_check.return_value = 0
assert d.panic_char == ""
config.kv_check.return_value = 1
Expand Down