oxidecomputer / humility

Debugger for Hubris
Mozilla Public License 2.0
529 stars 51 forks source link

diagnose: support newer kernels #484

Closed hawkw closed 6 months ago

hawkw commented 6 months ago

Currently, the humility diagnose command contains its own code for looking up the task table. This code only uses the TASK_TABLE_BASE symbol used by older kernels, and does not look for the TASK_TABLE_SPACE symbol used by newer kernels. This means that on a recent kernel, the diagnose command will fail:

$ humility -t gimletlet diagnose
humility: attached to 0483:3754:000B00154D46501520383832 via ST-Link V3

--- Initial Inspection ---

Taking initial snapshot of task status...
humility diagnose failed: expected symbol TASK_TABLE_BASE not found

This commit changes humility diagnose to use the HubrisArchive::task_table method to look up the task table, instead. Unlike the previous code, this method will look for both the TASK_TABLE_BASE and TASK_TABLE_SIZE symbols of older kernels, and the TASK_TABLE_SPACE symbol of newer kernels. Now, it works for my recent Hubris build:

$ humility -t gimletlet diagnose
humility: attached to 0483:3754:000B00154D46501520383832 via ST-Link V3

--- Initial Inspection ---

Taking initial snapshot of task status...
System last rebooted 791183 ticks ago; assuming tick=millisecond, 791.183s ago
Snapshot taken, 25 tasks in application.

--- Tasks: First Pass ---

Checking for any suspicious task attributes...

--- Advancing Time ---

Resuming core for a bit...
Core halted after 1001 more ticks.

--- Tasks: Second Pass ---

--- Generating Coredump ---

humility: dumping to hubris.core.0
humility: dumped 731.46KB in 29 seconds
Leaving CPU halted in case you want to inspect.

--- End Of Report ---

Fixes #483