Ejemplo n.º 1
0
        // Creates a pending breakpoint in the engine. A pending breakpoint is contains all the information needed to bind a breakpoint to
        // a location in the debuggee.
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest,
                                                  out IDebugPendingBreakpoint2 ppPendingBP)
        {
            Log.Debug("Engine: CreatePendingBreakPoint");

            ppPendingBP = null;

            var info = new BP_REQUEST_INFO[1];

            info[0].bpLocation.bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_FILE_LINE;
            if (pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, info) == VSConstants.S_OK)
            {
                var    position = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(info[0].bpLocation.unionmember2);
                var    start    = new TEXT_POSITION[1];
                var    end      = new TEXT_POSITION[1];
                string fileName;

                position.GetRange(start, end);
                position.GetFileName(out fileName);

                //VS has a 0 based line\column value. PowerShell starts at 1
                var breakpoint = new ScriptBreakpoint(
                    _node,
                    fileName,
                    (int)start[0].dwLine + 1,
                    (int)start[0].dwColumn,
                    _events);
                ppPendingBP = breakpoint;

                _events.BreakpointAdded(breakpoint);

                bps.Add(breakpoint);
            }

            return(VSConstants.S_OK);
        }