Browse Prior Art Database

Debugging Recursive Procedures

IP.com Disclosure Number: IPCOM000081910D
Original Publication Date: 1974-Aug-01
Included in the Prior Art Database: 2005-Feb-28
Document File: 1 page(s) / 12K

Publishing Venue

IBM

Related People

Seaman, RP: AUTHOR

Abstract

When debugging recursive procedures written in PL/I, symbolic dumps only print the current generations of automatic variables. It is often a requirement to print all generations, and the usual method of obtaining earlier generations is by use of a core dump. The disadvantages of resorting to core dumps are well known. A technique to solve this problem is described below.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 84% of the total text.

Page 1 of 1

Debugging Recursive Procedures

When debugging recursive procedures written in PL/I, symbolic dumps only print the current generations of automatic variables. It is often a requirement to print all generations, and the usual method of obtaining earlier generations is by use of a core dump. The disadvantages of resorting to core dumps are well known. A technique to solve this problem is described below.

The program may consist of several procedures any or all of which may be recursive. An array of entry variables E and a counter N is made known to all procedures in which a dump of the automatic variables is required.

In each procedure P, an inner procedure DEBUG is inserted whose test contains the statement PUT (V1, V2, ...); where V1, V2... are the automatic variables declared in P. At the head of P, the following statements are inserted: N = N + 1; E(N) = DEBUG. At the end of P, the following statement is inserted: N = N - 1. In the main procedure, the following statements are inserted: N = 0; ON ERROR BEGIN; DO I = 1 TO N; CALL E(I): END; END.

The result of these statements is that if ERROR condition is raised at any time during execution, or if the statement SIGNAL ERROR is executed, then a printout occurs of all generations of all active automatic variables.

When debugging from a terminal the automatic variables in any desired activation can be printed, by performing an immediate mode call of the appropriate element of E. For example, suppose the following act...