2

Assuming that the file data is still in the current directory, you can compile and run the program as follows:

hostname% pc -o copy2 copy2.p

hostname% copy2

hello, are you listening? goodbye, I must go now.

Where Did My Program Fail?

SPARCompiler Pascal can trace why a program failed; its traceback utility finds the routine that triggers the error.

Using Pascal Traceback

Pascal traceback installs signal handlers on selected signals and dumps a backtrace when those signals are caught. The backtrace shows the chain of calls leading from the routine in which the error occurred, all the way back to the main program.

Pascal catches the following set of signals:

SIGQUIT SIGIOT SIGFPE SIGSYS SIGTERM

SIGILL SIGABRT SIGBUS SIGPIPE SIGLOST

SIGTRAP SIGEMT SIGSEGV

See the signal(3) man page for further information on these signals.

After the system produces the traceback, it continues with whatever action it would have taken if the interposer had not been in place, including calling a user signal handler that was previously set.

The traceback facility uses the debugger dbx. To obtain a traceback, SPARCworks must be installed on your system, and the directory containing dbx must be in your PATH environment variable. If the traceback routine cannot find dbx, it does not produce the traceback.

Use the -notracecommand-line option to disable traceback.

Pascal Programs

13