Execution tracing in a child process

This tutorial describes how to collect an execution trace in a child process of an application.

This tutorial covers the following:

    1. Using the launch dialog to specify the child process to monitor and the instance number of that child process.
    2. How to use the Bug Validator user interface to collect execution traces in the child process.

Related tutorials:

Execution tracing in a service.
Execution tracing in a service child process.
Execution tracing in an IIS ISAPI DLL.
Execution tracing for a child process from the command line.

Native applications

This tutorial applies to all native applications, services and IIS ISAPI extensions.

Example Application and Child Process Application

Bug Validator ships with an example application and an example child process launched by the application. These can be found in the  following directories in the Bug Validator installation directory:

  • examples\nativeExample
  • examples\serviceWithAChildProcess\childProcess 

You need to build both of these projects. The easiest thing to do is to build the examples.sln.

Collecting execution traces in the child process

Now that you have the example projects build, we can start collecting execution traces from the child process.

  1. Choose the Launch > Applications > Launch Application… option.
    Bug Validator native and .Net launch menu
  2. The Launch dialog is displayed.
    Bug Validator native and .Net launch dialog
  3. Click Browse… next to Application to Launch and choose the executable that is going to launch the process you want to start collecting execution traces from. You can also choose a batch file or a powershell script. For this tutorial we’re going to start examples\nativeExample\ReleaseDynamic10_0\nativeExample.exe.
    Bug Validator native and .Net launch dialog native example
  4. Now we need to specify which child processes will be launched by the parent process. Click Edit… next to Application to Monitor.
    Bug Validator native and .Net edit application to monitor
    The Applications to Monitor dialog will be displayed.
    Memory Validator native and .Net applications to monitor dialog
  5. We need to add an application definition. Click Add…. The Application to Monitor dialog will be displayed.
    Memory Validator native and .Net application to monitor dialog
  6. To add an application click Add…. The Application and DLL dialog is displayed.
    Memory Validator native and .Net Application and DLL dialog
  7. Type the path to the child process executable or use the Browse… button to open a Microsoft file dialog to select the child process executable. For this tutorial we’re going to choose the child process executable: examples\nativeExample\ReleaseDynamic10_0\childProcess.exe.  
    Bug Validator native and .Net Application and DLL child process
  8. Click OK to complete adding the child process definition. Repeat steps 6 and 7 to add as many child process definitions as you need for your process.
  9. When you have added all the child process definitions click OK to close the Application To Monitor dialog.
    For this tutorial we’re only adding one child process definition, so click OK.
  10. Click OK to close the Applications To Monitor dialog.
  11. If you examine the Application to Monitor field on the launch dialog you can see it now has some entries in addition to the name of the file we’re going to launch.
    Bug Validator native and .Net application to monitor combo
  12. Choose the child process in the Application to Monitor field.
    Bug Validator native and .Net application to monitor child process
  13. We’re going to monitor the first childProcess.exe that is launched. This is the default, indicated by the 1 in the Launch Count combo below the Application to Monitor field. If you wanted to monitor the third childProcess.exe that is launched you’d set this to 3. 
  14. Now that we’ve specified the process to launch and the child process we can start the Application to Launch.
    Click Launch….
    Bug Validator starts the Application to Launch (in this tutorial that’s nativeExample.exe).
  15. When nativeExample.exe is running choose the Child Process menu then choose Start ChildProcess….
    Bug Validator native example child process
    The child process is started. In this tutorial that’s childProcess.exe.
    For childProcess.exe you’ll see a cmd prompt open, there will be a pause while the application runs, then it will close.
  16. Bug Validator will instrument your applications’s child process and start collecting execution trace data.
  17. Thread synchronization data will be collected until the child process finishes executing.  For best results, we recommend closing the child process normally (do not kill it with TaskManager or TerminateProcess). 
  18. You can close the parent process whenever you want – Bug Validator is not tracking it.
  19. When the child process finishes executing Bug Validator will display the execution trace results.
    Bug Validator native and .Net execution trace results

How Do I Repeat This?

There are three method of repeating this.

  1. To repeat launching the parent process and monitoring the child process just click the relaunch button on the toolbar.

     

  2. You can open the launch dialog then double click on an entry in the list at the bottom of the dialog.
    Bug Validator native and .Net launch dialog native example relaunch
  3. You can open the launch dialog then select an entry in the list at the bottom of the dialog, edit any settings on the dialog, then click Launch.

I need to execution trace a grand child process or other descendant. How do I do that?

The method described above only works for child processes of a parent process.
 
If you have a process that is a descendent process deeper than a child process read this article about Loading Validator into an application.

I’m not getting any execution trace data. What can I do?

There are a few things to check.

  1. Data Collection
    Have you got data collection turned off?
    There is a Collect data from application check box on the launch dialog.
    There are also data collection on/off buttons on the main toolbar, and Start collecting data and Stop collecting data options on the File menu.
  2. Diagnostics
    Check the diagnostics tab. If the injection and data transport is working correctly Bug Validator will have some data. Information on instrumentation failures will be on the diagnostic tab.
  3. Debug Information
    Check the debug information dialog. You can access this from the Tools > DLL Debug Information… menu. This dialog will tell you which DLLs have debug information and which do not. Any DLLs that don’t have debug information you’ll need to ensure that debug information is built for these DLLs and is findable.

Conclusion

You have learned how to launch an application and monitor a child process launched by that application, how to use Bug Validator to monitor the application’s child process, and what to look at to diagnose errors if things don’t work first time.

 

 

Fully functional, free for 30 days