etc/services - sync with NetBSD-8
[minix.git] / minix / lib / libsys / stacktrace.c
blobd7e87eb9c7140027525ce5ae728aa8199d22adac
1 /*
2 stacktrace.c
4 Created: Jan 19, 1993 by Philip Homburg
6 Copyright 1995 Philip Homburg
7 */
9 #include <stdio.h>
10 #include <string.h>
11 #include <minix/sysutil.h>
13 typedef unsigned int reg_t;
15 extern reg_t get_bp(void);
17 void util_stacktrace(void)
19 #if USE_SYSDEBUG
20 reg_t bp, pc, hbp;
22 bp= get_bp();
23 while(bp)
25 pc= ((reg_t *)bp)[1];
26 hbp= ((reg_t *)bp)[0];
27 printf("0x%lx ", (unsigned long) pc);
28 if (hbp != 0 && hbp <= bp)
30 printf("0x%lx ", (unsigned long) -1);
31 break;
33 bp= hbp;
35 printf("\n");
36 #endif /* USE_SYSDEBUG */