]> Zhao Yanbai Git Server - minix.git/commitdiff
libsys: remove unused stacktrace variant
authorDavid van Moolenbroek <david@minix3.org>
Tue, 7 Aug 2012 11:10:05 +0000 (13:10 +0200)
committerDavid van Moolenbroek <david@minix3.org>
Wed, 8 Aug 2012 22:16:35 +0000 (00:16 +0200)
include/minix/sysutil.h
lib/libsys/stacktrace.c

index ac37fb670e8959cd2255c5cf44a1ee158b4c6414..cd32e953c3a570c2fdeea9b7bbee5896a7e2470c 100644 (file)
@@ -56,8 +56,6 @@ int tsc_calibrate(void);
 u32_t sys_hz(void);
 double getidle(void);
 void util_stacktrace(void);
-void util_nstrcat(char *str, unsigned long n);
-void util_stacktrace_strcat(char *);
 int micro_delay(u32_t micros);
 u32_t tsc_64_to_micros(u64_t tsc);
 u32_t tsc_to_micros(u32_t low, u32_t high);
index 6d382f7e05451f551d12550cedf1b2e682e8183a..8185956a92492aa1f838ab66afc245d688da5524 100644 (file)
@@ -11,62 +11,27 @@ Copyright 1995 Philip Homburg
 
 typedef unsigned int reg_t;
 
-#define FUNC_STACKTRACE(statement)                             \
-{                                                              \
-       reg_t bp, pc, hbp;                                      \
-       extern reg_t get_bp(void);                              \
-                                                               \
-       bp= get_bp();                                           \
-       while(bp)                                               \
-       {                                                       \
-               pc= ((reg_t *)bp)[1];                           \
-               hbp= ((reg_t *)bp)[0];                          \
-               statement;                                      \
-               if (hbp != 0 && hbp <= bp)                      \
-               {                                               \
-                       pc = -1;                                \
-                       statement;                              \
-                       break;                                  \
-               }                                               \
-               bp= hbp;                                        \
-       }                                                       \
-}
+extern reg_t get_bp(void);
 
-void util_nstrcat(char *str, unsigned long number)
+void util_stacktrace(void)
 {
 #if USE_SYSDEBUG
-       int n = 10, lead = 1;
-       char nbuf[12], *p;
-       p = nbuf;
-       *p++ = '0';
-       *p++ = 'x';
-       for(n = 0; n < 8; n++) {
-               int i;
-               i = (number >> ((7-n)*4)) & 0xF;
-               if(!lead || i) {
-                       *p++ = i < 10 ? '0' + i : 'a' + i - 10;
-                       lead = 0;
+       reg_t bp, pc, hbp;
+
+       bp= get_bp();
+       while(bp)
+       {
+               pc= ((reg_t *)bp)[1];
+               hbp= ((reg_t *)bp)[0];
+               printf("0x%lx ", (unsigned long) pc);
+               if (hbp != 0 && hbp <= bp)
+               {
+                       printf("0x%lx ", (unsigned long) -1);
+                       break;
                }
+               bp= hbp;
        }
-       if(lead) *p++ = '0';
-       *p++ = ' ';
-       *p++ = '\0';
-       strcat(str, nbuf);
-#endif /* USE_SYSDEBUG */
-}
-
-void util_stacktrace(void)
-{
-#if USE_SYSDEBUG
-       FUNC_STACKTRACE(printf("0x%lx ", (unsigned long) pc));
        printf("\n");
 #endif /* USE_SYSDEBUG */
 }
 
-void util_stacktrace_strcat(char *str)
-{
-#if USE_SYSDEBUG
-       FUNC_STACKTRACE(util_nstrcat(str, pc));
-#endif /* USE_SYSDEBUG */
-}
-