From a72b0bcd7fd4baed9952beefc6398b3d79c789d9 Mon Sep 17 00:00:00 2001 From: jhb Date: Wed, 12 Jul 2006 21:22:44 +0000 Subject: Simplify the pager support in DDB. Allowing different db commands to install custom pager functions didn't actually happen in practice (they all just used the simple pager and passed in a local quit pointer). So, just hardcode the simple pager as the only pager and make it set a global db_pager_quit flag that db commands can check when the user hits 'q' (or a suitable variant) at the pager prompt. Also, now that it's easy to do so, enable paging by default for all ddb commands. Any command that wishes to honor the quit flag can do so by checking db_pager_quit. Note that the pager can also be effectively disabled by setting $lines to 0. Other fixes: - 'show idt' on i386 and pc98 now actually checks the quit flag and terminates early. - 'show intr' now actually checks the quit flag and terminates early. --- sys/kern/kern_ktr.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'sys/kern/kern_ktr.c') diff --git a/sys/kern/kern_ktr.c b/sys/kern/kern_ktr.c index 7ae5582..f12f971 100644 --- a/sys/kern/kern_ktr.c +++ b/sys/kern/kern_ktr.c @@ -55,8 +55,10 @@ __FBSDID("$FreeBSD$"); #include #endif - +#ifdef DDB #include +#include +#endif #ifndef KTR_ENTRIES #define KTR_ENTRIES 1024 @@ -288,22 +290,17 @@ static int db_mach_vtrace(void); DB_SHOW_COMMAND(ktr, db_ktr_all) { - int quit; - quit = 0; tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1); tstate.first = -1; - if (strcmp(modif, "v") == 0) - db_ktr_verbose = 1; - else - db_ktr_verbose = 0; - if (strcmp(modif, "a") == 0) { + db_ktr_verbose = index(modif, 'v') != NULL; + if (index(modif, 'a') != NULL) { + db_disable_pager(); while (cncheckc() != -1) if (db_mach_vtrace() == 0) break; } else { - db_setup_paging(db_simple_pager, &quit, db_lines_per_page); - while (!quit) + while (!db_pager_quit) if (db_mach_vtrace() == 0) break; } -- cgit v1.1