Mail Archives: djgpp/1998/03/14/20:46:55
At 09:30 3/12/1998 GMT, steve wrote:
>When debugging in RHIDE and an assert occurs the call stack is always
>shown empty (it would be nice to see the function call stack showing
>how the program got there. When debugging and an error occurs, i.e.
Here is something that I use to get kind of what you describe. I
plucked the code from something someone else posted, I dont remember
exactly who. Whoever did send me a mail and I'll put thier name in the
sources..
Here is the code:
//----------------------------------------------------------------------------
// abort program with stacktrace suitable for symify
// if -g was used for compiling
void _detl_assert (const char* test, const char* file, const int line)
{
long *bp=(long*)&bp+1;
FILE *stream = fopen("assert.log","w");
fprintf(stream,"DETL assertion %s at line %i in %s
failed!\n",test,line,file);
while(*bp)
{
fprintf(stream," 0x%08lx\n",((long*)bp)[1]);
bp=(long*)*bp;
}
fclose(stream);
exit(255);
}
The output gets written to an assert.log file and if you symify that
file you should get the stack trace.
Good luck.
Doug Eleveld
- Raw text -