EnvDTE::Breakpoints Add, C++ RRS feed

  • Question

  • Hi!

    I'm trying to set breakpoint in porgram using EnvDTE::Debugger interface, by Breakpoints::Add(), in C++. In C# it is very simple, but I can't find any examples for C++.

    My task is to add breakpoint at the begin of specified function by it name. 

    Documentation says that all 12 parameters of Add() are optional, but for C++ it's wrong, and I don't understand which params I must give to this method to set breakpoint in start of function.

    Help, please.

    And sorry for my bad English.

    Monday, October 1, 2012 3:45 PM


  • From the IDL we see this:

    HRESULT Add([in, optional, defaultvalue("")] BSTR Function, 
                    [in, optional, defaultvalue("")] BSTR File, 
                    [in, optional, defaultvalue(1)] long Line,
                    [in, optional, defaultvalue(1)] long Column,
                    [in, optional, defaultvalue("")] BSTR Condition,
                    [in, optional, defaultvalue(dbgBreakpointConditionTypeWhenTrue)] dbgBreakpointConditionType ConditionType,
                    [in, optional, defaultvalue("")] BSTR Language,
                    [in, optional, defaultvalue("")]BSTR Data,
                    [in, optional, defaultvalue(1)] long DataCount,
                    [in, optional, defaultvalue("")]BSTR Address,
                    [in, optional, defaultvalue(0)] long HitCount,
                    [in, optional, defaultvalue(dbgHitCountTypeNone)] dbgHitCountType HitCountType,
                    [out, retval] Breakpoints** Breakpoints);

    The MIDL reference says optional is only valid on VARIANT parameters. I don't see headers being generated for the IDL file and I don't see any typelibs in the SDK...so it is unclear how they expect people to use this in C++. I suppose you could simply localy declare the interface(s), in which case the above shows what the default values are, so you can either put them in the interface decl or just plug them in at the callsite.

    I suspect the required parameters would at least be the file and line and column of the start of the method where you want to place the breakpoint.


    • Marked as answer by Ego Jiang Tuesday, October 9, 2012 8:52 AM
    • Unmarked as answer by NebirosZerG2 Thursday, October 11, 2012 7:54 PM
    • Marked as answer by NebirosZerG2 Thursday, October 11, 2012 7:54 PM
    Monday, October 1, 2012 7:35 PM