Share via


Redirecting CreatePendingBreakpoint

In this part of the tutorial, you connect the program to the debug engine. This allows the debug engine to redirect requests to create a pending breakpoint to the program that will handle the task.

To connect the program to the debug engine

  1. In Class View, right-click the CEngine class, click Add Function, and add a function with the Function name Start, a Return type of void, an Access type of public, and the following parameter (click Add to add it to the Parameter list):

    Parameter Type

    Parameter Name

    CComObject<CProgram> *

    pProgram

  2. Right-click the CEngine class again, click Add Variable, and add a variable with the Variable name m_pProgram, a Variable type of CComObject<CProgram> *, and an Access type of protected.

  3. Open the Engine.h file and add the following bold line:

    #include "TextInterpreter.h"
    #include "Program.h" 
    
  4. Open the Engine.cpp file and add the following bold line to the CEngine::Start method:

    void CEngine::Start(CComObject<CProgram> * pProgram)
    {
        m_pProgram = pProgram; 
    }
    
  5. In Engine.cpp, find CEngine::CreatePendingBreakpoint and replace the line //TODO: CREATE BREAKPOINT CREATION as well as the following return statement with the following (now that you have a program object to pass the call to).

        return m_pProgram->CreatePendingBreakpoint(pBPRequest, ppPendingBP); 
    
  6. Open the TextInterpreter.cpp file, find the CTextInterpreterModule::MonitorProc function, and replace the line //TODO: ADD ENGINE START with the following (this completes connecting the program to the debug engine):

        pEngine->Start(pProgram); 
    
  7. Build the project to make sure there are no errors.

See Also

Concepts

Creating a Pending Breakpoint