[Lldb-commits] [lldb] badb6e2 - [lldb/crashlog] Fix scripted_crashlog_json.test failure
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 25 17:21:04 PST 2022
Author: Med Ismail Bennani
Date: 2022-02-25T17:20:35-08:00
New Revision: badb6e2730a970b5ee94f0adb77c2de741ebbf68
URL: https://github.com/llvm/llvm-project/commit/badb6e2730a970b5ee94f0adb77c2de741ebbf68
DIFF: https://github.com/llvm/llvm-project/commit/badb6e2730a970b5ee94f0adb77c2de741ebbf68.diff
LOG: [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 at gmail.com>
Added:
Modified:
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
Removed:
################################################################################
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 8c20fa71d3e2a..9a669b50d2523 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
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
index af72bba8c6d7c..cc2f16c016147 100644
--- a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/a.out.ips
@@ -21,8 +21,8 @@
"incident" : "FA21DF23-3344-4E45-BF27-4B8E63B7012B",
"pid" : 72932,
"cpuType" : "X86-64",
- "procName" : "json.test.tmp.out",
- "procPath" : "\/Users\/USER\/*\/json.test.tmp.out",
+ "procName" : "@NAME@",
+ "procPath" : "@EXEC@",
"parentProc" : "fish",
"parentPid" : 67002,
"coalitionName" : "io.alacritty",
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
index 02dbbb51f4a66..5abbc80493355 100644
--- a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/Inputs/scripted_crashlog.ips
@@ -21,8 +21,8 @@
"procExitAbsTime" : 6478056175721,
"translated" : false,
"cpuType" : "ARM-64",
- "procName" : "scripted_crashlog_json.test.tmp.out",
- "procPath" : "\/Users\/USER\/*\/scripted_crashlog_json.test.tmp.out",
+ "procName" : "@NAME@",
+ "procPath" : "@EXEC@",
"parentProc" : "zsh",
"parentPid" : 82132,
"coalitionName" : "com.apple.Terminal",
@@ -47,8 +47,9 @@
"base" : 4372692992,
"size" : 16384,
"uuid" : "b928ee77-9429-334f-ac88-41440bb3d4c7",
- "path" : "\/Users\/USER\/*\/scripted_crashlog_json.test.tmp.out",
- "name" : "scripted_crashlog_json.test.tmp.out"
+ "uuid" : "@UUID@",
+ "path" : "@EXEC@",
+ "name" : "@NAME@"
},
{
"source" : "P",
More information about the lldb-commits
mailing list