This is an archive of the discontinued LLVM Phabricator instance.

[lldb/crashlog] Fix exception signal parsing
ClosedPublic

Authored by mib on Feb 10 2022, 5:08 PM.

Details

Summary

In some cases, it can happen that crashlogs don't have any signal in
the exception, which causes the parser to crash.

This fixes the parsing by checking if the signal field is in the
exception dictionary before trying to access it.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib requested review of this revision.Feb 10 2022, 5:08 PM
mib created this revision.
JDevlieghere added inline comments.Feb 10 2022, 9:54 PM
lldb/examples/python/crashlog.py
471

Should this be surrounded by spaces?

mib added inline comments.Feb 10 2022, 10:09 PM
lldb/examples/python/crashlog.py
476

@JDevlieghere Here it's only prepended by a space, which is honored in my change since I concatenate "({})".format(json_exception['signal']) to exception_signal (which is initialized with a space).

I don't think this should have a trailing space because it's not guaranteed that we get something in exception_extra.

JDevlieghere accepted this revision.Feb 11 2022, 12:39 PM

LGTM

lldb/examples/python/crashlog.py
476

Thanks, I missed the + in +=, I thought it was just an assignment.

This revision is now accepted and ready to land.Feb 11 2022, 12:39 PM
mib marked 2 inline comments as done.Feb 11 2022, 5:56 PM
mib edited the summary of this revision. (Show Details)Feb 11 2022, 6:12 PM
This revision was automatically updated to reflect the committed changes.