This is an archive of the discontinued LLVM Phabricator instance.

[lldb/crashlog] Remove 'process_path' parsing logic
ClosedPublic

Authored by mib on Aug 2 2022, 4:45 PM.

Details

Summary

In can happen when creating stackshot crash report that that key is missing.

Moreover, we try to parse that key but don't use it, or need it, since we
fetch images and symbolicate the stackframes using the binaries UUIDs.

This is why this patch removes everything that is related to the
process_path/procPath parsing.

rdar://95054188

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

Diff Detail

Event Timeline

mib created this revision.Aug 2 2022, 4:45 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2022, 4:45 PM
mib requested review of this revision.Aug 2 2022, 4:45 PM

Could we test this by removing the key from an existing testcase?

lldb/examples/python/crashlog.py
474

Is it now undefined if it doesn't exist? Does that cause an exception when we try to access it?
Is there anything special about procPath, or should all the JSON keys be optional like this?
i.e., is there a json_data.readOrDefault(key, default_value) method?

kastiglione added inline comments.
lldb/examples/python/crashlog.py
473–474

another way of doing this is:

self.crashlog.process_path = json_data.get('procPath')

get() returns None if the key doesn't exist.

mib marked an inline comment as done.Aug 3 2022, 2:58 PM
mib added inline comments.
lldb/examples/python/crashlog.py
474

process_path is actually not used in crashlog.py at all. Since it can be missing in some crash reports, we need to parse it only when it's available, otherwise we get the following error which causes the crashlog script to stop:

error: python exception: Failed to parse JSON crashlog: KeyError: 'procPath'
mib updated this revision to Diff 449809.Aug 3 2022, 3:41 PM
mib marked an inline comment as done.

Remove procPath key from crash report for testing

JDevlieghere added inline comments.Aug 3 2022, 4:04 PM
lldb/examples/python/crashlog.py
474

If it's not used, should we just remove it altogether?

mib added inline comments.Aug 3 2022, 4:23 PM
lldb/examples/python/crashlog.py
474

Sure! Since we symbolicate the crashlogs by fetching the used binaries UUIDs, I think it's reasonable to get rid of everything related the procPath

mib updated this revision to Diff 449830.Aug 3 2022, 4:44 PM
mib retitled this revision from [lldb/crashlog] Fix parsing issue with `procPath` to [lldb/crashlog] Remove 'process_path' parsing logic.
mib edited the summary of this revision. (Show Details)

Remove the process_path parsing logic

JDevlieghere accepted this revision.Aug 3 2022, 9:03 PM

Ship it

This revision is now accepted and ready to land.Aug 3 2022, 9:03 PM
This revision was automatically updated to reflect the committed changes.