From: Ben Gras Date: Thu, 22 Sep 2005 12:21:26 +0000 (+0000) Subject: Added Shift+F5 debug dump - show debug dumps. X-Git-Tag: v3.1.0~35 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=6a44098b96ec70a58ec3357c1c9d4368366cc34a;p=minix.git Added Shift+F5 debug dump - show debug dumps. --- diff --git a/servers/is/dmp.c b/servers/is/dmp.c index 15d57d250..8f4ecaa28 100644 --- a/servers/is/dmp.c +++ b/servers/is/dmp.c @@ -9,6 +9,30 @@ #include "is.h" +#define NHOOKS 15 + +struct hook_entry { + int key; + void (*function)(void); + char *name; +} hooks[NHOOKS] = { + { F1, proctab_dmp, "Kernel process table" }, + { F2, memmap_dmp, "Process memory maps" }, + { F3, image_dmp, "System image" }, + { F4, privileges_dmp, "Process privileges" }, + { F5, monparams_dmp, "Boot monitor parameters" }, + { F6, irqtab_dmp, "IRQ hooks and policies" }, + { F7, kmessages_dmp, "Kernel messages" }, + { F10, kenv_dmp, "Kernel parameters" }, + { F11, timing_dmp, "Timing details (if enabled)" }, + { F12, sched_dmp, "Scheduling queues" }, + { SF1, mproc_dmp, "Process manager process table" }, + { SF2, sigaction_dmp, "Signals" }, + { SF3, fproc_dmp, "Filesystem process table" }, + { SF4, dtab_dmp, "Device/Driver mapping" }, + { SF5, mapping_dmp, "Print key mappings" }, +}; + /*===========================================================================* * handle_fkey * *===========================================================================*/ @@ -17,7 +41,7 @@ PUBLIC int do_fkey_pressed(message *m) { - int s; + int s, h; /* The notification message does not convey any information, other * than that some function keys have been pressed. Ask TTY for details. @@ -28,26 +52,41 @@ PUBLIC int do_fkey_pressed(message *m) report("IS", "warning, sendrec to TTY failed", s); /* Now check which keys were pressed: F1-F12. */ - if (pressed(F1)) proctab_dmp(); - if (pressed(F2)) memmap_dmp(); - if (pressed(F3)) image_dmp(); - if (pressed(F4)) privileges_dmp(); - if (pressed(F5)) monparams_dmp(); - if (pressed(F6)) irqtab_dmp(); - if (pressed(F7)) kmessages_dmp(); + for(h = 0; h < NHOOKS; h++) + if(pressed(hooks[h].key)) + hooks[h].function(); - if (pressed(F10)) kenv_dmp(); - if (pressed(F11)) timing_dmp(); - if (pressed(F12)) sched_dmp(); + /* Inhibit sending a reply message. */ + return(EDONTREPLY); +} - /* Also check Shift F1-F6 keys. */ - if (pressed(SF1)) mproc_dmp(); - if (pressed(SF2)) sigaction_dmp(); +PRIVATE char *keyname(int key) +{ + static char name[15]; - if (pressed(SF3)) fproc_dmp(); - if (pressed(SF4)) dtab_dmp(); + if(key >= F1 && key <= F12) + sprintf(name, " F%d", key - F1 + 1); + else if(key >= SF1 && key <= SF12) + sprintf(name, "Shift+F%d", key - SF1 + 1); + else + sprintf(name, "?"); - /* Inhibit sending a reply message. */ - return(EDONTREPLY); + return name; +} + +PUBLIC void mapping_dmp(void) +{ + int h; + + printf( +"Function key mappings for debug dumps in IS server.\n" +" Key Description\n" +"-------------------------------------------------------------------------\n"); + for(h = 0; h < NHOOKS; h++) + printf(" %10s. %s\n", keyname(hooks[h].key), hooks[h].name); + + printf("\n"); + + return; } diff --git a/servers/is/proto.h b/servers/is/proto.h index 141170852..5d27e0ae7 100644 --- a/servers/is/proto.h +++ b/servers/is/proto.h @@ -5,6 +5,7 @@ _PROTOTYPE( int main, (int argc, char **argv) ); /* dmp.c */ _PROTOTYPE( int do_fkey_pressed, (message *m) ); +_PROTOTYPE( void mapping_dmp, (void) ); /* dmp_kernel.c */ _PROTOTYPE( void proctab_dmp, (void) );