diff options
author | Med Ismail Bennani <medismail.bennani@gmail.com> | 2022-02-25 16:31:46 -0800 |
---|---|---|
committer | Med Ismail Bennani <medismail.bennani@gmail.com> | 2022-02-25 17:20:35 -0800 |
commit | badb6e2730a970b5ee94f0adb77c2de741ebbf68 (patch) | |
tree | 0c1170ceb0f5efde333301529eca3a55d292bd6d /lldb/examples/python/crashlog.py | |
parent | cb1654ee4beedc875c25a95e7b98f1aaed0b9e35 (diff) | |
download | llvm-badb6e2730a970b5ee94f0adb77c2de741ebbf68.zip llvm-badb6e2730a970b5ee94f0adb77c2de741ebbf68.tar.gz llvm-badb6e2730a970b5ee94f0adb77c2de741ebbf68.tar.bz2 |
[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>
Diffstat (limited to 'lldb/examples/python/crashlog.py')
-rwxr-xr-x | lldb/examples/python/crashlog.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 8c20fa7..9a669b5 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -989,7 +989,10 @@ def load_crashlog_in_scripted_process(debugger, crash_log_file): result.PutCString("error: python exception: %s" % e) return - target = crashlog.create_target() + if debugger.GetNumTargets() > 0: + target = debugger.GetTargetAtIndex(0) + else: + target = crashlog.create_target() if not target: result.PutCString("error: couldn't create target") return |