[Lldb-commits] [lldb] 5a9fa21 - [lldb/crashlog] Show help when the command is called without any argument
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Fri Jun 10 13:47:31 PDT 2022
Author: Med Ismail Bennani
Date: 2022-06-10T13:44:43-07:00
New Revision: 5a9fa21ce82fc04d77d52eb1255dd3cf0292d573
URL: https://github.com/llvm/llvm-project/commit/5a9fa21ce82fc04d77d52eb1255dd3cf0292d573
DIFF: https://github.com/llvm/llvm-project/commit/5a9fa21ce82fc04d77d52eb1255dd3cf0292d573.diff
LOG: [lldb/crashlog] Show help when the command is called without any argument
This patch changes the `crashlog` command behavior to print the help
message if no argument was provided with the command.
rdar://94576026
Differential Revision: https://reviews.llvm.org/D127362
Signed-off-by: Med Ismail Bennani <medismail.bennani at gmail.com>
Added:
lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no-args.test
Modified:
lldb/examples/python/crashlog.py
Removed:
################################################################################
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index b2145762d7a8f..c30a0ec0a1e83 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -1199,6 +1199,11 @@ def CrashLogOptionParser():
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:
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no-args.test b/lldb/test/Shell/ScriptInterpreter/Python/Crashlog/no-args.test
new file mode 100644
index 0000000000000..d35e62391af8d
--- /dev/null
+++ b/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
+
More information about the lldb-commits
mailing list