# Patent

## Title
Diagnostic workflow for production debugging

## Abstract

A diagnostic workflow file can be used to control the future diagnostic actions taken by a debugger without user interaction with the debugger when it executes. The diagnostic workflow file is used by a debugger during a debug session. The debugger performs the actions directed by the diagnostic workflow file to simulate an interactive live debug session. The diagnostic workflow file can include conditional diagnostic operations whose execution depends on the state of program variables, diagnostic variables and diagnostic primitives in the debug session.

## Background
BACKGROUND
Traditional software diagnostic tools typically operate on a live, running process or on saved process state. For example, a live debugger runs on an executing process. A debugger that executes on saved process state does not attach to an executing process and operates by processing a process dump file or historical log files collected while the process being debugged executes. This type of debugger executes separately from the process being debugged, typically sometime after the process being debugged is done executing. Debugging a live process provides little or no historical context about how a process reached its current state. Debugging process dump files and/or log files is typically time consuming and iterative.
SUMMARY
A diagnostic tool can perform live-type debugging on a process as directed by a diagnostic workflow artifact without stopping the process. The diagnostic tool can perform conditional or unconditional breakpoint processing and conditional or unconditional exception processing in a fashion similar to that used for live debugging but without the performance impact that live debugging typically has on a process. “Production” or a “production environment” as used herein refers to an environment in which the software being used has exited from the development and/or testing stage and is “in production” that is, being used to perform actual work rather than being developed and/or tested. The instructions provided in a diagnostic workflow file can be used to control future diagnostic operations of a debugger automatically (without user interaction with the debugger as the debugger executes). Diagnostic operations specified in the diagnostic workflow file can be performed conditionally based on current state of an executing application. “Current state” can include the state of diagnostic primitives. A diagnostic primitive is any operation that impacts the state of the diagnostic tool such as but not limited to creating breakpoints, removing breakpoints, disabling breakpoints, changing the condition of a breakpoint, enabling an exception based on the type of the exception, disabling an exception based on the type of the exception, conditioning exceptions based on the call stack associated with the exception, stepping operations such as stepping into code, stepping over an instruction, etc. and stepping out of code. “Current state” can include the state of various variables including but not limited to program variables and diagnostic variables. Program variables refer to those variables that the program being debugged uses. Diagnostic variables (such as, for example, the value of a variable that holds the number of times a particular breakpoint has been hit, or if an exception of a specified type has been thrown, or if the exception has been thrown at a specified call stack) refer to those variables that are used by the debugger for debugging.
The diagnostic workflow file can be generated from an integrated development environment (IDE) or other development environment. The diagnostic workflow can enable diagnostic actions to be performed automatically (without human interaction) while a program is executing. Diagnostic actions include but are not limited to the following: a breakpoint can be enabled when a specified event occurs, a breakpoint can be disabled when a specified event occurs, a break in program processing or generation of a dump can be enabled when an exception is first thrown, a break in program processing or generation of a dump can be enabled when an exception of a specified type is first thrown, a break in program processing or generation of a dump can be enabled when an exception is first thrown at a particular call stack or at a particular line, the type of the exception can be used as a secondary condition for the break or dump generation, diagnostic logging can be enabled when one of the above conditions occurs, and/or diagnostic logging can be disabled when one of the above conditions occurs, a stepping operation can be performed, a variable can be evaluated, a variable can be written to a log and so on. That is, any action supported by the diagnostic tool that a user would be able to perform directly when the user is in control of the debugger can be can performed automatically driven by the workflow file.
The diagnostic workflow file can be provided to a debug session in a production or non-production environment. The diagnostic workflow can be applied to a live debugging session in a production environment. Actions described in the workflow can dynamically control a debugger or other diagnostic tool without user interaction. The state of the conditions specified in the diagnostic workflow can be made visible in each generated diagnostic artifact. A diagnostic artifact can include a live debugging session, lightweight process snapshots, or process dumps generated from either live processes or from lightweight process snapshots.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.



BRIEF DESCRIPTION OF THE DRAWINGS
In the drawings:
FIG. 1 illustrates an example of a system 100 for generating and/or executing a diagnostic workflow in accordance with aspects of the subject matter described herein;
FIG. 2 illustrates an example of a method 200 comprising an example of a method of generating a diagnostic workflow and/or performing the diagnostic workflow in accordance with aspects of the subject matter disclosed herein;
FIG. 3 is a block diagram of an example of a computing environment in accordance with aspects of the subject matter disclosed herein; and
FIG. 4 is a block diagram of an example of an integrated development environment in accordance with aspects of the subject matter disclosed herein.



DETAILED DESCRIPTION
Overview
A live debugger can provide a user with fine-grained control over debug actions because a user is directly interacting with (controlling the actions of) the debugger. For example, in live debugging, the user can insert a breakpoint into source code. When the breakpoint is encountered during execution of the program, the target process is typically stopped and control of the process is turned over to the user. The user can then perform various debug operations including enabling or disabling a breakpoint, inspecting variable values, inspecting the call stack, and so on. When the user has finished his debug actions, he can direct the processor to resume execution of the application. When debugging an application that it is not reasonable to stop because of the impact on users (e.g., an application miming in a production environment), a user has to guess what information he or she will need to collect and put logging statements in the application to collect that information. Typically this historical information is evaluated offline.
In accordance with some aspects of the subject matter described herein, instructions provided in a diagnostic workflow file can be used to control future diagnostic operations of a debugger without user interaction with the debugger while the debugger is executing. The instructions in the diagnostic workflow file can be executed conditionally. The instructions in the diagnostic workflow file can be executed conditionally based on any combination of the state of: one or more program variables, one or more diagnostic primitives and/or one or more diagnostic variables. A program variable is a variable that is needed by the program. A diagnostic variable is a variable that is needed by the diagnostic tool. A condition that determines whether the instruction in the diagnostic workflow file is executed can include specifying a value of a program variable (e.g., “if an integer variable “i” in the program has the value 13, perform the action”). A condition can also be based on state such as “if the executing thread is named ‘squid’ or the process's name is ‘clam’ perform the action”. The condition can be based on the state of one or more diagnostic primitives. A diagnostic primitive can be any operation which impacts the state of the debugger including but not limited to creating, removing, enabling or disabling breakpoints, changing the condition of a breakpoint (e.g., changing a breakpoint from enabled to disabled or changing a condition on which the breakpoint is executed), enabling or disabling an exception by type, conditioning exceptions by call stack, or debugger operations such as invoking a step operation (step in, step over, step out). The condition can be based on the state of a diagnostic variable such as but not limited to, for example, the value of a variable that specifies the number of times a particular breakpoint has been hit, or if an exception of a specified type has been thrown, or if the exception has been thrown at a specified call stack.
The conditional diagnostic instructions can be inserted dynamically into a miming application in any suitable way. In accordance with some aspects of the subject matter described herein, conditional diagnostic instructions can be inserted dynamically into a running application by, for example, injecting a function call into a snapshot runtime. Each instance of the injected breakpoint can be given a unique identifier at runtime. The unique identifier can be passed to the diagnostic runtime when the breakpoint is hit. The workflow execution environment can then find the particular breakpoint in the diagnostic workflow file and apply the action specified there.
Conditional or unconditional breakpoints and/or conditional or unconditional exception processing inserted into an executing application can be non-stopping. When the instrumented code is executed and a non-stopping breakpoint is encountered, instead of stopping the process and turning control over to a user, additional processing directed by the contents of the diagnostic workflow file can be performed without user interaction. Diagnostic information can be collected. The diagnostic information collected can include a lightweight snapshot of the process state.
Diagnostic Workflow for Production Debugging
A diagnostic workflow file can be created that includes diagnostic instructions that can be conditionally or unconditionally performed in a running application. The diagnostic workflow file can be used to specify conditional or unconditional breakpoint processing that is to be inserted into executing code and conditional or unconditional exception processing that is to be performed in a fashion similar to that used for live debugging. Instead of initiating live debugging, the list of breakpoint binding locations, exception status, and compiled versions of the conditions can be exported to the diagnostic workflow file. The diagnostic workflow file can be applied to a miming application (e.g., using code injection techniques, code rewriting mechanisms, etc.). The application can be executing in a production or non-production (e.g., development, test, staging, etc.) environment.
A workflow comprising one or more instructions for one or more uniquely-identified breakpoints can be specified in the diagnostic workflow file. A workflow comprising one or more instructions for one or more types of exceptions can be specified in the diagnostic workflow file. Exceptions can be identified by, for example, the exception type (or integer code, depending on the type of the exception), by the call stack where the exception is being thrown from, by the catch block that is catching the exception and so on. After the processing that is to occur in the diagnostic session has been specified, in accordance with some aspects of the subject matter described herein, the diagnostic workflow file can be compiled. When the target application is executed, the diagnostic workflow file can be consumed by a diagnostic workflow engine.
The diagnostic workflow engine can perform debug operations as directed by the diagnostic workflow file. The diagnostic workflow engine can initialize the state (e.g., to enabled or disabled) for each production diagnostic event according to the description in the workflow. For example, if a breakpoint (e.g., breakpoint 1) is to be enabled when another event occurs, breakpoint 1 can be initialized to the “disabled” state. The breakpoints and exception handlers can be injected into the process using a runtime profiler such as a common language runtime (CLR) intermediate language (IL) rewriting profiler or any other suitable code rewriting technique. This allows the diagnostic tool to trap various events, evaluate execute conditions, and eventually trigger the handler for the event. The processing specified may include creating a snapshot. The snapshot may be a lightweight process snapshot. The snapshot may reside in memory and may be accessed by a diagnostic tool such as a debugger. The snapshot may be serialized to a memory dump. The memory dump may be consumed offline by a diagnostic tool. At runtime, as each event specified in the diagnostic workflow file occurs on the computing device, the instrumentation injected by the instrumentation engine can make calls to the workflow engine to perform actions as described in the diagnostic workflow file such as enabling or disabling one or more different breakpoints, walking a call stack, type checking an exception and can perform one or more actions based on the result of the specified processing
FIG. 1 illustrates an example of a system 100 that can perform debugging based on a diagnostic workflow file in accordance with aspects of the subject matter described herein. All or portions of system 100 may reside on one or more computers or computing devices such as the computers described below with respect to FIG. 3. System 100 or portions thereof may be provided as a stand-alone system or as a plug-in or add-in. System 100 may execute wholly or partially within an IDE such as IDE 104 or can execute wholly or partially outside an IDE. IDE 104 can be an IDE such as the one described with respect to FIG. 4 or can be any other IDE. All or portions of system 100 may be implemented as a plug-in or add-on.
System 100 or portions thereof may include information obtained from a service (e.g., in the cloud) or may operate in a cloud computing environment. A cloud computing environment can be an environment in which computing services are not owned but are provided on demand. For example, information may reside on multiple devices in a networked cloud and/or data can be stored on multiple devices within the cloud.
System 100 can include one or more computing devices such as, for example, computing device 102. Contemplated computing devices include but are not limited to desktop computers, tablet computers, laptop computers, notebook computers, personal digital assistants, smart phones, cellular telephones, mobile telephones, servers, virtual machines, devices including databases, firewalls and so on. A computing device such as computing device 102 can include one or more processors such as processor 142, etc., and a memory such as memory 144 that communicates with the one or more processors.
System 100 may include any one of or any combination of program modules comprising: an instrumentation engine such as instrumentation engine 114, a diagnostic workflow engine such as workflow engine 116 and/or a debugger or diagnostic tool such as debugger 124. An instrumentation engine such as instrumentation engine 114 can include a diagnostic workflow engine such as workflow engine 116. The diagnostic workflow engine can be external to the instrumentation engine. System 100 can include an execution environment such as production runtime environment 106. Alternatively the execution environment can be a development, staging or testing environment. System 100 can include a second environment such as but not limited to a development environment represented in FIG. 1 by IDE 104.
In accordance with some aspects of the subject matter described herein, a diagnostic workflow file such as diagnostic workflow file 120 can be created can be created by debugger 124 in response to receiving input such as source code 128. The diagnostic workflow file can be used to control future diagnostic operations of a debugger without user interaction with the debugger as the debugger executes. Diagnostic operations specified in the diagnostic workflow file can be performed conditionally based on current state of an executing application. “Current state” can include the state of diagnostic primitives, (e.g., whether or not a certain breakpoint has been hit, whether or not an exception has been thrown) and the state of various variables (such as, for example, the value of a variable that holds the number of times a particular breakpoint has been hit, or if an exception of a specified type has been thrown, or if the exception has been thrown at a specified callstack) or a combination thereof. A diagnostic primitive can be any operation which impacts the state of the debugger including but not limited to creating, removing, or disabling breakpoints, changing the condition of a breakpoint (e.g., from enabled to disabled or from disabled to enabled), enabling or disabling an exception by type, conditioning exceptions based on the call stack the exception is thrown at, or debugger operations such invoking a step operation (step in, step over, step out), etc.
The diagnostic workflow file 120 may be compiled. The diagnostic workflow file 120 or the compiled diagnostic workflow file may be provided to an instrumentation engine 114. The instrumentation engine 114 can dynamically, without taking down or stopping the executing process 108, instrument an original function 110 to create an instrumented function 112. The next time the function is invoked, the instrumented function 112 can be executed instead of the original function 110. In accordance with some aspects of the subject matter described herein, the original function 110 is rewritten to create the instrumented function 112 using a code rewriting mechanism. In accordance with some aspects of the subject matter described herein, the original function 110 is rewritten to create the instrumented function 112 by the instrumentation engine 114.
A diagnostic workflow engine such as workflow engine 116 may perform the processing specified in the diagnostic workflow file 120. For example, the diagnostic workflow engine may enable a second breakpoint (breakpoint B) if a first breakpoint (breakpoint A) has already been encountered. The diagnostic workflow engine may enable a particular breakpoint if an exception of a specified type is thrown. The diagnostic workflow engine may enable a particular breakpoint if an exception of a specified type is thrown at a specified call stack. The diagnostic workflow engine may enable a second conditional breakpoint (breakpoint B) if a first conditional breakpoint (breakpoint A) is not hit because for example, the conditions required for the first conditional breakpoint to fire are not met. The diagnostic workflow engine may disable a particular breakpoint if an exception of a specified type is thrown. The diagnostic workflow engine may disable a second breakpoint (e.g., breakpoint B) if the second breakpoint is encountered in a different session or process than a first breakpoint (e.g., breakpoint A). The diagnostic workflow engine may enable a particular breakpoint if a section of code takes longer than a threshold value to execute (e.g., the section of code may be dependent on events that affect performance). The diagnostic workflow engine may enable creation of a dump at a first chance exception of a specified type if a specified breakpoint has been hit. The diagnostic workflow engine may disable creation of a dump at a first chance exception of a particular type if a particular specified breakpoint has been hit. The diagnostic workflow engine may enable a particular breakpoint if the exception is encountered on the same thread as a second identified breakpoint. The diagnostic workflow engine such as diagnostic workflow engine 116 can collect and persist and/or save debug information (debug artifacts) such as debug information 118.
FIG. 2 illustrates an example of a method 200 for creating and executing a diagnostic workflow file in accordance with aspects of the subject matter described herein. The method described in FIG. 2 can be practiced by a system such as but not limited to the one described with respect to FIG. 1. While method 200 describes a series of steps or operations that are performed in a sequence, it is to be understood that method 200 is not limited by the order of the sequence depicted. For instance, some operations may occur in a different order than that described. In addition, one operation may occur concurrently with another operation. In some instances, not all operations described are performed.
At operation 206 a diagnostic workflow file can be created as described more fully above. The diagnostic workflow file can be compiled. At operation 208 the diagnostic workflow file can be sent to the debug environment. The diagnostic workflow file can be received from a development, test or staging computing machine. The diagnostic workflow file can be received by a production runtime environment on the same computing device or on another computing device.
At operation 210 a function can be instrumented to produce an instrumented function that is executed the next time the function is called. The function can be instrumented by one or more program modules loaded into a memory connected to a processor of a computing machine. At operation 212 the instrumented function can be executed. The instrumented function can be executed by a processor of a computing device. The instrumented function can be processed by a diagnostic workflow engine which determines state and can execute the diagnostic operations specified in the diagnostic workflow file as described more fully above. At operation 214 debug information (e.g., diagnostic artifacts) can be collected. At operation 216 workflow state can be provided. The workflow state may be provided as a display, report, written to a storage medium or by any means known to those of skill in the art.
In accordance with aspects of the subject matter described herein, a computer system can include one or more processors, a memory connected to one or more processors and a diagnostic tool. The diagnostic tool can include one or more program modules that when loaded into the memory can cause the one or more processors to creating a diagnostic workflow file. The diagnostic workflow file can control future diagnostic operations of a debugger automatically (without user interaction with the debugger as the debugger executes). The diagnostic workflow file can include one or more diagnostic operations. The diagnostic workflow file can specify that a diagnostic operation is conditional based on current state of an executing program. Current state can include the state of one or more diagnostic primitives. Current state can include the state of one or more diagnostic variables. Current state can include the state of one or more program variables. The execution of a conditional diagnostic operation can depend on a combination of state of one or more diagnostic primitives, one or more program variables and one or more diagnostic variables.
A method of using a system such as the system described above can include operations such as receiving a diagnostic workflow file by a processor of a computing device. The diagnostic workflow file can include one or more conditional diagnostic operations to be performed where the conditional diagnostic operation is executed depending on the current state of one or more of a program variable, a diagnostic primitive and a diagnostic variable. The current state of the one or more program variables, diagnostic primitives and/or diagnostic variables can be determined. In response to determining that the conditions are met, diagnostic information can be collected. Diagnostic information can be collecting by making a snapshot of process data. The state of the diagnostic information can be displayed (e.g., to a user). A diagnostic primitive can be an instruction to create a breakpoint, remove a breakpoint, enable a breakpoint, disable a breakpoint, change a condition of a breakpoint, enable an exception based on the type of the exception, disable an exception based on the type of the exception, condition an exception based on the call stack the exception is thrown at, perform a debug operation such as a step operation. The state of a diagnostic variable can be determined. A diagnostic variable can be a variable used in a debug operation in the diagnostic workflow file.
A computer-readable storage medium can include computer-readable instructions which when executed cause one or more processors of a computing device to use the instructions provided in the diagnostic workflow file to automatically control diagnostic operations of an instrumented executable in a target process (process being debugged). The instructions can cause the processor to collect diagnostic information. The computer-readable storage medium can include other computer-readable instructions that collected diagnostic information to be provided to a diagnostic tool such as a debugger. The computer-readable storage medium can include other computer-readable instructions that when executed insert instrumented code into a function to generate an instrumented function while the target process executes. The computer-readable storage medium can include other computer-readable instructions that when executed determine state of a diagnostic primitive. A diagnostic primitive can be an operation such as: creating a breakpoint, removing a breakpoint, enabling a breakpoint, disabling a breakpoint, changing a condition of a breakpoint, enabling an exception if it is a specified type, disabling an exception if it is a specified type, conditioning an exception based on if the exception is thrown at a specified call stack executing a step operation. The computer-readable storage medium can include other computer-readable instructions that when executed determine state of a diagnostic variable that is used to perform debug operations. The computer-readable storage medium can include other computer-readable instructions that when executed determine current state of a diagnostic primitive. The computer-readable storage medium can include other computer-readable instructions that when executed determine state of a diagnostic variable referenced in the diagnostic workflow file.
Example of a Suitable Computing Environment
In order to provide context for various aspects of the subject matter disclosed herein, FIG. 3 and the following discussion are intended to provide a brief general description of a suitable computing environment 510 in which various embodiments of the subject matter disclosed herein may be implemented. While the subject matter disclosed herein is described in the general context of computer-executable instructions, such as program modules, executed by one or more computers or other computing devices, those skilled in the art will recognize that portions of the subject matter disclosed herein can also be implemented in combination with other program modules and/or a combination of hardware and software. Generally, program modules include routines, programs, objects, physical artifacts, data structures, etc. that perform particular tasks or implement particular data types. Typically, the functionality of the program modules may be combined or distributed as desired in various embodiments. The computing environment 510 is only one example of a suitable operating environment and is not intended to limit the scope of use or functionality of the subject matter disclosed herein.
With reference to FIG. 3, a computing device in the form of a computer 512 is described. Computer 512 may include at least one processing unit 514, a system memory 516, and a system bus 518. The at least one processing unit 514 can execute instructions that are stored in a memory such as but not limited to system memory 516. The processing unit 514 can be any of various available processors. For example, the processing unit 514 can be a graphics processing unit (GPU). The instructions can be instructions for implementing functionality carried out by one or more components or modules discussed above or instructions for implementing one or more of the methods described above. Dual microprocessors and other multiprocessor architectures also can be employed as the processing unit 514. The computer 512 may be used in a system that supports rendering graphics on a display screen. In another example, at least a portion of the computing device can be used in a system that comprises a graphical processing unit. The system memory 516 may include volatile memory 520 and nonvolatile memory 522. Nonvolatile memory 522 can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM) or flash memory. Volatile memory 520 may include random access memory (RAM) which may act as external cache memory. The system bus 518 couples system physical artifacts including the system memory 516 to the processing unit 514. The system bus 518 can be any of several types including a memory bus, memory controller, peripheral bus, external bus, or local bus and may use any variety of available bus architectures. Computer 512 may include a data store accessible by the processing unit 514 by way of the system bus 518. The data store may include executable instructions, 3D models, materials, textures and so on for graphics rendering.
Computer 512 typically includes a variety of computer readable media such as volatile and nonvolatile media, removable and non-removable media. Computer readable media may be implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer readable media include computer-readable storage media (also referred to as computer storage media) and communications media. Computer storage media includes physical (tangible) media, such as but not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CDROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices that can store the desired data and which can be accessed by computer 512. Communications media include media such as, but not limited to, communications signals, modulated carrier waves or any other intangible media which can be used to communicate the desired information and which can be accessed by computer 512.
It will be appreciated that FIG. 3 describes software that can act as an intermediary between users and computer resources. This software may include an operating system 528 which can be stored on disk storage 524, and which can allocate resources of the computer 512. Disk storage 524 may be a hard disk drive connected to the system bus 518 through a non-removable memory interface such as interface 526. System applications 530 take advantage of the management of resources by operating system 528 through program modules 532 and program data 534 stored either in system memory 516 or on disk storage 524. It will be appreciated that computers can be implemented with various operating systems or combinations of operating systems.
A user can enter commands or information into the computer 512 through an input device(s) 536. Input devices 536 include but are not limited to a pointing device such as a mouse, trackball, stylus, touch pad, keyboard, microphone, voice recognition and gesture recognition systems and the like. These and other input devices connect to the processing unit 514 through the system bus 518 via interface port(s) 538. An interface port(s) 538 may represent a serial port, parallel port, universal serial bus (USB) and the like. Output devices(s) 540 may use the same type of ports as do the input devices. Output adapter 542 is provided to illustrate that there are some output devices 540 like monitors, speakers and printers that require particular adapters. Output adapters 542 include but are not limited to video and sound cards that provide a connection between the output device 540 and the system bus 518. Other devices and/or systems or devices such as remote computer(s) 544 may provide both input and output capabilities.
Computer 512 can operate in a networked environment using logical connections to one or more remote computers, such as a remote computer(s) 544. The remote computer 544 can be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 512, although only a memory storage device 546 has been illustrated in FIG. 3. Remote computer(s) 544 can be logically connected via communication connection(s) 550. Network interface 548 encompasses communication networks such as local area networks (LANs) and wide area networks (WANs) but may also include other networks. Communication connection(s) 550 refers to the hardware/software employed to connect the network interface 548 to the bus 518. Communication connection(s) 550 may be internal to or external to computer 512 and include internal and external technologies such as modems (telephone, cable, DSL and wireless) and ISDN adapters, Ethernet cards and so on.
It will be appreciated that the network connections shown are examples only and other means of establishing a communications link between the computers may be used. One of ordinary skill in the art can appreciate that a computer 512 or other client device can be deployed as part of a computer network. In this regard, the subject matter disclosed herein may pertain to any computer system having any number of memory or storage units, and any number of applications and processes occurring across any number of storage units or volumes. Aspects of the subject matter disclosed herein may apply to an environment with server computers and client computers deployed in a network environment, having remote or local storage. Aspects of the subject matter disclosed herein may also apply to a standalone computing device, having programming language functionality, interpretation and execution capabilities.
The various techniques described herein may be implemented in connection with hardware or software or, where appropriate, with a combination of both. Thus, the methods and apparatus described herein, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as floppy diskettes, CD-ROMs, hard drives, or any other machine-readable storage medium, wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing aspects of the subject matter disclosed herein. As used herein, the term “machine-readable storage medium” shall be taken to exclude any mechanism that provides (i.e., stores and/or transmits) any form of propagated signals. In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. One or more programs that may utilize the creation and/or implementation of domain-specific programming models aspects, e.g., through the use of a data processing API or the like, may be implemented in a high level procedural or object oriented programming language to communicate with a computer system. However, the program(s) can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language, and combined with hardware implementations.
FIG. 4 illustrates an integrated development environment (IDE) 600 and Common Language Runtime Environment 602. An IDE 600 may allow a user (e.g., developer, programmer, designer, coder, etc.) to design, code, compile, test, run, edit, debug or build a program, set of programs, web sites, web applications, and web services in a computer system. Software programs can include source code (component 610), created in one or more source code languages (e.g., Visual Basic, Visual J#, C++. C#, J#, Java Script, APL, COBOL, Pascal, Eiffel, Haskell, ML, Oberon, Perl, Python, Scheme, Smalltalk and the like). The IDE 600 may provide a native code development environment or may provide a managed code development that runs on a virtual machine or may provide a combination thereof. The IDE 600 may provide a managed code development environment using the .NET framework. An intermediate language component 650 may be created from the source code component 610 and the native code component 611 using a language specific source compiler 620 and the native code component 611 (e.g., machine executable instructions) is created from the intermediate language component 650 using the intermediate language compiler 660 (e.g. just-in-time (JIT) compiler), when the application is executed. That is, when an IL application is executed, it is compiled while being executed into the appropriate machine language for the platform it is being executed on, thereby making code portable across several platforms. Alternatively, in other embodiments, programs may be compiled to native code machine language (not shown) appropriate for its intended platform.
A user can create and/or edit the source code component according to known software programming techniques and the specific logical and syntactical rules associated with a particular source language via a user interface 640 and a source code editor 651 in the IDE 600. Thereafter, the source code component 610 can be compiled via a source compiler 620, whereby an intermediate language representation of the program may be created, such as assembly 630. The assembly 630 may comprise the intermediate language component 650 and metadata 642. Application designs may be able to be validated before deployment.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

## Claims

1. A system comprising:
at least one processor:
a memory connected to the at least one processor; and
a diagnostic tool comprising:
at least one program module loaded into the memory, the at least one program module creating a diagnostic workflow file, the diagnostic workflow file including instructions for controlling future diagnostic operations of a debugger without user interaction with the debugger as the debugger executes.

2. The system of claim 1, wherein the diagnostic workflow file comprises at least one conditional diagnostic operation.

3. The system of claim 1, wherein the diagnostic workflow file comprises at least one conditional diagnostic operation, wherein the conditional diagnostic operation is executed based on current state of an executing program.

4. The system of claim 3, wherein current state comprises a state of at least one diagnostic primitive.

5. The system of claim 4, wherein current state comprises a state of at least one diagnostic variable.

6. The system of claim 3, wherein current state comprises a state of at least one program variable.

7. The system of claim 1, wherein the conditional diagnostic operation is executed based on a combination of current state of: a diagnostic primitive, a program variable and a diagnostic variable.

8. A method comprising:
receiving a diagnostic workflow file by a processor of a computing device, the diagnostic workflow file comprising instructions for controlling future diagnostic operations of a debugger without user interaction with the debugger as the debugger executes, the instructions including at least one conditional diagnostic operation wherein the conditional diagnostic operation is executed based on current state of at least one of: a program variable, a diagnostic primitive and a diagnostic variable;
determining the current state of the at least one of: a program variable, a diagnostic primitive and a diagnostic variable; and
collecting diagnostic information.

9. The method of claim 8, further comprising:
collecting diagnostic information by making a snapshot of process data.

10. The method of claim 8, further comprising:
displaying state of diagnostic information.

11. The method of claim 8, further comprising:
determining a state of a diagnostic primitive, the diagnostic primitive comprising one of creating a breakpoint, removing a breakpoint, enabling a breakpoint, disabling a breakpoint, changing a condition of a breakpoint, enabling an exception by type, disabling an exception by type, conditioning an exception based on a call stack the exception is thrown at, a debugger operation comprising a step operation.

12. The method of claim 8, further comprising:
determining a state of a diagnostic variable.

13. The method of claim 12, wherein a diagnostic variable comprises a variable used in debugging.

14. A device comprising:
at least one processor and a memory;
the at least one processor configured to:
use instructions provided in a diagnostic workflow file to automatically control diagnostic operations of an instrumented executable in a target process without user intervention with a debugger as the debugger executes; and
collect diagnostic information.

15. The device of claim 14, wherein the at least one processor is further configured to:
provide the diagnostic information to the debugger.

16. The device of claim 14, wherein the at least one processor is further configured to:
insert instrumented code into a function to generate an instrumented function while the target process executes.

17. The device of claim 14, wherein the at least one processor is further configured to:
determine state of a diagnostic primitive, the diagnostic primitive comprising one: of creating a breakpoint, removing a breakpoint, enabling a breakpoint, disabling a breakpoint, changing a condition of a breakpoint, enabling an exception by type, disabling an exception by type, conditioning an exception based on a call stack at which the exception is thrown, a debugger operation comprising a step operation.

18. The device of claim 14, wherein the at least one processor is further configured to:
determine state of a diagnostic variable comprising a variable used in debugging.

19. The device of claim 14, wherein the at least one processor is further configured to:
determine current state of a diagnostic primitive.

20. The device of claim 14, wherein the at least one processor is further configured to:
determine state of a diagnostic variable referenced in the diagnostic workflow file.