Skip to content

scripts: sof-crash-decode: support debug_stream.py exception format#11025

Open
jsarha wants to merge 1 commit into
thesofproject:mainfrom
jsarha:scripts-sof-crash-decode
Open

scripts: sof-crash-decode: support debug_stream.py exception format#11025
jsarha wants to merge 1 commit into
thesofproject:mainfrom
jsarha:scripts-sof-crash-decode

Conversation

@jsarha

@jsarha jsarha commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

The debug_stream.py tool outputs exception records in a format that differs from the QEMU format the decoder originally targeted:

  • Register values can be (nil) instead of 0x0, e.g. 'A4 (nil)'
  • Backtrace entries are on separate lines after 'Backtrace:' rather than all on a single line
  • Additional registers LCOUNT and THREADPTR are present

Update the parser to handle both formats:

  • Fix (nil) regex: the trailing word boundary anchor failed on the closing parenthesis; split hex and decimal into separate capture groups to avoid the issue
  • Parse backtrace entries across multiple lines after the Backtrace: header, stopping when a line contains non-backtrace content
  • Add LCOUNT and THREADPTR to the accepted register list

The existing single-line backtrace and QEMU register formats continue to work unchanged.

The debug_stream.py tool outputs exception records in a format that
differs from the QEMU format the decoder originally targeted:

 - Register values can be (nil) instead of 0x0, e.g. 'A4 (nil)'
 - Backtrace entries are on separate lines after 'Backtrace:' rather
   than all on a single line
 - Additional registers LCOUNT and THREADPTR are present

Update the parser to handle both formats:

 - Fix (nil) regex: the trailing word boundary anchor failed on the
   closing parenthesis; split hex and decimal into separate capture
   groups to avoid the issue
 - Parse backtrace entries across multiple lines after the Backtrace:
   header, stopping when a line contains non-backtrace content
 - Add LCOUNT and THREADPTR to the accepted register list

The existing single-line backtrace and QEMU register formats continue
to work unchanged.

Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Copilot AI review requested due to automatic review settings July 22, 2026 16:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates scripts/sof-crash-decode.py to parse crash logs produced by debug_stream.py in addition to the original QEMU-oriented format, including (nil) register values, multi-line backtraces, and additional registers.

Changes:

  • Extend accepted register whitelist to include LCOUNT and THREADPTR.
  • Update standard-format register regex to properly parse (nil) as zero and avoid word-boundary issues.
  • Expand backtrace parsing to support both single-line and multi-line Backtrace: formats.

Comment on lines +189 to +193
for match in bt_pattern.finditer(bt_rest):
# Stop if we hit a line that doesn't look like backtrace data
preceding = bt_rest[:match.start()]
# Allow only whitespace/newlines between entries
last_newline = preceding.rfind('\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants