[Lldb-commits] [PATCH] D152012: [lldb/crashlog] Expand crash report file path before parsing

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 6 10:59:00 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG3bc0baf9d439: [lldb/crashlog] Expand crash report file path before parsing (authored by mib).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152012/new/

https://reviews.llvm.org/D152012

Files:
  lldb/examples/python/crashlog.py


Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -1346,13 +1346,7 @@
             print(error)
 
 
-def load_crashlog_in_scripted_process(debugger, crash_log_file, options, result):
-    crashlog_path = os.path.expanduser(crash_log_file)
-    if not os.path.exists(crashlog_path):
-        raise InteractiveCrashLogException(
-            "crashlog file %s does not exist" % crashlog_path
-        )
-
+def load_crashlog_in_scripted_process(debugger, crashlog_path, options, result):
     crashlog = CrashLogParser.create(debugger, crashlog_path, False).parse()
 
     target = lldb.SBTarget()
@@ -1641,17 +1635,22 @@
     ci = debugger.GetCommandInterpreter()
 
     if args:
-        for crash_log_file in args:
+        for crashlog_file in args:
+            crashlog_path = os.path.expanduser(crashlog_file)
+            if not os.path.exists(crashlog_path):
+                raise FileNotFoundError(
+                    "crashlog file %s does not exist" % crashlog_path
+                )
             if should_run_in_interactive_mode(options, ci):
                 try:
                     load_crashlog_in_scripted_process(
-                        debugger, crash_log_file, options, result
+                        debugger, crashlog_path, options, result
                     )
                 except InteractiveCrashLogException as e:
                     result.SetError(str(e))
             else:
                 crash_log = CrashLogParser.create(
-                    debugger, crash_log_file, options.verbose
+                    debugger, crashlog_path, options.verbose
                 ).parse()
                 SymbolicateCrashLog(crash_log, options)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152012.528945.patch
Type: text/x-patch
Size: 1813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230606/e1f2c0a0/attachment.bin>


More information about the lldb-commits mailing list