--- In [EMAIL PROTECTED], "Ricardo Marques"
<[EMAIL PROTECTED]> wrote:
> Isn't there a simpler way. I was now using SysFatalAlert because
altought it
> appears a reset button it allows to continue trough the app, but I don't
> seem to understand what that resest does...
>
Ricardo, sounds like we're in the same boat. I am a little embarassed
to say it (I'm certainly opening myself up to a little ridicule here
), but I have never bothered to figure out how to debug properly,
so I use the following bits of code. I think you'll see what I'm
doing here. I just declare these in a common header file, so they
are available from any code module that I am working on. When I
encounter a crash, I just add some of these debug tags into my code to
locate the problem. So I might add a "Debug(1);" command, then a
"Debug(2);" command a few lines after. When the crash happens, if the
top-left of the screen shows "1" then I know the crash was between
these 2 debug statements. Crude, yes, but it works for me.
If I want to display more than one debug message, I use the DebugXY
function to place additional messages at other parts of the display.
DebugT functions allow debug output of short text strings.
(if any of you programmers out there are ROFL at what I just wrote,
I'd be more than willing to entertain any well-meaning advice on how
to debug the right way. And for the not-so-well-meaning,... I've got
a pretty thick skin... have at it!)
Here are the code fragments.
void Debug(Int32 i){
if (debugEnabled) DebugXY(i,0,0);
}
void DebugXY(Int32 i, UInt8 x, UInt8 y){
Char st[32];
if (debugEnabled) WinDrawChars(StrCat(StrIToA(st,i)," "),12,
x, y);
}
void DebugTXY(Char *p, UInt8 x, UInt8 y){
if (debugEnabled){
if (p){
if (StrLen(p)<15) WinDrawChars(p, StrLen(p), x, y);
else WinDrawChars(p, 15, x, y);
}
else WinDrawChars("null ptr", 8, x, y);
}
}
void DebugT(Char *p){
if (debugEnabled) DebugTXY(p, 100, 0);
}
Bob.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/