This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Fix process pid parsing issue
ClosedPublic

Authored by mib on May 19 2023, 3:19 PM.

Details

Summary

This patch should fix an issue when parsing the process pid and setting
it in the scripted process.

It can happen that the crashlog.process_id attribute is sometimes
parsed as a string. That would cause the scripted process to pick the
default value (0).

To address that, this patch makes sure that the parsed attributed is
converted to the integer type before passing it to the scripted process.

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

Diff Detail

Event Timeline

mib created this revision.May 19 2023, 3:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2023, 3:19 PM
mib requested review of this revision.May 19 2023, 3:19 PM

You probably encountered this somewhere, is there a simple test we could add here? The change looks fine to me nonetheless.

mib added a comment.May 19 2023, 3:52 PM

You probably encountered this somewhere, is there a simple test we could add here? The change looks fine to me nonetheless.

This is specific to interactive scripted process and the only test requires Apple Silicon: https://github.com/llvm/llvm-project/blob/main/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/scripted_crashlog_json.test#L1 so Green Dragon didn't caught this issue.

You should be able to repro by running ninja check-lldb-shell on Apple Silicon.

bulbazord accepted this revision.May 19 2023, 3:53 PM
This revision is now accepted and ready to land.May 19 2023, 3:53 PM
This revision was automatically updated to reflect the committed changes.