|
|
1.1 root 1: /*
2:
1.1.1.3 root 3: Copyright 1990,1991,1992 Eric R. Smith.
4:
1.1.1.4 root 5: Copyright 1992,1993 Atari Corporation.
1.1.1.3 root 6:
7: All rights reserved.
1.1 root 8:
9: */
10:
11:
12:
13: /* MiNT debugging output routines */
14:
15: /* also, ksprintf is put here, for lack of any better place to put it */
16:
17:
18:
19: #include "mint.h"
20:
21: #include <stdarg.h>
22:
23:
24:
1.1.1.3 root 25: static void VDEBUGOUT P_((int, const char *, va_list));
1.1 root 26:
27:
28:
29: /*
30:
31: * ksprintf implements a very crude sprintf() function that provides only
32:
33: * what MiNT needs...
34:
35: *
36:
37: * NOTE: this sprintf probably doesn't conform to any standard at
38:
39: * all. It's only use in life is that it won't overflow fixed
40:
41: * size buffers (i.e. it won't try to write more than SPRINTF_MAX
42:
43: * characters into a string)
44:
45: */
46:
47:
48:
49: static int
50:
51: PUTC(char *p, int c, int *cnt, int width) {
52:
53: int put = 1;
54:
55:
56:
57: if (*cnt <= 0) return 0;
58:
59: *p++ = c;
60:
61: *cnt -= 1;
62:
63: while (*cnt > 0 && --width > 0) {
64:
65: *p++ = ' ';
66:
67: *cnt -= 1;
68:
69: put++;
70:
71: }
72:
73: return put;
74:
75: }
76:
77:
78:
79: static int
80:
81: PUTS(char *p, const char *s, int *cnt, int width) {
82:
83: int put = 0;
84:
85:
86:
87: if (s == 0) s = "(null)";
88:
89:
90:
91: while (*cnt > 0 && *s) {
92:
93: *p++ = *s++;
94:
95: put++;
96:
97: *cnt -= 1;
98:
99: width--;
100:
101: }
102:
103: while (width-- > 0 && *cnt > 0) {
104:
105: *p++ = ' ';
106:
107: put++;
108:
109: *cnt -= 1;
110:
111: }
112:
113: return put;
114:
115: }
116:
117:
118:
119: static int
120:
121: PUTL(char *p, unsigned long u, int base, int *cnt, int width, int fill_char)
122:
123: {
124:
125: int put = 0;
126:
127: static char obuf[32];
128:
129: char *t;
130:
131:
132:
133: t = obuf;
134:
135:
136:
137: do {
138:
1.1.1.3 root 139: *t++ = "0123456789ABCDEF"[u % base];
1.1 root 140:
141: u /= base;
142:
143: width--;
144:
145: } while (u > 0);
146:
147:
148:
149: while (width-- > 0 && *cnt > 0) {
150:
151: *p++ = fill_char;
152:
153: put++;
154:
155: *cnt -= 1;
156:
157: }
158:
159: while (*cnt > 0 && t != obuf) {
160:
161: *p++ = *--t;
162:
163: put++;
164:
165: *cnt -= 1;
166:
167: }
168:
169: return put;
170:
171: }
172:
173:
174:
175: int
176:
177: vksprintf(char *buf, const char *fmt, va_list args)
178:
179: {
180:
181: char *p = buf, c, fill_char;
182:
183: char *s_arg;
184:
185: int i_arg;
186:
187: long l_arg;
188:
189: int cnt;
190:
191: int width, long_flag;
192:
193:
194:
195: cnt = SPRINTF_MAX - 1;
196:
197: while( (c = *fmt++) != 0 ) {
198:
199: if (c != '%') {
200:
201: p += PUTC(p, c, &cnt, 1);
202:
203: continue;
204:
205: }
206:
207: c = *fmt++;
208:
209: width = 0;
210:
211: long_flag = 0;
212:
213: fill_char = ' ';
214:
215: if (c == '0') fill_char = '0';
216:
217: while (c && isdigit(c)) {
218:
219: width = 10*width + (c-'0');
220:
221: c = *fmt++;
222:
223: }
224:
225: if (c == 'l' || c == 'L') {
226:
227: long_flag = 1;
228:
229: c = *fmt++;
230:
231: }
232:
233: if (!c) break;
234:
235:
236:
237: switch (c) {
238:
239: case '%':
240:
241: p += PUTC(p, c, &cnt, width);
242:
243: break;
244:
245: case 'c':
246:
247: i_arg = va_arg(args, int);
248:
249: p += PUTC(p, i_arg, &cnt, width);
250:
251: break;
252:
253: case 's':
254:
255: s_arg = va_arg(args, char *);
256:
257: p += PUTS(p, s_arg, &cnt, width);
258:
259: break;
260:
261: case 'd':
262:
263: if (long_flag) {
264:
265: l_arg = va_arg(args, long);
266:
267: } else {
268:
269: l_arg = va_arg(args, int);
270:
271: }
272:
273: if (l_arg < 0) {
274:
275: p += PUTC(p, '-', &cnt, 1);
276:
277: width--;
278:
279: l_arg = -l_arg;
280:
281: }
282:
283: p += PUTL(p, l_arg, 10, &cnt, width, fill_char);
284:
285: break;
286:
287: case 'o':
288:
289: if (long_flag) {
290:
291: l_arg = va_arg(args, long);
292:
293: } else {
294:
295: l_arg = va_arg(args, unsigned int);
296:
297: }
298:
299: p += PUTL(p, l_arg, 8, &cnt, width, fill_char);
300:
301: break;
302:
303: case 'x':
304:
305: if (long_flag) {
306:
307: l_arg = va_arg(args, long);
308:
309: } else {
310:
311: l_arg = va_arg(args, unsigned int);
312:
313: }
314:
315: p += PUTL(p, l_arg, 16, &cnt, width, fill_char);
316:
317: break;
318:
319: case 'u':
320:
321: if (long_flag) {
322:
323: l_arg = va_arg(args, long);
324:
325: } else {
326:
327: l_arg = va_arg(args, unsigned int);
328:
329: }
330:
331: p += PUTL(p, l_arg, 10, &cnt, width, fill_char);
332:
333: break;
334:
335:
336:
337: }
338:
339: }
340:
341: *p = 0;
342:
1.1.1.2 root 343: return (int)(p - buf);
1.1 root 344:
345: }
346:
347:
348:
1.1.1.2 root 349: int ARGS_ON_STACK
1.1 root 350:
351: ksprintf(char *buf, const char *fmt, ...)
352:
353: {
354:
355: va_list args;
356:
357: int foo;
358:
359:
360:
361: va_start(args, fmt);
362:
363: foo = vksprintf(buf, fmt, args);
364:
365: va_end(args);
366:
367: return foo;
368:
369: }
370:
371:
372:
1.1.1.3 root 373: int debug_level = 1; /* how much debugging info should we print? */
1.1 root 374:
375: int out_device = 2; /* BIOS device to write errors to */
376:
377:
378:
379: /*
380:
381: * out_next[i] is the out_device value to use when the current
382:
383: * device is i and the user hits F3.
384:
385: * Cycle is CON -> PRN -> AUX -> MIDI -> 6 -> 7 -> 8 -> 9 -> CON
386:
387: * (Note: BIOS devices 6-8 exist on Mega STe and TT, 9 on TT.)
388:
389: *
390:
391: * out_device and this table are exported to bios.c and used here in HALT().
392:
393: */
394:
395:
396:
397: /* 0 1 2 3 4 5 6 7 8 9 */
398:
399: char out_next[] = { 1, 3, 0, 6, 0, 0, 7, 8, 9, 2 };
400:
401:
402:
1.1.1.3 root 403: /*
404:
405: * debug log modes:
406:
407: *
408:
409: * 0: no logging.
410:
411: * 1: log all messages, dump the log any time something happens at
412:
413: * a level that gets shown. Thus, if you're at debug_level 2,
414:
415: * everything is logged, and if something at levels 1 or 2 happens,
416:
417: * the log is dumped.
418:
419: *
420:
421: * LB_LINE_LEN is 20 greater than SPRINTF_MAX because up to 20 bytes
422:
423: * are prepended to the buffer string passed to ksprintf.
424:
425: */
426:
427:
428:
429: #define LBSIZE 50 /* number of lines */
430:
431: #define LB_LINE_LEN (SPRINTF_MAX+20) /* width of a line */
432:
433: int debug_logging;
434:
435: int logptr;
436:
437: static char logbuf[LBSIZE][LB_LINE_LEN];
438:
439: static short logtime[LBSIZE]; /* low 16 bits of 200Hz: timestamp of msg */
440:
441:
442:
443: /*
444:
445: * Extra terse settings - don't even output ALERTs unless asked to.
446:
447: *
448:
449: * Things that happen in on an idle Desktop are at LOW_LEVEL:
450:
451: * Psemaphore, Pmsg, Syield.
452:
453: */
454:
455:
456:
457: #define FORCE_LEVEL 0
458:
459: #define ALERT_LEVEL 1
460:
461: #define DEBUG_LEVEL 2
462:
463: #define TRACE_LEVEL 3
464:
465: #define LOW_LEVEL 4
466:
467:
468:
469: /*
470:
471: * The inner loop does this: at each newline, the keyboard is polled. If
472:
473: * you've hit a key, then it's checked: if it's ctl-alt, do_func_key is
474:
475: * called to do what it says, and that's that. If not, then you pause the
476:
477: * output. If you now hit a ctl-alt key, it gets done and you're still
478:
479: * paused. Only hitting a non-ctl-alt key will get you out of the pause.
480:
481: * (And only a non-ctl-alt key got you into it, too!)
482:
483: *
484:
485: * When out_device isn't the screen, number keys give you the same effects
486:
487: * as function keys. The only way to get into this code, however, is to
488:
489: * have something produce debug output in the first place! This is
490:
491: * awkward: Hit a key on out_device, then hit ctl-alt-F5 on the console so
492:
493: * bios.c will call DUMPPROC, which will call ALERT, which will call this.
494:
495: * It'll see the key you hit on out_device and drop you into this loop.
496:
497: * CTL-ALT keys make BIOS call do_func_key even when out_device isn't the
498:
499: * console.
500:
501: */
502:
503:
504:
1.1 root 505: void
506:
507: debug_ws(s)
508:
509: const char *s;
510:
511: {
512:
1.1.1.3 root 513: long key;
514:
515: int scan;
516:
517: int stopped;
518:
519:
520:
521: while (*s) {
522:
523: (void)Bconout(out_device, *s);
524:
525: while (*s == '\n' && out_device != 0 && Bconstat(out_device)) {
1.1 root 526:
1.1.1.3 root 527: stopped = 0;
1.1 root 528:
1.1.1.3 root 529: while (1) {
1.1 root 530:
1.1.1.3 root 531: if (out_device == 2) {
1.1 root 532:
1.1.1.5 ! root 533: /* got a key; if ctl-alt then do it */
! 534:
1.1.1.3 root 535: if ((Kbshift(-1) & 0x0c) == 0x0c) {
1.1 root 536:
1.1.1.5 ! root 537: key = Bconin(out_device);
! 538:
1.1.1.3 root 539: scan = (int) (((key >> 16) & 0xff));
1.1 root 540:
1.1.1.3 root 541: do_func_key(scan);
1.1 root 542:
1.1.1.5 ! root 543: goto ptoggle;
1.1 root 544:
1.1.1.5 ! root 545: }
1.1 root 546:
1.1.1.3 root 547: }
548:
549: else {
550:
1.1.1.5 ! root 551: key = Bconin(out_device);
! 552:
1.1.1.3 root 553: if (key < '0' || key > '9') {
554:
555: ptoggle: /* not a func key */
556:
557: if (stopped) break;
558:
559: else stopped = 1;
1.1 root 560:
1.1.1.3 root 561: }
1.1 root 562:
1.1.1.3 root 563: else {
1.1 root 564:
1.1.1.3 root 565: /* digit key from debug device == Fn */
1.1 root 566:
1.1.1.3 root 567: if (key == '0') scan = 0x44;
568:
569: else scan = (int) (key - '0' + 0x3a);
570:
571: do_func_key(scan);
572:
573: }
574:
575: }
1.1 root 576:
1.1.1.3 root 577: }
578:
579: }
580:
581: s++;
582:
583: }
584:
585: }
586:
587:
588:
589: /*
590:
591: * _ALERT(s) returns 1 for success and 0 for failure.
592:
593: * It attempts to write the string to "the alert pipe," u:\pipe\alert.
594:
595: * If the write fails because the pipe is full, we "succeed" anyway.
596:
597: *
598:
599: * This is called in vdebugout and also in memprot.c for memory violations.
600:
601: * It's also used by the Salert() system call in dos.c.
602:
603: */
604:
605:
606:
607: int
608:
609: _ALERT(s)
610:
611: char *s;
612:
613: {
614:
615: FILEPTR *f;
616:
617: char alertbuf[SPRINTF_MAX+10], *ptr, *lastspace;
618:
619: int counter;
620:
621: char *alert;
622:
623: int olddebug = debug_level;
624:
625: int oldlogging = debug_logging;
626:
627:
628:
629: /* temporarily reduce the debug level, so errors finding
630:
631: * u:\pipe\alert don't get reported
632:
633: */
634:
635: debug_level = debug_logging = 0;
636:
637: f = do_open("u:\\pipe\\alert",(O_WRONLY | O_NDELAY),0,(XATTR *)0);
638:
639: debug_level = olddebug;
640:
641: debug_logging = oldlogging;
642:
643:
644:
645: if (f) {
646:
647: /*
648:
649: * format the string into an alert box
650:
651: */
652:
653: if (*s == '[') { /* already an alert */
654:
655: alert = s;
656:
657: } else {
658:
659: alert = alertbuf;
660:
661: ksprintf(alertbuf, "[1][%s", s);
662:
663: /*
664:
665: * make sure no lines exceed 30 characters; also, filter out any
666:
667: * reserved characters like '[' or ']'
668:
669: */
670:
671: ptr = alertbuf+4;
672:
673: counter = 0;
674:
675: lastspace = 0;
676:
677: while(*ptr) {
678:
679: if (*ptr == ' ') {
680:
681: lastspace = ptr;
682:
683: } else if (*ptr == '[') {
684:
685: *ptr = '(';
686:
687: } else if (*ptr == ']') {
688:
689: *ptr = ')';
690:
691: } else if (*ptr == '|') {
692:
693: *ptr = ':';
1.1 root 694:
695: }
696:
1.1.1.3 root 697: if (counter++ >= 29) {
698:
699: if (lastspace) {
700:
701: *lastspace = '|';
702:
703: counter = (int) (ptr - lastspace);
704:
705: lastspace = 0;
706:
707: } else {
708:
709: *ptr = '|';
710:
711: counter = 0;
712:
713: }
714:
715: }
716:
717: ptr++;
718:
1.1 root 719: }
720:
1.1.1.3 root 721: strcpy(ptr, "][ OK ]");
1.1 root 722:
723: }
724:
1.1.1.3 root 725:
726:
727: (*f->dev->write)(f,alert,(long)strlen(alert)+1);
728:
729: do_close(f);
730:
731: return 1;
732:
733: }
734:
735: else return 0;
736:
1.1 root 737: }
738:
739:
740:
741: static void
742:
1.1.1.3 root 743: VDEBUGOUT(level, s, args)
744:
745: int level;
1.1 root 746:
747: const char *s;
748:
749: va_list args;
750:
751: {
752:
1.1.1.3 root 753: char *lp;
754:
755: char *lptemp;
756:
757:
758:
759: logtime[logptr] = (short)(*(long *)0x4baL);
760:
761: lp = logbuf[logptr];
762:
763: if (++logptr == LBSIZE) logptr = 0;
764:
765:
766:
767: if (curproc) {
768:
769: ksprintf(lp,"pid %3d (%s): ", curproc->pid, curproc->name);
770:
771: lptemp = lp+strlen(lp);
772:
773: }
774:
775: else {
776:
777: lptemp = lp;
778:
779: }
780:
781:
782:
783: vksprintf(lptemp, s, args);
784:
785:
786:
787: /* for alerts, try the alert pipe unconditionally */
788:
789: if (level == ALERT_LEVEL && _ALERT(lp)) return;
790:
791:
792:
793: if (debug_level >= level) {
794:
795: debug_ws(lp);
796:
797: debug_ws("\r\n");
798:
799: }
800:
801: }
802:
803:
804:
805: void ARGS_ON_STACK Tracelow(const char *s, ...)
806:
807: {
808:
809: va_list args;
1.1 root 810:
811:
812:
1.1.1.3 root 813: if (debug_logging || (debug_level >= LOW_LEVEL)) {
1.1 root 814:
1.1.1.3 root 815: va_start(args, s);
1.1 root 816:
1.1.1.3 root 817: VDEBUGOUT(LOW_LEVEL, s, args);
1.1 root 818:
1.1.1.3 root 819: va_end(args);
1.1 root 820:
1.1.1.3 root 821: }
1.1 root 822:
823: }
824:
825:
826:
1.1.1.2 root 827: void ARGS_ON_STACK Trace(const char *s, ...)
1.1 root 828:
829: {
830:
831: va_list args;
832:
833:
834:
1.1.1.3 root 835: if (debug_logging || (debug_level >= TRACE_LEVEL)) {
1.1 root 836:
837: va_start(args, s);
838:
1.1.1.3 root 839: VDEBUGOUT(TRACE_LEVEL, s, args);
1.1 root 840:
841: va_end(args);
842:
843: }
844:
845: }
846:
847:
848:
1.1.1.2 root 849: void ARGS_ON_STACK Debug(const char *s, ...)
1.1 root 850:
851: {
852:
853: va_list args;
854:
855:
856:
1.1.1.3 root 857: if (debug_logging || (debug_level >= DEBUG_LEVEL)) {
1.1 root 858:
859: va_start(args, s);
860:
1.1.1.3 root 861: VDEBUGOUT(DEBUG_LEVEL, s, args);
1.1 root 862:
863: va_end(args);
864:
865: }
866:
1.1.1.3 root 867: if (debug_logging && debug_level >= DEBUG_LEVEL) DUMPLOG();
868:
1.1 root 869: }
870:
871:
872:
1.1.1.2 root 873: void ARGS_ON_STACK ALERT(const char *s, ...)
1.1 root 874:
875: {
876:
877: va_list args;
878:
879:
880:
1.1.1.3 root 881: if (debug_logging || debug_level >= ALERT_LEVEL) {
882:
883: va_start(args, s);
884:
885: VDEBUGOUT(ALERT_LEVEL, s, args);
886:
887: va_end(args);
888:
889: }
890:
891: if (debug_logging && debug_level >= ALERT_LEVEL) DUMPLOG();
892:
893: }
894:
895:
896:
897: void ARGS_ON_STACK FORCE(const char *s, ...)
898:
899: {
900:
901: va_list args;
902:
903:
904:
1.1 root 905: va_start(args, s);
906:
1.1.1.3 root 907: VDEBUGOUT(FORCE_LEVEL, s, args);
1.1 root 908:
909: va_end(args);
910:
1.1.1.3 root 911: /* don't dump log here - hardly ever what you mean to do. */
912:
1.1 root 913: }
914:
915:
916:
1.1.1.3 root 917: void
918:
919: DUMPLOG()
920:
921: {
922:
923: char *end;
924:
925: char *start;
926:
927: short *timeptr;
928:
929: char timebuf[6];
930:
931:
932:
933: /* logbuf[logptr] is the oldest string here */
934:
935:
936:
937: end = start = logbuf[logptr];
938:
939: timeptr = &logtime[logptr];
940:
941:
942:
943: do {
944:
945: if (*start) {
946:
947: ksprintf(timebuf,"%04x ",*timeptr);
948:
949: debug_ws(timebuf);
950:
951: debug_ws(start);
952:
953: debug_ws("\r\n");
954:
955: *start = '\0';
956:
957: }
958:
959: start += LB_LINE_LEN;
960:
961: timeptr++;
962:
963: #ifdef LATTICE
964:
965: #pragma ignore 83 /* [reference beyond object size] */
966:
967: #endif
968:
969: if (start == logbuf[LBSIZE]) {
970:
971: #ifdef LATTICE
972:
973: #pragma warning 83 /* [reference beyond object size] */
974:
975: #endif
976:
977: start = logbuf[0];
978:
979: timeptr = &logtime[0];
980:
981: }
982:
983: } while (start != end);
984:
985:
986:
987: logptr = 0;
988:
989: }
990:
991:
992:
993: /* wait for a key to be pressed */
994:
995: void
996:
997: PAUSE()
998:
999: {
1000:
1001: debug_ws("Hit a key\r\n");
1002:
1003: (void)Bconin(2);
1004:
1005: }
1006:
1007:
1008:
1.1 root 1009: EXITING
1010:
1.1.1.2 root 1011: void ARGS_ON_STACK FATAL(const char *s, ...)
1.1 root 1012:
1013: {
1014:
1015: va_list args;
1016:
1017:
1018:
1019: va_start(args, s);
1020:
1.1.1.3 root 1021: VDEBUGOUT(-1, s, args);
1.1 root 1022:
1023: va_end(args);
1024:
1.1.1.3 root 1025: if (debug_logging) {
1026:
1027: DUMPLOG();
1028:
1029: }
1030:
1031:
1032:
1.1 root 1033: HALT();
1034:
1035: }
1036:
1037:
1038:
1039:
1040:
1.1.1.4 root 1041: static const char *rebootmsg[MAXLANG] = {
1042:
1043: "FATAL ERROR. You must reboot the system.\r\n",
1044:
1045: "FATALER FEHLER. Das System mu� neu gestartet werden.\r\n", /* German */
1046:
1047: "FATAL ERROR. You must reboot the system.\r\n", /* French */
1048:
1049: "FATAL ERROR. You must reboot the system.\r\n", /* UK */
1050:
1051: "FATAL ERROR. You must reboot the system.\r\n", /* Spanish */
1052:
1053: "FATAL ERROR. You must reboot the system.\r\n" /* Italian */
1054:
1055: };
1056:
1057:
1058:
1.1 root 1059: EXITING
1060:
1061: void HALT()
1062:
1063: {
1064:
1065: long r;
1066:
1.1.1.3 root 1067: long key;
1068:
1069: int scan;
1070:
1.1 root 1071: extern long tosssp; /* in main.c */
1072:
1.1.1.3 root 1073: #ifdef PROFILING
1.1 root 1074:
1.1.1.3 root 1075: extern EXITING _exit P_((int));
1076:
1077: #endif
1.1 root 1078:
1079: restr_intr(); /* restore interrupts to normal */
1080:
1.1.1.4 root 1081: #ifdef DEBUG_INFO
1082:
1.1 root 1083: debug_ws("Fatal MiNT error: adjust debug level and hit a key...\r\n");
1084:
1.1.1.4 root 1085: #else
1086:
1087: debug_ws(rebootmsg[gl_lang]);
1088:
1089: #endif
1090:
1.1 root 1091: sys_q[READY_Q] = 0; /* prevent context switches */
1092:
1093:
1094:
1095: for(;;) {
1096:
1.1.1.3 root 1097: /* get a key; if ctl-alt then do it, else halt */
1.1 root 1098:
1.1.1.3 root 1099: key = Bconin(out_device);
1.1 root 1100:
1.1.1.3 root 1101: if ((key & 0x0c000000L) == 0x0c000000L) {
1.1 root 1102:
1.1.1.3 root 1103: scan = (int) ((key >> 16) & 0xff);
1.1 root 1104:
1.1.1.3 root 1105: do_func_key(scan);
1.1.1.2 root 1106:
1107: }
1108:
1.1.1.3 root 1109: else {
1.1 root 1110:
1111: break;
1112:
1.1.1.3 root 1113: }
1114:
1.1 root 1115: }
1116:
1117: for(;;) {
1118:
1.1.1.4 root 1119: debug_ws(rebootmsg[gl_lang]);
1.1 root 1120:
1121: r = Bconin(2);
1122:
1123:
1124:
1125: if ( (r & 0x0ff) == 'x' ) {
1126:
1.1.1.4 root 1127: extern int no_mem_prot;
1128:
1.1 root 1129: close_filesys();
1130:
1.1.1.4 root 1131: if (!no_mem_prot)
1132:
1133: restr_mmu();
1134:
1.1.1.5 ! root 1135: restr_screen();
! 1136:
1.1 root 1137: (void)Super((void *)tosssp); /* gratuitous (void *) for Lattice */
1138:
1.1.1.2 root 1139: #ifdef PROFILING
1140:
1141: _exit(0);
1142:
1143: #else
1144:
1145: Pterm0();
1146:
1147: #endif
1.1 root 1148:
1149: }
1150:
1151: }
1152:
1153: }
1154:
1155:
1156:
1157:
1158:
1159: /* some key definitions */
1160:
1161: #define CTRLALT 0xc
1162:
1163: #define DEL 0x53 /* scan code of delete key */
1164:
1165: #define UNDO 0x61 /* scan code of undo key */
1166:
1167:
1168:
1169: void
1170:
1171: do_func_key(scan)
1172:
1173: int scan;
1174:
1175: {
1176:
1177: extern struct tty con_tty;
1178:
1179:
1180:
1181: switch (scan) {
1182:
1183: case DEL:
1184:
1185: reboot();
1186:
1187: break;
1188:
1189: case UNDO:
1190:
1191: killgroup(con_tty.pgrp, SIGQUIT);
1192:
1193: break;
1194:
1.1.1.4 root 1195: #ifdef DEBUG_INFO
1.1.1.2 root 1196:
1.1.1.3 root 1197: case 0x3b: /* F1: increase debugging level */
1.1 root 1198:
1199: debug_level++;
1200:
1201: break;
1202:
1.1.1.3 root 1203: case 0x3c: /* F2: reduce debugging level */
1.1 root 1204:
1205: if (debug_level > 0)
1206:
1207: --debug_level;
1208:
1209: break;
1210:
1.1.1.3 root 1211: case 0x3d: /* F3: cycle out_device */
1.1 root 1212:
1213: out_device = out_next[out_device];
1214:
1215: break;
1216:
1.1.1.3 root 1217: case 0x3e: /* F4: set out_device to console */
1.1 root 1218:
1219: out_device = 2;
1220:
1221: break;
1222:
1.1.1.3 root 1223: case 0x3f: /* F5: dump memory */
1224:
1.1.1.5 ! root 1225: DUMP_ALL_MEM();
! 1226:
! 1227: break;
1.1 root 1228:
1.1.1.5 ! root 1229: case 0x58: /* shift+F5: dump kernel allocated memory */
1.1 root 1230:
1.1.1.5 ! root 1231: NALLOC_DUMP();
1.1.1.2 root 1232:
1.1 root 1233: break;
1234:
1.1.1.3 root 1235: case 0x40: /* F6: dump processes */
1.1 root 1236:
1237: DUMPPROC();
1238:
1239: break;
1240:
1.1.1.3 root 1241: case 0x41: /* F7: toggle debug_logging */
1242:
1243: debug_logging ^= 1;
1244:
1245: break;
1246:
1247: case 0x42: /* F8: dump log */
1248:
1249: DUMPLOG();
1250:
1251: break;
1252:
1253: case 0x43: /* F9: dump the global memory table */
1254:
1255: QUICKDUMP();
1256:
1257: break;
1258:
1259: case 0x5c: /* shift-F9: dump the mmu tree */
1260:
1261: BIG_MEM_DUMP(1,curproc);
1262:
1263: break;
1264:
1265: case 0x44: /* F10: do an annotated dump of memory */
1266:
1267: BIG_MEM_DUMP(0,0);
1268:
1269: break;
1270:
1.1.1.2 root 1271: #endif
1272:
1.1 root 1273: }
1274:
1275: }
1276:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.