Задайте вопросЗадайте вопрос
 

Отвечено[MACRO][VS2008] Add a "When Hit" Breakpoint with a macro

Ответы

  • 2 июля 2009 г. 7:39Nancy ShaoMSFT, МодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     ОтвеченоС кодом
    Hi Patrice,

    Base on my understanding, you want to subscribe to an event that is triggered when the debugger has hit a break point. If so, you can try to use  DebuggerEvents object to achieve this, the OnEnterBreakMode Event will be fired when entering  break mode. Please refer to following code snippet:

    // Place the following code in the Exec method of the add-in:
    EnvDTE.DebuggerEvents debugEvents = applicationObject.Events.DebuggerEvents;
    debugEvents.OnEnterBreakMode += 
    new _dispDebuggerEvents_OnEnterBreakModeEventHandler(DebuggerEvents.BreakHandler);
    
    // Place the following Event handler code in the add-in:
    // Needed to activate event handlers in Connect.Exec.
    public static void StartEvents(DTE dte)
    {
        System.Windows.Forms.MessageBox.Show("Events are attached.");
    }
    
    // OnEnterBreakMode Event.
    public static void BreakHandler(dbgEventReason reason, ref dbgExecutionAction execAction)
    {
        System.Windows.Forms.MessageBox.Show("Debugger enters break mode. " + 
                                             "Reason: " + reason.ToString());
    }
    

     

    For more information, please see this thread: SDK Package: wanting to subscribe to the c# debugger onBreakPointHit event.

    If I misunderstood you, or you have any questions, please let me know.

    Best Regards,
    Nancy


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.

Все ответы

  • 2 июля 2009 г. 7:39Nancy ShaoMSFT, МодераторМедали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     ОтвеченоС кодом
    Hi Patrice,

    Base on my understanding, you want to subscribe to an event that is triggered when the debugger has hit a break point. If so, you can try to use  DebuggerEvents object to achieve this, the OnEnterBreakMode Event will be fired when entering  break mode. Please refer to following code snippet:

    // Place the following code in the Exec method of the add-in:
    EnvDTE.DebuggerEvents debugEvents = applicationObject.Events.DebuggerEvents;
    debugEvents.OnEnterBreakMode += 
    new _dispDebuggerEvents_OnEnterBreakModeEventHandler(DebuggerEvents.BreakHandler);
    
    // Place the following Event handler code in the add-in:
    // Needed to activate event handlers in Connect.Exec.
    public static void StartEvents(DTE dte)
    {
        System.Windows.Forms.MessageBox.Show("Events are attached.");
    }
    
    // OnEnterBreakMode Event.
    public static void BreakHandler(dbgEventReason reason, ref dbgExecutionAction execAction)
    {
        System.Windows.Forms.MessageBox.Show("Debugger enters break mode. " + 
                                             "Reason: " + reason.ToString());
    }
    

     

    For more information, please see this thread: SDK Package: wanting to subscribe to the c# debugger onBreakPointHit event.

    If I misunderstood you, or you have any questions, please let me know.

    Best Regards,
    Nancy


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.