Monday, July 26, 2010

How to Debug Symbian C++

Hi guys/girls.

Um, this time i would like to share; how to debug your Symbian C++ code. Actually and as the most right and elegant way to do debugging, you need to put a breakpoint to your suspicious code line. But, i don't really like the way Carbide C++ 1.2 do it. So this is my way.

Suppose you have these lines of code

code1;

function1(code1);

code2=code1;


If the application crashed, and you think that function1 is wrong, create globalnote and display it before and after the function1.

code1;

CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
globalNote->>ShowNoteL(EAknGlobalInformationNote,_L("Before"));

function1(code1);

globalNote->ShowNoteL(EAknGlobalInformationNote,_L("After"));
CleanupStack::PopAndDestroy(globalNote);

code2=code1;


So, if Before message is popped-up but there is no "After" message popped-up, you're right, there is something wrong with function1. Happy coding.

PS: make sure you include aknglobalnote.h at the beginning of your implementation file.

#include
.
.
.

No comments:

Post a Comment