If you want to diagnose Zodiac fatal exceptions, or crashes in your app, this post is for you. The slighty-informative fatal exception box can be expanded a LOT. It is simple. First, I will assume you're programming in ARM. Then do this:
void* oldState = installExpansion(&__call_expander_func);
....
....
crashing code
....
....
installExpansion(oldState);
this will install expanded error handler function myExpander(). This function is for you to write, and has prototype void myExpander(ExceptionFrame* exc);
The usefullines is in the wealth of information that this function gets - it gets the full exception frame, including all registers, address that caused the error, etc... This can be very useful. See code lsiting below for more info
Additionally you'll need the following code listing:
typedef struct{
UInt32 zodFaultCategory;
UInt32 saved_user_R0;
UInt32 saved_user_R1;
UInt32 saved_user_R2;
UInt32 saved_user_R3;
UInt32 saved_user_R4;
UInt32 saved_user_R5;
UInt32 saved_user_R6;
UInt32 saved_user_R7;
UInt32 saved_user_R8;
UInt32 saved_user_R9;
UInt32 saved_user_R10;
UInt32 saved_user_R11;
UInt32 saved_user_R12;
UInt32 saved_user_SP;
UInt32 saved_user_LR;
UInt32 saved_user_CPSR;
UInt32 saved_svc_SP;
UInt32 saved_svc_LR;
UInt32 saved_svr_SPSR;
UInt32 saved_art_SP;
UInt32 saved_abt_LR;
UInt32 saved_abt_SPSR;
UInt32 saved_und_SP;
UInt32 saved_und_LR;
UInt32 saved_und_SPSR;
UInt32 saved_irq_SP;
UInt32 saved_irq_LR;
UInt32 saved_irq_SPSR;
UInt32 saved_fiq_R8;
UInt32 saved_fiq_R9;
UInt32 saved_fiq_R10;
UInt32 saved_fiq_R11;
UInt32 saved_fiq_R12;
UInt32 saved_fiq_SP;
UInt32 saved_fiq_LR;
UInt32 saved_fiq_SPSR;
UInt32 faultStatus;
UInt32 faultAddress;
UInt32 PC_whe_we_hit_error;
}ExceptionFrame; //for sys FatalAlert, at entry pointed to by R4
asm void* installExpansion(void* func){
LDR R1,[R9,#-12]
LDR R2,[R1,#0x444]
STR R0,[R1,#0x444]
MOV R0,R2
BX LR
}
asm void __call_expander_func(){
MOV R0,R4
B myExpander
}
6/23/08
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment