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.
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.
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits