minix/minix/lib/libsys/stacktrace.c
David van Moolenbroek 685aa79304 libsys: resolve clang warnings
Change-Id: Ic954ba8667b4d039172b8e0d2ec57674a479b8aa
2014-09-30 20:08:54 +00:00

38 lines
547 B
C

/*
stacktrace.c
Created: Jan 19, 1993 by Philip Homburg
Copyright 1995 Philip Homburg
*/
#include <stdio.h>
#include <string.h>
#include <minix/sysutil.h>
typedef unsigned int reg_t;
extern reg_t get_bp(void);
void util_stacktrace(void)
{
#if USE_SYSDEBUG
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;
}
printf("\n");
#endif /* USE_SYSDEBUG */
}