[Lldb-commits] [PATCH] D108351: [lldb server] Tidy up LLDB server return codes and associated tests
Sebastian Schwartz via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 18 22:09:02 PDT 2021
saschwartz updated this revision to Diff 367397.
saschwartz added a comment.
Fix unannotated fallthrough in switch statement.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108351/new/
https://reviews.llvm.org/D108351
Files:
lldb/test/Shell/lldb-server/TestErrorMessages.test
lldb/tools/lldb-server/lldb-server.cpp
Index: lldb/tools/lldb-server/lldb-server.cpp
===================================================================
--- lldb/tools/lldb-server/lldb-server.cpp
+++ lldb/tools/lldb-server/lldb-server.cpp
@@ -52,29 +52,32 @@
llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
llvm::PrettyStackTraceProgram X(argc, argv);
- int option_error = 0;
const char *progname = argv[0];
if (argc < 2) {
display_usage(progname);
- exit(option_error);
+ exit(1);
}
+ int ret = 0;
switch (argv[1][0]) {
case 'g':
llgs::initialize();
- main_gdbserver(argc, argv);
+ ret = main_gdbserver(argc, argv);
llgs::terminate_debugger();
break;
case 'p':
llgs::initialize();
- main_platform(argc, argv);
+ ret = main_platform(argc, argv);
llgs::terminate_debugger();
break;
case 'v':
fprintf(stderr, "%s\n", lldb_private::GetVersion());
+ ret = 0;
break;
default:
display_usage(progname);
- exit(option_error);
+ ret = 1;
+ break;
}
+ return ret;
}
Index: lldb/test/Shell/lldb-server/TestErrorMessages.test
===================================================================
--- lldb/test/Shell/lldb-server/TestErrorMessages.test
+++ lldb/test/Shell/lldb-server/TestErrorMessages.test
@@ -1,13 +1,13 @@
-RUN: %lldb-server gdbserver --fd 2>&1 | FileCheck --check-prefixes=FD1,ALL %s
+RUN: not %lldb-server gdbserver --fd 2>&1 | FileCheck --check-prefixes=FD1,ALL %s
FD1: error: --fd: missing argument
-RUN: %lldb-server gdbserver --fd three 2>&1 | FileCheck --check-prefixes=FD2,ALL %s
+RUN: not %lldb-server gdbserver --fd three 2>&1 | FileCheck --check-prefixes=FD2,ALL %s
FD2: error: invalid '--fd' argument
-RUN: %lldb-server gdbserver --bogus 2>&1 | FileCheck --check-prefixes=BOGUS,ALL %s
+RUN: not %lldb-server gdbserver --bogus 2>&1 | FileCheck --check-prefixes=BOGUS,ALL %s
BOGUS: error: unknown argument '--bogus'
-RUN: %lldb-server gdbserver 2>&1 | FileCheck --check-prefixes=CONN,ALL %s
+RUN: not %lldb-server gdbserver 2>&1 | FileCheck --check-prefixes=CONN,ALL %s
CONN: error: no connection arguments
ALL: Use '{{.*}} g[dbserver] --help' for a complete list of options.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108351.367397.patch
Type: text/x-patch
Size: 2208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210819/39835f70/attachment-0001.bin>
More information about the lldb-commits
mailing list