[lldb/crashlog] Fix scripted_crashlog_json.test failure
authorMed Ismail Bennani <medismail.bennani@gmail.com>
Sat, 26 Feb 2022 00:31:46 +0000 (16:31 -0800)
committerMed Ismail Bennani <medismail.bennani@gmail.com>
Sat, 26 Feb 2022 01:20:35 +0000 (17:20 -0800)
commitbadb6e2730a970b5ee94f0adb77c2de741ebbf68
tree0c1170ceb0f5efde333301529eca3a55d292bd6d
parentcb1654ee4beedc875c25a95e7b98f1aaed0b9e35
[lldb/crashlog] Fix scripted_crashlog_json.test failure

This patch should fix the test failure on scripted_crashlog_json.test.

The failure is happening because crash reporter will obfuscate the
executable path in the crashlog, if it is located inside the user's
home directory and replace it with `/USER/*/` as a placeholder.

To fix that, we can patch the placeholder with the executable path
before loading the crashlog in lldb.

This also fixes a bug where we would create another target when loading
the crashlog in a scripted process, even if lldb already had a target
for it. Now, crashlog will only create a target if there is none in lldb.

Differential Revision: https://reviews.llvm.org/D120598

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
lldb/examples/python/crashlog.py
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips