Event handling in a high level programming language environment5774729Abstract A method and means for handling events in a computer system which occur during the execution of programs including routines prepared in a plurality of computer programming languages is described. The number and identity of each unique computer programming language used in the preparation of the program is determined using a language list contained in the application program. A unique event handling means (event handler) is initialized for each unique computer programming language used in the program. As the program executes selected events of interest to the event handlers are detected. The parameters associated with the selected event are determined. Optionally the detected events may be divided into two types: broadcast or targeted. Broadcast events are sent to all event handlers (except the debug event handler), whereas, the targeted events are sent to a single event handler. An event code and the relevant parameters are passed to the event handlers so that each event handler may perform whatever actions are appropriate for that event in the context of the programming language being supported. The event handlers generate an appropriate return code indicating the success, failure, or non-processing of the event and, for selected events, return request information. The invention provides for a separate specialized debug event handler. Claims What is claimed is: Description TECHNICAL FIELD
TABLE 1
__________________________________________________________________________
Event Codes and Parameters
Event Code
Parm 2
Parm 3
Parm 4 Parm 5
Parm 6
Broadcast
__________________________________________________________________________
Condition
1 CIB results
new condition No
Processing
Enablement
2 CIB results
new condition No
processing dition
SF 0 3 CIB results
new condition
0 No
Cond Processing con-
Option 4 Options
address
INPL 512 No
Proc Block
of cees- work
tart
Main- 5 INPL R13 R0 R1 main-
No
opts inbound to
inbound to
inbound to
opts
CEEINT
CEEINT CEEINT
Process 17 Yes
Init
Language
6 functin No
Utilities code
Dump 7 function Yes
Services code
GOTO 10 target No
Target DSA
DSA
DSA Exit
11 dsa of No
routine term block
Enclave 18 program
INPL member Yes
Create mask specific
returned thread
Enclave 19 INPL Yes
Termination
Process 21 Yes
Termination
Debugger
16 No
Info
ATTERM 15 No
event
New Load
8 load CEES- No
Load module
TART or
module ule or
event entry
0
point
__________________________________________________________________________
The last column of Table 1 indicates whether the event is to be broadcast to all non-dedug event handlers. The specific embodiment of the invention will determine which events should be broadcast, but in general events which have an effect on the entire enclave should be broadcast. This includes the events associated with process and enclave initialization and termination. When a targeted event (non-broadcast) is being processed, the associated event handler must be determined. This is preferably done by examining the PPA for the routine which was executing when the event occurred. Any method of member number identifying the language will work. In the preferred embodiment the preassigned member number is placed in the PPA. It is also possible to serially broadcast a utility event until the correct event handler is found. CEE will invoke member specific initialization routines for process initialization and again for enclave initialization. The resources and capabilities differ between the two events. The following events will be discussed as examples: process initialization enclave initialization process termination enclave termination run-time options event atterm termination event CEE expects its registers to be restored to their original value upon return, conforming to normal calling conventions. The event handler must set the return code in R15 to one of the valid return codes, as follows: return code meaning -4 No action was taken for this event 0 The event was successfully processed 16 The event was not successfully processed and/or the program must be immediately terminated. CEE ABENDs the program if the event handler returns a value of 16 or a value not in the preceding list. Process initialization event: Process initialization is event 17. This event is used to bring up HLL portions at the process level. The order in which the member event handlers are invoked is not defined as part or the invention, but may be otherwise constrained. Upon entry into the member event handler R13 points to a DSA into which the event handler is able to store its caller's registers and R1 contains the address of a standard O/S style plist with a single parameter of event code 17. A combination of Event 17 and Event 18 should initialize the HLL specific aspects of the environment for a given application. The counterpart for this event is event 21. Process termination event: The process termination event code is 21. This event is used to terminate HLL portions at the process level. The order in which the member event handlers are invoked is not defined as part of the invention, but may be otherwise constrained. The plist is an O/S style plist containing the single parameter of the event code for process termination. This event indicates that the HLL should relinquish all resources maintained at the process level. Note all HLL semantics for a terminating application will have already been accomplished by Event 19--enclave termination event. The counterpart for this event is event 17. Enclave initialization event: The enclave initialization event code is 18. This event is used to initialize HLL portions at the enclave level. The order in which the member event handlers are invoked is not defined as part of the invention, but may be otherwise constrained. All CEE services are available at the time of this event. The member can influence the program mask setting by placing its requirements of the program mask into the second parameter as described below. Upon entry into the member event handler for the enclave initialization event, the following is available: R14,R15 are linkage registers R12 addresses the CAA R13 addresses a DSA R1 contains the address of a standard O/S style plist (all of the parameters are passed by reference) with the following plist: 1. event code 18 2. fullword field in which the program mask is held in the right-most bits. Upon input, this field is zero. 3. Initialization plist (INPL) passed to CEEINT 4. member specific thread token (when executing under CICS), or zero The combination of Event 17 and Event 18 should initialize the HLL specific aspects of the environment for a given application. Enclave termination event: The enclave termination event code is 19. This event is used to terminate HLL portions at the enclave level Upon entry into the member event handler, the following is available: R14,R15 are linkage registers R13 addresses a DSA R12 addresses the CAA R1 contains the address of a standard O/S style plist (all of the parameters are passed by reference) with the plist consisting of the following: an event code indicating enclave termination--19 the initialization parameter list that was passed to CEEINT during CEE initialization. This call allows the HLL to semantically terminate the application by enforcing the language semantics of a terminating enclave. Enclave related resources should be released. This event is the counterpart of Event 18. Run-time options event: The run-time options event is number 4. This event has limited capabilities. There is no stack available, nor any CEE callable services. The purpose is to allow the members to handle run-time options in a compatible fashion. The parameter list is as follows: 1. the event code-4 2. the address of an OCB 3. the address of CEESTART 4. the address of the "main" entry point 5. the address of a 512-byte workarea At-term event: The At-term event is invoked during termination of an enclave. It is invoked after all user stack frames have been removed from the stack and prior to invoking the members for the enclave termination event. Only the members that have been explicitly registered via a call to the CEEATTRM service of CEE will be invoked. The parameter list that is passed to this event consists of a single parameter--the event code, 15. The Dump Event Handler: Calls to dump event handler are made with parameters shown in the following sample procedure statement: ##STR1## where: dump.sub.-- event.sub.-- code is a fullword binary integer with a value of 7. function.sub.-- code is a fullword binary integer that specifies the dump function to be performed. It must contain one of the following values: 1 Dump an informational message that explains why the dump is being taken. This function.sub.-- code specifies that the exit of the language library that called CEE3DMP should print the error message that resulted from the dump being taken in the first place. The informational messages would normally be a copy of the error messages sent to MSGFILE for the error. These messages could contain an ABEND code, the Program Status Word, and register contents at time of the error. If CEE3DMP was not called by a member language library, then member language libraries would normally not print any messages in this exit. 2 Dump the arguments of a routine. If the member language cannot distinguish between arguments and local variables for a routine, it should dump the arguments at the same time it is called by dump services to dump variables. 3 Dump the variables of a routine. This includes all local variable and any shred external variables used by the routine. Member language libraries should dump only those variables used or set by the routine if this can be determined. 4 Dump control blocks associated with a routine. This includes the DSA mapped by the member language and any other control blocks associated with the routine that are useful for debugging. This includes compile information, symbol tables, and statement tables. 5 Dump storage for a routine. This includes automatic stack frame storage and static local variable storage. Static data storage shared between this routine and another routine should also be dumped. Only one copy of a shared storage area should be dumped though. 6 Dump control blocks associated with a thread. The CAA for the thread is dumped by CEE. 7 Dump storage associated with a thread. CEE dumps all stack storage associated with the thread. Member languages may dump any other stack storage that is associated with the thread using this exit. Any stack storage used by the thread is dumped even though it may not be associated with it. Only data storage should be dumped. Storage containing code should not be dumped if possible. 8 Dump control blocks associated with an enclave. The EDB for the enclave is dumped by CEE as well as the member list. Member languages should dump communications areas that are linked off of the member list. These are usually the static library communications regions that are part of the application load module. 9 Dump storage associated with an enclave. CEE dumps all heap storage associated with the enclave. Member languages may dump any other storage that is associated with the enclave using this exit. This usually includes storage obtained though direct calls to the operating system storage management. Only data storage should be dumped. Storage containing code should not be dumped if possible. 10 Dump status and attributes of files. CEE dumps the status and attributes of files used by message services. Member languages should dump status and attributes of their own files. This includes all currently open files as well as any previously open files in the course of executing an application. 11 Dump control blocks associated with files. Control blocks and other language-specific control blocks that keep file status are dumped. 12 Dump storage buffers associated with files. These buffers are allocated by the operating system and typically do not use CEE heap services. Buffer storage allocated by CEE heap services may be dumped. 13 Dump control blocks associated with the process. The PCB for the process is dumped by CEE. 14 Dump storage associated with the process. Only data storage should be dumped. Storage containing code should not be dumped. 15 Dump any additional global information. This information appears at the end of the dump report. A list of loaded library modules is an example of additional global information. 16 Dump the variables of the enclave. This includes all static external variables use by the enclave. 17 End of dump call. This indicates that there are no additional calls to the event handler for this instance of dump. additional.sub.-- parms are parameters specific to a certain function code. The following diagram shows the parameters for each function code: notice that the dump.sub.-- event.sub.-- code 7 always precedes the function code.
______________________________________
Parameter Format by Function Code
______________________________________
PROCEDURE (7, 1, fc)
PROCEDURE (7, 2, dsaptr, cibptr, caaptr, edbptr, fc)
PROCEDURE (7, 3, dsaptr, cibptr, caaptr, edbptr, fc)
PROCEDURE (7, 4, dsaptr, cibptr, caaptr, edbptr, fc)
PROCEDURE (7, 5, dsaptr, cibptr, caaptr, edbptr, fc)
PROCEDURE (7, 6, caaptr, edbptr, fc)
PROCEDURE (7, 7, caaptr, edbptr, fc)
PROCEDURE (7, 8, edbptr, fc)
PROCEDURE (7, 9, edbptr, fc)
PROCEDURE (7, 10, edbptr, fc)
PROCEDURE (7, 11, edbptr, fc)
PROCEDURE (7, 12, edbprt, fc)
PROCEDURE (7, 13, pcbptr, fc)
PROCEDURE (7, 14, pcbptr, fc)
PROCEDURE (7, 15, edbptr, fc)
PROCEDURE (7, 16, edbptr, fc)
PROCEDURE (7, 17, fc)
______________________________________
where: dsaptr is a fullword binary integer containing the address of a DSA. cibptr is a fullword binary integer containing the address of the CIB for the routine. This parameter is zero if the routine does not have a CIB. caaptr is a fullword binary integer containing the address of a CAA. edbptr is a fullword binary integer containing the address of an EDB. pcbptr is a fullword binary integer containing the address of a PCB. fc(output) A 12-byte feedback code passed by reference. Three conditions may result from this exit, i.e., successful completion, an error in writing messages to the dump file, or member language dump exit was unsuccessful. Event Handler Utilities Event Various CEE services, including exception handling, perform language-specific functions. To perform these functions, CEE receives information through the member language utility exit. The utility exit passes CEE the information it needs to perform the required processing. It is actually a part of a member event handler, using event code 6. The description and linkage to the event handler for each of these exits is shown below. All linkages have the event code of 6, followed by a unique function code, followed by parameters specific to the utility. DSA Ownership For this exit, a member language specifies if a DSA is associated with a routine owned by or written in it. This exit is used by CEE to determine the owner of code that does not have a PPA-style entry. CEE first checks to see if the code contains a PPA-style entry. The eye catcher of the saved register 15 in the caller's DSA is checked to determine if it points to a CEE entry point. If this is not true, CEE calls member language exits for DSA ownership until a language claims ownership. ##STR2## where: dsaptr (input) is a fullword pointer to an active DSA or save area. ownership (output) is a fullword binary integer set to contain: 0 The source code corresponding to the DSA is not in the member language. 1 The source code corresponding to the DSA is in the member language. Entry Point and Compile Unit Identification For this exit, a member language identifies the entry point name, entry address, compile unit name, compile unit address, and current instruction address for a routine, given the DSA and CIB associated with the routine. This exit is called only if a routine does not have a PPA-style entry. ##STR3## where: dsaptr (input) is a fullword pointer to an active DSA or save area. cihptr (input) is a fullword pointer to the CIB for the current condition, if one exists. Otherwise, this parameter is zero. compile.sub.-- unit.sub.-- name (output) is a fixed-length character string of arbitrary length to contain the name or the compile unit containing the routine associated with the DSA. If the compile unit name cannot be determined, this parameter should be set to all blanks. If the compile unit name cannot fit within the supplied string, it should be truncated. compile.sub.-- unit.sub.-- name.sub.-- length (output) is a fullword binary integer containing the length of the compile unit name string on entry and to contain the actual length of the compile unit name placed in the string on exit. If the compile unit name cannot be determined, this parameter should be set to zero. The maximum length a string may have is 256 bytes. compile.sub.-- unit.sub.-- address (output) is a fullword binary integer to contain the address of the start of the compile unit. If the compile unit address cannot be determined, this parameter should be set to zero. entry.sub.-- name (output) is a fixed length character string of arbitrary length to contain the name of the entry point into the routine associated with the DSA. If the entry point name cannot be determined, this parameter should be set to all blanks. If the entry point name cannot fit within the supplied string, it should be truncated. entry.sub.-- name.sub.-- length (output) is a fullword binary integer containing the length of the entry point name string on entry and to contain the actual length of the entry point name placed in the string on exit. If the entry point name cannot be determined, this parameter should be set to zero. The maximum length a string may have is 256 bytes. entry.sub.-- address (output) is a fullword binary integer to contain the address of the entry point. If the entry address cannot be determined, this parameter should be set to zero. call.sub.-- instruction.sub.-- address (output) is a fullword binary integer to contain the address of the instruction which transferred control out of the routine. This should either be the address of a calling instruction, such as BALR or BASSM, or the address of an interrupted instruction if control was transferred due to a program interrupt. If the address cannot be determined, this parameter should be set to zero. Statement Identification For this exit, a member language identifies the statement number given an instruction address and the entry address into a routine. Also, the address of the DSA for the routine and the address of the CIB for the routine are passed in case current register contents are also needed to determine the statement number. ##STR4## where: entry.sub.-- address (input) is a fullword binary integer containing the address of an entry point into the routine. call.sub.-- instruction.sub.-- address (input) is a fullword binary integer containing the address of an instruction in the statement to be identified. Note that this may also be the address or an instruction in a small routine which does not have its own DSA (for example, fetch glue code). In such cases, the small routine is considered an extension of the code for the statement which called the routine. In these cases, the member language should pass back the statement number of the caller of the small routine. dsaptr (input) is a fullword pointer containing the address of the DSA for the routine. cibptr (input) is a fullword pointer containing the address of the CIB for the current condition. If there is no CIB, this parameter will be zero. statement.sub.-- id (output) is a fixed-length character string of arbitrary length to contain the statement identifier of the instruction pointed to by call.sub.-- instruction.sub.-- address. If the statement cannot be determined, this parameter should be set to all blanks. If the statement id cannot fit within the supplied string, it should be truncated. statement.sub.-- id.sub.-- length (output) is a fullword binary integer containing the length of the statement id string on entry and the actual length of the statement id placed in the string on exit. If the statement id cannot be determined, this parameter should be set to zero. The maximum length a string may have is 256 bytes. DSA Classification For this exit, a member language identifies the type of DSA that is associated with the procedure. ##STR5## where: dsaptr (input) is a fullword pointer containing the address of the DSA or save area. class (output) is a fixed binary(31) fullword passed by reference indicating the classification of the passed DSA. The following is the format of the returned fullword. It can be quickly checked to distinguish library code from compiled code identify the member, and allow the members to qualify the type of compiled/library if needed. For example, PL/I can distinguish begin blocks, On units, Procedures, etc. X'abcd yyzz' where zz-is the member id with a max of X'FF' yy-is used by the member to qualify the compiled code type or the library code type d-is 1 if library code is 2 if compiled code The return values should be uniquely associated with a DSA owner. The actual assigned values are arbitrary and may be altered without affecting the invention. For example, X'0001 0005' might be assigned to COBOL compiler library routines while X'0002 0005' might be used for COBOL compiled code. The Debugger Event Handler: The debug event handler must be loadable by CEE with the name "CEEEVDBG." Specification of which debugger to be used is made at execution time by exposing its name to the system for CEE to LOAD. A load failure indicates to CEE that a debugger is not available during the execution of this program. Since the name CEEEVDBG only needs to be unique within the load library, there can be multiple debug event handlers in different load libraries. Only one will be used for any particular execution of a program. The Debugger Event Handler is loaded and initialized when any one of the following occurs: An initial command string or PROMPT is discovered and the TEST run-time option is in effect. The error condition is raised for the first time and the TEST run-time option is in effect with the ERROR sub-option specified. Any condition is raised for the first time and the TEST run-time option is in effect with the ALL sub-option specified. A call to CEETEST is made, regardless of the TEST run-time option setting. CEE will notify the debugger of events via the Debugger Event Handler. The parameter lists are defined in Table 2.
TABLE 2
______________________________________
Debugger/CEE event handler interface
Debugger Debugger
Event Event Code
parm 2 parm 3 parm 4
______________________________________
condition 101 CIB result code
raised
goto 111 dsa
enclave init
118 creator's edb
enclave term
119
debugger term
121
thread init
120 creator's caa
thread term
122
external entry
123 + +dsa cmd string
INPL
module load
124 dsa module
descriptor
module delete
125 dsa module name
storage free
126 storage storage length
condition 127 CIB result code
promote
condition goto
128 dsa
attention 129
debugger 130 result code
program check
message 131 msg.sub.-- text
ddname
redirect
CALL CEETEST
132 + +dsa cmd string
______________________________________
For the terms used in Table 2, the following definitions apply: module name halfword prefixed string of the module name being deleted. module descriptor is a structure describing the module just loaded. The structure is as follows: dcl 1 module descriptor, 3 load point pointer, 3 module size fixed, 3 entry point pointer, 3 name length fixed(15), 3 module name char(255); result code fixed(31) binary value action for condition manager to take. storage length fixed(31) binary value containing the number of bytes of storage. cmd string halfword prefixed string containing the debugger command. msg.sub.-- text halfword prefixed string of the text that will be transmitted via CEE message services. ddname CL8 string, left justified, padded right with blanks of the target ddname. INPL the Initialization Parameter List as passed to CEEINT. Notes 1. All parameters are passed by reference. 2. ++-requestor's dsa, meaning an hll library routine dsa is likely the requestor of the CEE service or user's dsa. 3. Return codes are placed in register 15 00-success 16-Critical error in the debugger. Do not invoke again. Using the foregoing specifications the invention may be implemented using standard programming and/or engineering techniques. The resulting program(s) may be stored on disk, diskettes, memory cards, ROM or any other memory device. For execution, the program may be copied into the RAM of the computer. One skilled in the art of computer science will easily be able to combine the software created as described with appropriate general purpose or special purpose computer hardware to create a computer system embodying the invention. While the preferred embodiment of the present invention has been illustrated in detail, it should be apparent that modifications and adaptations to that embodiment may occur to one skilled in the art without departing from the scope of the present invention as set forth in the following claims.
|
Same subclass Same class Consider this |
||||||||||
