rockbox/lib/unwarminder/unwarminder.c
Marcin Bukat b4eab59951 Arm stack unwinder
Simplified stack unwinder for ARM. This is port of
http://www.mcternan.me.uk/ArmStackUnwinding/
backtrace() is called from UIE() on native targets
and from panicf() on both native and ARM RaaA.

Change-Id: I8e4b3c02490dd60b30aa372fe842d193b8929ce0
2012-02-22 08:33:26 +01:00

78 lines
2.6 KiB
C

/***************************************************************************
* ARM Stack Unwinder, Michael.McTernan.2001@cs.bris.ac.uk
*
* This program is PUBLIC DOMAIN.
* This means that there is no copyright and anyone is able to take a copy
* for free and use it as they wish, with or without modifications, and in
* any context, commercially or otherwise. The only limitation is that I
* don't guarantee that the software is fit for any purpose or accept any
* liability for it's use or misuse - this software is without warranty.
***************************************************************************
* File Description: Implementation of the interface into the ARM unwinder.
**************************************************************************/
#define MODULE_NAME "UNWARMINDER"
/***************************************************************************
* Include Files
**************************************************************************/
#include "types.h"
#include <stdio.h>
#include <string.h>
#include "unwarminder.h"
#include "unwarm.h"
/***************************************************************************
* Manifest Constants
**************************************************************************/
/***************************************************************************
* Type Definitions
**************************************************************************/
/***************************************************************************
* Variables
**************************************************************************/
/***************************************************************************
* Macros
**************************************************************************/
/***************************************************************************
* Local Functions
**************************************************************************/
/***************************************************************************
* Global Functions
**************************************************************************/
UnwResult UnwindStart(Int32 pcValue,
Int32 spValue,
const UnwindCallbacks *cb,
void *data)
{
UnwState state;
/* Initialise the unwinding state */
UnwInitState(&state, cb, data, pcValue, spValue);
/* Check the Thumb bit */
if(pcValue & 0x1)
{
return UnwStartThumb(&state);
}
else
{
return UnwStartArm(&state);
}
}
/* END OF FILE */