Exemple #1
0
        /// <summary>
        ///     Enumerates the code contexts for a given position in a source file.
        /// </summary>
        /// <param name="pDocPos"></param>
        /// <param name="ppEnum"></param>
        /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
        public int EnumCodeContexts(IDebugDocumentPosition2 pDocPos, out IEnumDebugCodeContexts2 ppEnum)
        {
            TEXT_POSITION[] startPosition;
            TEXT_POSITION[] endPosition;
            var             documentName = GetLocationInfo(pDocPos, out startPosition, out endPosition);

            var textPosition = new TEXT_POSITION {
                dwLine = startPosition[0].dwLine + 1
            };
            var documentContext = new MonoDocumentContext(documentName, textPosition, textPosition, null);

            ppEnum = new MonoCodeContextEnumerator(new IDebugCodeContext2[]
                                                   { new MonoMemoryAddress(this, 0, documentContext) });
            return(S_OK);
        }
Exemple #2
0
        /// <summary>
        ///     Gets the document context for this stack frame. The debugger will call this when the current stack frame is changed
        ///     and will use it to open the correct source document for this stack frame.
        /// </summary>
        /// <param name="docContext">The document context.</param>
        /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
        public int GetDocumentContext(out IDebugDocumentContext2 docContext)
        {
            docContext = null;
            try
            {
                if (_hasSource)
                {
                    // Assume all lines begin and end at the beginning of the line.
                    // TODO: Accurate line endings
                    var lineNumber = (uint)LineNumber;
                    var begTp      = new TEXT_POSITION
                    {
                        dwColumn = 0,
                        dwLine   = lineNumber - 1
                    };
                    var endTp = new TEXT_POSITION
                    {
                        dwColumn = 0,
                        dwLine   = lineNumber - 1
                    };

                    docContext = new MonoDocumentContext(_documentName, begTp, endTp, null);
                    return(S_OK);
                }
            }
            catch (ComponentException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }

            return(S_FALSE);
        }
 public MonoMemoryAddress(MonoEngine engine, uint address, MonoDocumentContext documentContext)
 {
     _engine          = engine;
     _address         = 0;
     _documentContext = documentContext;
 }
Exemple #4
0
 public MonoBreakpointResolution(MonoEngine engine, uint address, MonoDocumentContext documentContext)
 {
     _engine          = engine;
     _address         = address;
     _documentContext = documentContext;
 }