Share via


Sending the Breakpoint Event

When the session debug manager (SDM) has finished processing the entry point event (as represented by the IDebugEntryPointEvent2 interface), it calls IDebugProgram2::Continue to continue execution of the program being debugged. The IDebugProgram2::Continue method is implemented by CProgram::Continue; that method sends a WM_CONTINUE message to TextInterpreter’s main thread, where the message pump converts the message into a call to CProgram::Go.

At this point, CProgram::Go has been called once already (in response to the load complete event), so now you want to simulate a breakpoint encounter. (It’s as though the program continues execution and then encounters a breakpoint. Since TextInterpreter doesn’t really “execute” the program, you are faking the execution by immediately firing the last breakpoint set.)

When the SDM has finished handling the breakpoint and the user continues execution, the program being debugged exits (TextInterpreter understands only one breakpoint, and once that breakpoint is handled, there is no need to do anything more other than to “exit” the program being debugged.)

To send the breakpoint event

  1. In Class View, right-click the CProgram class, click Add Variable, and add a variable with the Variable name bEntered, the Variable type of bool, and an Access type of protected.

  2. Open the Program.cpp file, find CProgram::Go, and insert the following bold lines::

            return;
        }
    
        if (!bEntered) 
        { 
            bEntered = true; 
    
            // Fire breakpoint event. 
            CCodeBreakpointEvent *pCBPE = new CCodeBreakpointEvent(gpBP); 
            pCBPE->SendEvent(m_spCallback, m_spEngine, this, this); 
    
            return; 
        } 
    
  3. Build the project to make sure there are no errors.

See Also

Concepts

Firing the Breakpoint Event