Mail Archives: djgpp/1998/06/09/17:50:47
Hello.
I am adding some debuging capabilities to my PPCol library but I don't
know how to force the output of the traceback, so the user can trace all the
calls to functions and look where happened the problem.
I have done a small demo program showing this problem and what I have
done until now, it is at the end of this message.
I have tried to find an answer in the FAQ and in the mail archives but I
haven't found anything.
If you reply, reply to the mailing list or directly to me, but be sure
to use lubaldo AT adinet DOT com DOT uy since I am at school now and I don't know if
reply will work.
Here's the code:
******************** debug.c ******************
#include <stdio.h>
#include <signal.h>
void test_function(char *string)
{
if(string==NULL) {
fprintf(stderr,"\nError on function: test_function(char *), NULL pointer
passed.\nAborting!\n");
raise(SIGABRT); //Tried with SIGSEGV also but got the same results.
} else {
printf(string);
}
}
char *test_pointer; //The C-FAQ says that the ANSI and ISO standards say
that static variables would be initialized to 0, it seems to work with DJGPP
at least... Local variables will/can contain garbage...
int main(int argc, char *argv[])
{
test_function("\nFirst call: all normal.\n");
test_function(test_pointer); //This will fail...
test_function("\n3rd call: this will not be called.\n");
return 0;
}
************* EOF *************
So, when you execute this program it aborts but it doesn't display the
traceback. I have looked in the libc info file but I don't have found any
function that does what I want... so, someone knows what function it is? Or
what else I can do to display the traceback?
Some bad DPMI servers don't detect some bad memory accesses... I don't
know what happens when you access the NULL space with this DPMI servers...
maybe in that situation they detect it, but someone know if this is 100%
effective? I don't have tried it under W95 yet... sorry... I don't have much
time...
Ok... quiet a big letter... I am sorry for disturbing... I have done my
best.
TIA, goodbye.
Ivan Baldo
lubaldo AT adinet DOT com DOT uy
- Raw text -