Page MenuHomeFreeBSD

Improve panic/KASSERT: make source code location info non-optional
Needs ReviewPublic

Authored by sobomax on Mon, Sep 9, 7:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Sep 18, 8:01 AM
Unknown Object (File)
Fri, Sep 13, 2:13 AM
Unknown Object (File)
Fri, Sep 13, 2:13 AM
Unknown Object (File)
Fri, Sep 13, 2:05 AM
Unknown Object (File)
Thu, Sep 12, 3:36 PM
Unknown Object (File)
Tue, Sep 10, 7:07 PM
Unknown Object (File)
Tue, Sep 10, 5:17 PM
Unknown Object (File)
Tue, Sep 10, 2:25 PM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Our KASSERT / panic mechanism does not capture any location information by default, sometimes leaving user with a message that is ambiguous or hard to locate (i.e. KASSERT called from a macro etc). This patch aims at improving this situation by recording information about call site from which a particular KASSERT / panic originates and displaying this as part of the panic message.

Please note that there are some KASSERT-derived macros that try to capture that info still (which is after this would be somewhat redundant), I opted in to leave them as is just because I don't have a capacity/time to test such changes.

The overhead is 24 bytes (two pointers and int) per call site plus the size of the strings, but those are likely to be re-used by the compiler, so in practice it's about 48 bytes per call site on average. There are 15k call sites in GENERIC and about 24k in LINT.

Here the test panic screenshot:

VirtualBox_Sippy Install Test (node-9a4cb78c)_09_09_2024_09_21_52.png (768×1 px, 26 KB)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped