[Lldb-commits] [PATCH] D127362: [lldb/crashlog] Show help when the command is called without any argument

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 10 13:47:45 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG5a9fa21ce82f: [lldb/crashlog] Show help when the command is called without any argument (authored by mib).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127362

Files:
  lldb/examples/python/crashlog.py
  lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no-args.test


Index: lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no-args.test
===================================================================
--- /dev/null
+++ lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no-args.test
@@ -0,0 +1,9 @@
+# RUN: %lldb -o 'command script import lldb.macosx.crashlog' -o 'crashlog' 2>&1 | FileCheck %s
+
+# CHECK: "crashlog" {{.*}} commands have been installed, use the "--help" options on these commands
+
+# CHECK: Usage: crashlog [options] <FILE> [FILE ...]
+# CHECK: Symbolicate one or more darwin crash log files to provide source file and line
+# CHECK: Options:
+# CHECK:  -h, --help            show this help message and exit
+
Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -1199,6 +1199,11 @@
 
 def SymbolicateCrashLogs(debugger, command_args):
     option_parser = CrashLogOptionParser()
+
+    if not len(command_args):
+        option_parser.print_help()
+        return
+
     try:
         (options, args) = option_parser.parse_args(command_args)
     except:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127362.436037.patch
Type: text/x-patch
Size: 1143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220610/527544b8/attachment.bin>


More information about the lldb-commits mailing list