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(); - - if (pressed(F10)) kenv_dmp(); - if (pressed(F11)) timing_dmp(); - if (pressed(F12)) sched_dmp(); - - /* Also check Shift F1-F6 keys. */ - if (pressed(SF1)) mproc_dmp(); - if (pressed(SF2)) sigaction_dmp(); - - if (pressed(SF3)) fproc_dmp(); - if (pressed(SF4)) dtab_dmp(); + for(h = 0; h < NHOOKS; h++) + if(pressed(hooks[h].key)) + hooks[h].function(); /* Inhibit sending a reply message. */ return(EDONTREPLY); } +PRIVATE char *keyname(int key) +{ + static char name[15]; + + 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, "?"); + + 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) );