685aa79304
Change-Id: Ic954ba8667b4d039172b8e0d2ec57674a479b8aa
38 lines
547 B
C
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 */
|
|
}
|
|
|