[Lldb-commits] [PATCH] D117165: [lldb] Add long help to `crashlog`
Dave Lee via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 12 17:25:12 PST 2022
kastiglione updated this revision to Diff 399517.
kastiglione added a comment.
refer to the debugger parameter, not lldb.debugger
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D117165/new/
https://reviews.llvm.org/D117165
Files:
lldb/examples/python/crashlog.py
Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -1003,11 +1003,16 @@
result.PutCString("error: invalid target")
-def Symbolicate(debugger, command, result, dict):
- try:
- SymbolicateCrashLogs(debugger, shlex.split(command))
- except Exception as e:
- result.PutCString("error: python exception: %s" % e)
+class Symbolicate:
+ def __call__(self, debugger, command, exe_ctx, result):
+ try:
+ SymbolicateCrashLogs(debugger, shlex.split(command))
+ except Exception as e:
+ result.PutCString("error: python exception: %s" % e)
+
+ def get_long_help(self):
+ option_parser = CrashLogOptionParser()
+ return option_parser.get_usage()
def SymbolicateCrashLog(crash_log, options):
@@ -1186,7 +1191,7 @@
return option_parser
-def SymbolicateCrashLogs(debugger, command_args):
+def CrashLogOptionParser():
description = '''Symbolicate one or more darwin crash log files to provide source file and line information,
inlined stack frames back to the concrete functions, and disassemble the location of the crash
for the first frame of the crashed thread.
@@ -1195,8 +1200,10 @@
created that has all of the shared libraries loaded at the load addresses found in the crash log file. This allows
you to explore the program as if it were stopped at the locations described in the crash log and functions can
be disassembled and lookups can be performed using the addresses found in the crash log.'''
- option_parser = CreateSymbolicateCrashLogOptions(
- 'crashlog', description, True)
+ return CreateSymbolicateCrashLogOptions('crashlog', description, True)
+
+def SymbolicateCrashLogs(debugger, command_args):
+ option_parser = CrashLogOptionParser()
try:
(options, args) = option_parser.parse_args(command_args)
except:
@@ -1219,13 +1226,15 @@
for crash_log_file in args:
crash_log = CrashLogParser().parse(debugger, crash_log_file, options.verbose)
SymbolicateCrashLog(crash_log, options)
+
if __name__ == '__main__':
# Create a new debugger instance
debugger = lldb.SBDebugger.Create()
SymbolicateCrashLogs(debugger, sys.argv[1:])
lldb.SBDebugger.Destroy(debugger)
-elif getattr(lldb, 'debugger', None):
- lldb.debugger.HandleCommand(
- 'command script add -f lldb.macosx.crashlog.Symbolicate crashlog')
- lldb.debugger.HandleCommand(
+
+def __lldb_init_module(debugger, internal_dict):
+ debugger.HandleCommand(
+ 'command script add -c lldb.macosx.crashlog.Symbolicate crashlog')
+ debugger.HandleCommand(
'command script add -f lldb.macosx.crashlog.save_crashlog save_crashlog')
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117165.399517.patch
Type: text/x-patch
Size: 2860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220113/54eb8dd5/attachment-0001.bin>
More information about the lldb-commits
mailing list