From 4c0200b9e8504a2303980359a3736d871f3a8949 Mon Sep 17 00:00:00 2001 From: John Marino Date: Tue, 15 May 2012 23:50:11 +0200 Subject: [PATCH] kgdb: Add TUI mode as an option Now that -tui mode is fixed for gdb, let's allow kgdb to use it. This commit adds the -t (--tui-mode) option to kgdb to allow debugging core files with gdb's Text User Interface terminal interface. The -q (--quiet) option had to set when --tui-mode option is set due to the initial verbosity destroying the curses window otherwise. --- gnu/usr.bin/gdb/kgdb/kgdb.1 | 10 +++++++++- gnu/usr.bin/gdb/kgdb/kgdb.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gnu/usr.bin/gdb/kgdb/kgdb.1 b/gnu/usr.bin/gdb/kgdb/kgdb.1 index 4165dd3..53c0f87 100644 --- a/gnu/usr.bin/gdb/kgdb/kgdb.1 +++ b/gnu/usr.bin/gdb/kgdb/kgdb.1 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD: src/gnu/usr.bin/gdb/kgdb/kgdb.1,v 1.10 2006/10/21 17:39:35 ru Exp $ .\" -.Dd October 11, 2006 +.Dd May 15, 2012 .Os .Dt KGDB 1 .Sh NAME @@ -34,6 +34,7 @@ .Nm .Op Fl a | Fl f | Fl fullname .Op Fl q | Fl quiet +.Op Fl t | Fl tui-mode .Op Fl v .Op Fl w .Op Fl d Ar crashdir @@ -67,6 +68,13 @@ Suppress printing of the banner when the debugger starts. The .Fl quiet form is supported for compatibility as well. +.It Fl t +Activate the Text User Interface (TUI). The +.Fl tui-mode +shows the source file, assembly output, program registers and +gdb commands in separate text windows. It implicitly sets the +.Fl quiet +option as well. .It Fl v Increase verbosity. .It Fl w diff --git a/gnu/usr.bin/gdb/kgdb/kgdb.c b/gnu/usr.bin/gdb/kgdb/kgdb.c index 177ab61..48fa27a 100644 --- a/gnu/usr.bin/gdb/kgdb/kgdb.c +++ b/gnu/usr.bin/gdb/kgdb/kgdb.c @@ -83,7 +83,7 @@ usage(void) { fprintf(stderr, - "usage: %s [-afqv] [-d crashdir] [-c core | -n dumpnr | -r device]\n" + "usage: %s [-afqtv] [-d crashdir] [-c core | -n dumpnr | -r device]\n" "\t[kernel [core]]\n", getprogname()); exit(1); } @@ -326,6 +326,8 @@ main(int argc, char *argv[]) argv[a] = "-q"; else if (strcmp(s, "fullname") == 0) argv[a] = "-f"; + else if (strcmp(s, "tui-mode") == 0) + argv[a] = "-t"; } } @@ -337,7 +339,7 @@ main(int argc, char *argv[]) args.argv[0] = argv[0]; add_arg(&args, "--kernel"); - while ((ch = getopt(argc, argv, "ac:d:fn:qr:vw")) != -1) { + while ((ch = getopt(argc, argv, "ac:d:fn:qr:tvw")) != -1) { switch (ch) { case 'a': annotation_level++; @@ -379,6 +381,12 @@ main(int argc, char *argv[]) } remote = strdup(optarg); break; + case 't': + args.interpreter_p = INTERP_TUI; + add_arg(&args, "-tui"); + quiet = 1; + add_arg(&args, "-q"); + break; case 'v': /* increase verbosity. */ verbose++; break; -- 1.7.7.2