traceback(3C)
_________________________________________________________________
traceback function
Print a stack traceback and continue.
_________________________________________________________________
Calling Sequence
error = traceback(err);
where err is either a system error code, or 0 to use the
last error code.
Description
The traceback function prints a stack traceback on an error code,
and then execution continues. A stack traceback is a listing of
each procedure previously performed, with the offset of each. If
you used the /LINEID switch on the compilation command line, the
traceback will also tell you the line number in the source file
of each procedure.
Returns
The traceback function returns the error code that is used.
Related Functions
The traceback function has no related functions.
Example
#include <stdio.h>
main() {
printf("Calling sec1.\n");
sec1();
}
sec1()
{
printf("Calling sec2.\n");
sec2();
}
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
traceback(3C)
sec2()
{
printf("Calling sec3.\n");
sec3();
}
sec3()
{
int ch;
while ((ch = getchar()) != EOF)
putchar(ch);
traceback(0);
/* Print traceback & End of File error */
}
If you call the program test and enter
abc
you generate
Calling sec1.
Calling sec2.
Calling sec3.
abc
ERROR 24.
from $traceback.
Call Traceback:
from fp=16000013030, pc=sec3+161, line 663 of sec3
from fp=16000012776, pc=sec2+31, line 651 of sec2
from fp=16000012744, pc=sec1+31, line 643 of sec1
from fp=16000012712, pc=main+31, line 635 of main
from fp=16000012560, pc=.MAIN.+73, C initializer
from fp= 0, pc=I.INIT+46
END OF FILE
These results will vary with execution.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)