Using the -g option – HP SunSoft Pascal 4.0 User Manual

Page 39

Advertising
background image

Pascal Programs

15

2

In this example,

ErrorInHere

reported the error. The

ErrorInHere

procedure was called by

Call1.Call2

, which was in turn called by the main

program. Routine names, such as

Call1.Call2

, indicate a nested routine. If

Pascal cannot find the name of a routine, for example, because the executable
file has been stripped, it prints the hex address.

Using the

-g

Option

If you compile the program with the

–g

option, the traceback also reports the

arguments, the line number, and the file name of each routine.

hostname% pc SegViol.p

hostname% a.out

*** a.out terminated by signal 11: segmentation violation

*** Traceback being written to a.out.trace

Abort (core dumped)

hostname% more a.out.trace

*** Stacktrace of a.out

*** Program terminated due to segmentation violation

[3] __PC0__sigdie(0xb, 0xefffedf0, 0xefffec30, 0x0, 0x1, 0x0), at 0x12128

---- called from signal handler with signal 11 (SIGSEGV) ------

[4] ErrorInHere(), at 0x115ec

[5] Call2(0xefffefc8, 0xefffefa8, 0xefffef88, 0x0, 0xef74dd58, 0x0), at 0x11624

[6] Call1(0x25400, 0x25800, 0x25b80, 0x25b80, 0x3, 0x0), at 0x11660

[7] program(0x1, 0xeffff0fc, 0x4, 0xef7d0000, 0x2, 0xef74dae8), at 0x116a4

[8] main(0x1, 0xeffff0fc, 0xeffff104, 0x25000, 0x0, 0x0), at 0x116e0

detaching from process 17266

Advertising