This is an archive of the discontinued LLVM Phabricator instance.

[lldb/crashlog] Fix sticky image parsing logic
ClosedPublic

Authored by mib on Aug 3 2023, 3:07 PM.

Details

Summary

Prior to this patch, when a user loaded multiple crash report in lldb,
they could get in a situation where all the targets would keep the same
architecture and executable path as the first one that we've created.

The reason behind this was that even if we created a new CrashLog
object, which is derived from a Symbolicator class that has a newly
constructoted image list as a default argument, because that default
argument is only created once when the function is defined, every CrashLog
object would share the same list.

That will cause use to append newly parsed images to the same
Symbolicator image list accross multiple CrashLog objects.

To address this, this patch changes the default argument value for the
image parameter to None and only initialize it as an empty list when
no argument was passed.

This also removes the image list stored in each CrashLog parsers since
they shouldn't have any state and should be re-usable. So now, the only
source of truth is stored in the CrashLog object.

rdar://84984949

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>

Diff Detail

Event Timeline

mib created this revision.Aug 3 2023, 3:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2023, 3:07 PM
mib requested review of this revision.Aug 3 2023, 3:07 PM
bulbazord accepted this revision.Aug 3 2023, 4:30 PM

Python default parameter values strike again!

This revision is now accepted and ready to land.Aug 3 2023, 4:30 PM
JDevlieghere accepted this revision.Aug 4 2023, 11:14 AM

LGTM. The images list was added in D146765. Do you remember why we needed it there and why we don't anymore?

This revision was landed with ongoing or failed builds.Aug 12 2023, 12:00 AM
This revision was automatically updated to reflect the committed changes.