[Lldb-commits] [lldb] update lldb-server platform help parsing (PR #162730)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 9 14:59:34 PDT 2025
================
@@ -371,107 +424,107 @@ int main_platform(int argc, char *argv[]) {
signal(SIGPIPE, SIG_IGN);
signal(SIGHUP, signal_handler);
#endif
- int long_option_index = 0;
+
+ // Special handling for 'help' as first argument
+ if (argc > 0 && strcmp(argv[0], "help") == 0) {
+ LLPlatformOptTable Opts;
+ display_usage(Opts, progname, subcommand);
+ return 0;
+ }
+
Status error;
std::string listen_host_port;
- int ch;
-
std::string log_file;
- StringRef
- log_channels; // e.g. "lldb process threads:gdb-remote default:linux all"
-
+ StringRef log_channels;
shared_fd_t fd = SharedSocket::kInvalidFD;
-
uint16_t gdbserver_port = 0;
-
FileSpec socket_file;
- bool show_usage = false;
- int option_error = 0;
-
- std::string short_options(OptionParser::GetShortOptionString(g_long_options));
-
-#if __GLIBC__
- optind = 0;
-#else
- optreset = 1;
- optind = 1;
-#endif
-
- while ((ch = getopt_long_only(argc, argv, short_options.c_str(),
- g_long_options, &long_option_index)) != -1) {
- switch (ch) {
- case 0: // Any optional that auto set themselves will return 0
- break;
-
- case 'L':
- listen_host_port.append(optarg);
- break;
+ bool multi_client = false;
+ [[maybe_unused]] bool debug = false;
+ [[maybe_unused]] bool verbose = false;
+
+ LLPlatformOptTable Opts;
+ llvm::BumpPtrAllocator Alloc;
+ llvm::StringSaver Saver(Alloc);
----------------
JDevlieghere wrote:
I know we're not super consistent (e.g. in the driver) but let's try to stick to LLDB's coding style.
https://github.com/llvm/llvm-project/pull/162730
More information about the lldb-commits
mailing list