From 267749aeb02ae0bcd040d45cf4157462e571d96b Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 9 Dec 2024 12:22:16 -0700 Subject: [PATCH] Add text to gdbreplay --help output I noticed that gdbreplay --help is rather sparse -- it doesn't even mention the names of the options it accepts. This patch updates the help output to be more complete. Approved-By: Andrew Burgess --- gdbserver/gdbreplay.cc | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/gdbserver/gdbreplay.cc b/gdbserver/gdbreplay.cc index 951f50ea54e..5c7821aa3a6 100644 --- a/gdbserver/gdbreplay.cc +++ b/gdbserver/gdbreplay.cc @@ -474,8 +474,29 @@ static void gdbreplay_usage (FILE *stream) { fprintf (stream, "Usage:\tgdbreplay LOGFILE HOST:PORT\n"); - if (REPORT_BUGS_TO[0] && stream == stdout) - fprintf (stream, "Report bugs to \"%s\".\n", REPORT_BUGS_TO); +} + +static void +gdbreplay_help () +{ + gdbreplay_usage (stdout); + + printf ("\n"); + printf ("LOGFILE is a file generated by 'set remotelogfile' in gdb.\n"); + printf ("COMM may either be a tty device (for serial debugging),\n"); + printf ("HOST:PORT to listen for a TCP connection, or '-' or 'stdio' to use\n"); + printf ("stdin/stdout of gdbserver.\n"); + printf ("\n"); + + printf ("Options:\n\n"); + printf (" --debug-logging Show packets as they are processed.\n"); + printf (" --help Print this message and then exit.\n"); + printf (" --version Display version information and then exit.\n"); + if (REPORT_BUGS_TO[0]) + { + printf ("\n"); + printf ("Report bugs to \"%s\".\n", REPORT_BUGS_TO); + } } /* Main function. This is called by the real "main" function, @@ -503,11 +524,16 @@ captured_main (int argc, char *argv[]) gdbreplay_version (); exit (0); case OPT_HELP: - gdbreplay_usage (stdout); + gdbreplay_help (); exit (0); case OPT_LOGGING: debug_logging = true; break; + + case '?': + fprintf (stderr, + "Use 'gdbreplay --help' for a complete list of options.\n"); + exit (1); } } -- 2.47.3