From d810912cf5ce2157c59a7aa86db3c19b124a95a7 Mon Sep 17 00:00:00 2001 From: marcel Date: Wed, 2 Mar 2005 18:40:04 +0000 Subject: Implement and document the -q and -f options with their corresponding long form (-quiet and -fullname resp.) Bump documentation date. PR: bin/78031 MFC after: 5 days --- gnu/usr.bin/gdb/kgdb/kgdb.1 | 15 +++++++++++++-- gnu/usr.bin/gdb/kgdb/main.c | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) (limited to 'gnu') diff --git a/gnu/usr.bin/gdb/kgdb/kgdb.1 b/gnu/usr.bin/gdb/kgdb/kgdb.1 index 1b7ffba..4689525 100644 --- a/gnu/usr.bin/gdb/kgdb/kgdb.1 +++ b/gnu/usr.bin/gdb/kgdb/kgdb.1 @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd August 1, 2004 +.Dd March 2, 2005 .Os .Dt KGDB 1 .Sh NAME @@ -31,7 +31,8 @@ .Nd "kernel debugger" .Sh SYNOPSIS .Nm -.Op Fl a +.Op Fl a | Fl f | Fl fullname +.Op Fl q | Fl quiet .Op Fl v .Op Fl d Ar crashdir .Op Fl c Ar core | Fl n Ar dumpnr | Fl r Ar device @@ -54,6 +55,16 @@ option of This is useful when running .Nm in Emacs. +The +.Fl f +or +.Fl fullname +options are supported for backward compatibility as well. +.It Fl q +Suppress printing of the banner when the debugger starts. +The +.Fl quiet +form is supported for compatibility as well. .It Fl v Increase verbosity. .It Fl d Ar crashdir diff --git a/gnu/usr.bin/gdb/kgdb/main.c b/gnu/usr.bin/gdb/kgdb/main.c index 3ad158b..7ae2b9e 100644 --- a/gnu/usr.bin/gdb/kgdb/main.c +++ b/gnu/usr.bin/gdb/kgdb/main.c @@ -82,7 +82,7 @@ usage(void) { fprintf(stderr, - "usage: %s [-a] [-v] [-d crashdir] [-c core | -n dumpnr | -r device]\n" + "usage: %s [-afqv] [-d crashdir] [-c core | -n dumpnr | -r device]\n" "\t[kernel [core]]\n", getprogname()); exit(1); } @@ -243,7 +243,7 @@ main(int argc, char *argv[]) struct stat st; struct captured_main_args args; char *s; - int ch; + int a, ch, quiet; dumpnr = -1; @@ -252,7 +252,24 @@ main(int argc, char *argv[]) if (s != NULL) strlcpy(crashdir, s, sizeof(crashdir)); - while ((ch = getopt(argc, argv, "ac:d:n:r:v")) != -1) { + /* Convert long options into short options. */ + for (a = 1; a < argc; a++) { + s = argv[a]; + if (s[0] == '-') { + s++; + /* Long options take either 1 or 2 dashes. */ + if (s[0] == '-') + s++; + if (strcmp(s, "quiet") == 0) + argv[a] = "-q"; + else if (strcmp(s, "fullname") == 0) + argv[a] = "-f"; + } + } + + quiet = 0; + + while ((ch = getopt(argc, argv, "ac:d:fn:qr:v")) != -1) { switch (ch) { case 'a': annotation_level++; @@ -269,6 +286,9 @@ main(int argc, char *argv[]) case 'd': /* lookup dumps in given directory. */ strlcpy(crashdir, optarg, sizeof(crashdir)); break; + case 'f': + annotation_level = 1; + break; case 'n': /* use dump with given number. */ dumpnr = strtol(optarg, &s, 0); if (dumpnr < 0 || *s != '\0') { @@ -278,6 +298,9 @@ main(int argc, char *argv[]) /* NOTREACHED */ } break; + case 'q': + quiet = 1; + break; case 'r': /* use given device for remote session. */ if (remote != NULL) { warnx("option %c: can only be specified once", @@ -390,9 +413,15 @@ main(int argc, char *argv[]) kgdb_thr_init(); } + /* The libgdb code uses optind too. Reset it... */ + optind = 0; + memset (&args, 0, sizeof args); - args.argc = 1; args.argv = argv; + args.argc = 1 + quiet; + if (quiet) + argv[1] = "-q"; + argv[args.argc] = NULL; args.use_windows = 0; args.interpreter_p = "kgdb"; -- cgit v1.1