Skip to content
 

Symbian Debuggin: memory & register fump from exception

I made my own Exception handler to make the memory dump into a file. The memory dumps can be used for debugging purposes.
See what to do with the memory dump from NewLC article aobut tracking down the Hardware exceptions.

_LIT(KTestFile, "C:\\Data\\myExcepption.txt");
_LIT( KStackInfo, "StackInfo: ");
void ExceptionHandler(TExcType)
{
RFs fs;
RFile file;
fs.Connect();
file.Open(fs,KTestFile,EFileWrite);
RDebug::Print(_L("Exception handler"));
HBufC8* buf = HBufC8::NewLC(1000);
TPtr8 ptr = buf->Des();
RThread().Context(ptr);
file.Write(ptr);
//save register info into a file
RDebug::Printf( "%S", buf );
CleanupStack::PopAndDestroy();
}


Using the Exception handler. The Exception handler can be easily set by calling
SetExceptionHandler function.

User::SetExceptionHandler(&ExceptionHandler,0xffffffff);

Note that you can not use this at the same time with Carbide On device debugging, since the TRK will use the same mechanism to catch exceptions from the Hardware.

Leave a Reply

(required)