This revision was automatically updated to reflect the committed changes. Closed by commit rG7b4792159cb7: [lldb] Reinvoke crashlog under lldb when run with -i from the command line (authored by JDevlieghere). Herald added a project: LLDB.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152319/new/ https://reviews.llvm.org/D152319 Files: lldb/examples/python/crashlog.py Index: lldb/examples/python/crashlog.py =================================================================== --- lldb/examples/python/crashlog.py +++ lldb/examples/python/crashlog.py @@ -1271,7 +1271,7 @@ pass def __call__(self, debugger, command, exe_ctx, result): - SymbolicateCrashLogs(debugger, shlex.split(command), result) + SymbolicateCrashLogs(debugger, shlex.split(command), result, True) def get_short_help(self): return "Symbolicate one or more darwin crash log files." @@ -1596,7 +1596,7 @@ return CreateSymbolicateCrashLogOptions("crashlog", description, True) -def SymbolicateCrashLogs(debugger, command_args, result): +def SymbolicateCrashLogs(debugger, command_args, result, is_command): option_parser = CrashLogOptionParser() if not len(command_args): @@ -1608,6 +1608,26 @@ except: return + # Interactive mode requires running the crashlog command from inside lldb. + if options.interactive and not is_command: + lldb_exec = ( + subprocess.check_output(["/usr/bin/xcrun", "-f", "lldb"]) + .decode("utf-8") + .strip() + ) + sys.exit( + os.execv( + lldb_exec, + [ + lldb_exec, + "-o", + "command script import lldb.macosx", + "-o", + "crashlog {}".format(shlex.join(command_args)), + ], + ) + ) + if options.version: print(debugger.GetVersionString()) return @@ -1659,7 +1679,7 @@ # Create a new debugger instance debugger = lldb.SBDebugger.Create() result = lldb.SBCommandReturnObject() - SymbolicateCrashLogs(debugger, sys.argv[1:], result) + SymbolicateCrashLogs(debugger, sys.argv[1:], result, False) lldb.SBDebugger.Destroy(debugger)
Index: lldb/examples/python/crashlog.py =================================================================== --- lldb/examples/python/crashlog.py +++ lldb/examples/python/crashlog.py @@ -1271,7 +1271,7 @@ pass def __call__(self, debugger, command, exe_ctx, result): - SymbolicateCrashLogs(debugger, shlex.split(command), result) + SymbolicateCrashLogs(debugger, shlex.split(command), result, True) def get_short_help(self): return "Symbolicate one or more darwin crash log files." @@ -1596,7 +1596,7 @@ return CreateSymbolicateCrashLogOptions("crashlog", description, True) -def SymbolicateCrashLogs(debugger, command_args, result): +def SymbolicateCrashLogs(debugger, command_args, result, is_command): option_parser = CrashLogOptionParser() if not len(command_args): @@ -1608,6 +1608,26 @@ except: return + # Interactive mode requires running the crashlog command from inside lldb. + if options.interactive and not is_command: + lldb_exec = ( + subprocess.check_output(["/usr/bin/xcrun", "-f", "lldb"]) + .decode("utf-8") + .strip() + ) + sys.exit( + os.execv( + lldb_exec, + [ + lldb_exec, + "-o", + "command script import lldb.macosx", + "-o", + "crashlog {}".format(shlex.join(command_args)), + ], + ) + ) + if options.version: print(debugger.GetVersionString()) return @@ -1659,7 +1679,7 @@ # Create a new debugger instance debugger = lldb.SBDebugger.Create() result = lldb.SBCommandReturnObject() - SymbolicateCrashLogs(debugger, sys.argv[1:], result) + SymbolicateCrashLogs(debugger, sys.argv[1:], result, False) lldb.SBDebugger.Destroy(debugger)
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits