This application generally relates to computer systems, and more particularly to monitoring a computer program executing in a computer system.
As part of software development, it may be useful to obtain execution information about a software application, such as information regarding program performance and execution coverage. This information gathering may be performed by monitoring the software application as it executes in a computer system. In particular, there exists manual and automated techniques for gathering execution information about a software application. This information may include profiling, coverage, and program tracing data to enable a software developer, for example, to identify performance bottlenecks, testing coverage performed for a particular application, monitor memory accesses, and the like.
Machine executable code that comprises a software application may be executed in a computer system. The machine executable code may be produced using one of two basic approaches of translation of input, such as source code. One approach may be referred to as a generative approach, and the second approach may be referred to as a single-stage translation approach. Both approaches may be characterized in the process by which output, such as machine executable code, may be produced given an input, such as source code.
The generative approach to translation may be characterized generally as a two-stage process of translation and then execution. For example, a source language program may be translated, as by compilation and linking, to produce a machine language program. This machine language program may then be executed with a set of data to produce output execution results. Generally, translation and execution may be characterized as distinct conceptual phases. Translation may precede execution by some arbitrary amount of time. The production of a machine language program allows for subsequent executions of the machine language program with additional input data sets without repeating translation.
In contrast, the single-stage translation approach may be characterized as a single stage process in which the source language program, for example, may be translated into actions that directly result in the production of output data. Generally, a machine language or other intermediate form of the program may not be produced. Translation and execution are intimately linked in a single stage. In other words, translation time is deferred until execution time and the source language program is translated each time it is executed.
Generally, software application monitoring techniques exist, for example, such as in connection with gathering test coverage and profiling information using the generative approach and the single-stage translation approach. To collect execution information in connection with monitoring a software application produced using either the generative approach or the single-stage translation approach, existing techniques may include instrumenting source code. Instrumenting source code may include, for example, manually modifying source code to gather and output additional information at various points in program execution, such using one or more special application programming interface (API) routines.
Automated techniques may be used in connection with the generative approach. For example, intermediate code and object code as may be produced using a compiler may be instrumented to generate and gather profiling data at various points in program execution.
Drawbacks with instrumenting source code may include manually modifying the source code and then, subsequently recompiling or reinterpreting the modified source code. A drawback with the foregoing automated instrumentation technique is that pre-execution instrumentation may be required, for example, such as instructing the compiler to generate code used in connection with program monitoring, and the like.
One technique that may be used with both the generative and the one-stage translation approaches involves special hooks as may be provided by a particular translator. For example, a particular translator may provide a mechanism, such as callbacks, for notification and transfer of control to monitoring software upon the occurrence of certain events. Using this technique, control may be transferred at particular points, such as when certain runtime functions or subroutines are invoked, to special monitoring routines that may inject and/or extract information prior to executing the actual code associated with a routine. Use of this technique may alleviate the need to modify and then recompile or reinterpret the modified source code. However, there is a dependency upon a vendor of the generative translator or one-stage approach translator to provide these hooks.
A problem may exist when no such hooks are provided. With a generative translator, other techniques may be used to gather execution data, such as patching an address of an actual runtime routine or modifying symbol resolution during linking, to transfer control to a xe2x80x9cdummyxe2x80x9d routine. The dummy routine may perform monitoring tasks and then subsequently transfer control to the actual routine. However, this technique when used with a generative translator may have drawbacks, such as requiring a modification to the linking procedure to produce an object file.
When no hooks are provided in connection with a one-stage approach translator, there may be no way of instrumenting the application to generate and gather program execution data in connection with program monitoring, for example, due to the single combined process of translation and execution. JavaScript and VBScript are examples of two commercially available languages that use the one-stage approach and do not provide these xe2x80x9chooksxe2x80x9d. Thus, it is difficult to obtain execution information, such as may be desired with program behavior monitoring, in connection with code written in JavaScript and VBScript, for example.
Thus, it may be useful to provide an efficient technique for gathering execution information about an application without requiring instrumentation or hooking capabilities.
In accordance with principles of the invention are a method and computer program product for monitoring execution of an application in a computer system. Debugging information is reported to a program monitor using an application debugging interface. Program execution information is gathered using the debugging information to monitor execution of the application.