Exemple #1
0
 public MonoDocumentContext(string fileName, TEXT_POSITION start, TEXT_POSITION end, MonoMemoryAddress address)
 {
     _fileName = fileName;
     _start    = start;
     _end      = end;
     _address  = address;
 }
        public MonoDocumentContext GetDocumentContext(uint address)
        {
            TEXT_POSITION[] startPosition;
            TEXT_POSITION[] endPosition;
            var             documentName = _breakpointManager.Engine.GetLocationInfo(_requestInfo.bpLocation.unionmember2,
                                                                                     out startPosition,
                                                                                     out endPosition);
            var codeContext = new MonoMemoryAddress(_breakpointManager.Engine, address, null);

            return(new MonoDocumentContext(documentName, startPosition[0], endPosition[0], codeContext));
        }
Exemple #3
0
        /// <summary>
        ///     Gets the code context for this stack frame. The code context represents the current instruction pointer in this
        ///     stack frame.
        /// </summary>
        /// <param name="memoryAddress">The memory address.</param>
        /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
        public int GetCodeContext(out IDebugCodeContext2 memoryAddress)
        {
            memoryAddress = null;

            try
            {
                memoryAddress = new MonoMemoryAddress(_engine, (uint)_frame().Address, null);
                return(S_OK);
            }
            catch (ComponentException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemple #4
0
        /// <summary>
        ///     Gets the breakpoint resolution information that describes this breakpoint.
        /// </summary>
        /// <param name="fields">The fields.</param>
        /// <param name="resolutionInfo">The resolution information.</param>
        /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
        public int GetResolutionInfo(enum_BPRESI_FIELDS fields, BP_RESOLUTION_INFO[] resolutionInfo)
        {
            if ((fields & enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION) != 0)
            {
                // The sample engine only supports code breakpoints.
                var location = new BP_RESOLUTION_LOCATION {
                    bpType = (uint)enum_BP_TYPE.BPT_CODE
                };

                // The debugger will not QI the IDebugCodeContex2 interface returned here. We must pass the pointer
                // to IDebugCodeContex2 and not IUnknown.
                var codeContext = new MonoMemoryAddress(_engine, _address, _documentContext);
                location.unionmember1           = Marshal.GetComInterfaceForObject(codeContext, typeof(IDebugCodeContext2));
                resolutionInfo[0].bpResLocation = location;
                resolutionInfo[0].dwFields     |= enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION;
            }


            return(S_OK);
        }
 /// <summary>
 ///     Adds a specified value to the current context's address to create a new context.
 /// </summary>
 /// <param name="dwCount">The count.</param>
 /// <param name="newAddress">The new address.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 public int Add(ulong dwCount, out IDebugMemoryContext2 newAddress)
 {
     newAddress = new MonoMemoryAddress(_engine, (uint)dwCount + _address, _documentContext);
     return(S_OK);
 }
 /// <summary>
 ///     Subtracts a specified value from the current context's address to create a new context.
 /// </summary>
 /// <param name="dwCount">The count.</param>
 /// <param name="ppMemCxt">The memory context.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 public int Subtract(ulong dwCount, out IDebugMemoryContext2 ppMemCxt)
 {
     ppMemCxt = new MonoMemoryAddress(_engine, (uint)dwCount - _address, _documentContext);
     return(S_OK);
 }