Exemple #1
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, X86ThreadContext threadContext)
        {
            m_engine = engine;
            m_thread = thread;
            m_threadContext = threadContext;

            // Try to get source information for this location. If symbols for this file have not been found, this will fail.
            m_hasSource = m_engine.DebuggedProcess.GetSourceInformation(
                                                            m_threadContext.eip,
                                                            ref m_documentName,
                                                            ref m_functionName,
                                                            ref m_lineNum,
                                                            ref m_numParameters,
                                                            ref m_numLocals);

            // If source information is available, create the collections of locals and parameters and populate them with
            // values from the debuggee.
            if (m_hasSource)
            {
                if (m_numParameters > 0)
                {
                    m_parameters = new VariableInformation[m_numParameters];
                    m_engine.DebuggedProcess.GetFunctionArgumentsByIP(m_threadContext.eip, m_threadContext.ebp, m_parameters);
                }

                if (m_numLocals > 0)
                {
                    m_locals = new VariableInformation[m_numLocals];
                    m_engine.DebuggedProcess.GetFunctionLocalsByIP(m_threadContext.eip, m_threadContext.ebp, m_locals);
                }
            }
        }
 public AD7BoundBreakpoint(AD7Engine engine, uint address, AD7PendingBreakpoint pendingBreakpoint, AD7BreakpointResolution breakpointResolution)
 {
     m_engine = engine;
     m_address = address;
     m_pendingBreakpoint = pendingBreakpoint;
     m_breakpointResolution = breakpointResolution;
     m_enabled = true;
     m_deleted = false;
 }
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            m_pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            m_bpRequestInfo = requestInfo[0];

            m_engine           = engine;
            m_bpManager        = bpManager;
            m_boundBreakpoints = new System.Collections.Generic.List <AD7BoundBreakpoint>();

            m_enabled = true;
            m_deleted = false;
        }
Exemple #4
0
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            m_pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            m_bpRequestInfo = requestInfo[0];

            m_engine = engine;
            m_bpManager = bpManager;
            m_boundBreakpoints = new System.Collections.Generic.List<AD7BoundBreakpoint>();

            m_enabled = true;
            m_deleted = false;
        }
Exemple #5
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, X86ThreadContext threadContext)
        {
            m_engine        = engine;
            m_thread        = thread;
            m_threadContext = threadContext;

            // Try to get source information for this location. If symbols for this file have not been found, this will fail.
            m_hasSource = m_engine.DebuggedProcess.GetSourceInformation(
                m_threadContext.eip,
                ref m_documentName,
                ref m_functionName,
                ref m_lineNum,
                ref m_numParameters,
                ref m_numLocals);
            if (!String.IsNullOrEmpty(threadContext.sName))
            {
                m_functionName = string.Format("{0} in function {1}()", m_functionName, threadContext.sName);
            }

            // If source information is available, create the collections of locals and parameters and populate them with
            // values from the debuggee.
            if (m_hasSource)
            {
                if (m_numParameters > 0)
                {
                    m_parameters = new VariableInformation[m_numParameters];
                    m_engine.DebuggedProcess.GetFunctionArgumentsByIP(m_threadContext.eip, m_threadContext.ebp, m_parameters);
                }

                if (m_numLocals > 0)
                {
                    m_locals = new VariableInformation[m_numLocals];
                    m_engine.DebuggedProcess.GetFunctionLocalsByIP(m_threadContext.eip, m_threadContext.ebp, m_locals);
                }
            }
        }
Exemple #6
0
 public BreakpointManager(AD7Engine engine)
 {
     m_engine = engine;
     m_pendingBreakpoints = new System.Collections.Generic.List<AD7PendingBreakpoint>();
 }
Exemple #7
0
 public AD7Thread(AD7Engine engine, DebuggedThread debuggedThread)
 {
     m_engine         = engine;
     m_debuggedThread = debuggedThread;
 }
Exemple #8
0
 public AD7Thread(AD7Engine engine, DebuggedThread debuggedThread)
 {
     m_engine = engine;
     m_debuggedThread = debuggedThread;
 }
Exemple #9
0
 public AD7MemoryAddress(AD7Engine engine, uint address)
 {
     m_engine = engine;
     m_address = address;
 }
Exemple #10
0
 public EngineCallback(AD7Engine engine, IDebugEventCallback2 ad7Callback)
 {
     m_ad7Callback = ad7Callback;
     m_engine      = engine;
 }
Exemple #11
0
 internal static void Send(AD7Engine engine)
 {
     AD7ProgramCreateEvent eventObject = new AD7ProgramCreateEvent();
     engine.Callback.Send(eventObject, IID, null);
 }
Exemple #12
0
 public EngineCallback(AD7Engine engine, IDebugEventCallback2 ad7Callback)
 {
     m_ad7Callback = ad7Callback;
     m_engine = engine;
 }
Exemple #13
0
 public AD7BreakpointResolution(AD7Engine engine, uint address, AD7DocumentContext documentContext)
 {
     m_engine = engine;
     m_address = address;
     m_documentContext = documentContext;
 }
 public AD7MemoryAddress(AD7Engine engine, uint address)
 {
     m_engine  = engine;
     m_address = address;
 }
        internal static void Send(AD7Engine engine)
        {
            AD7ProgramCreateEvent eventObject = new AD7ProgramCreateEvent();

            engine.Callback.Send(eventObject, IID, null);
        }
        public static void Send(AD7Engine engine)
        {
            AD7EngineCreateEvent eventObject = new AD7EngineCreateEvent(engine);

            engine.Callback.Send(eventObject, IID, null, null);
        }
 AD7EngineCreateEvent(AD7Engine engine)
 {
     m_engine = engine;
 }
Exemple #18
0
 public BreakpointManager(AD7Engine engine)
 {
     m_engine             = engine;
     m_pendingBreakpoints = new System.Collections.Generic.List <AD7PendingBreakpoint>();
 }
        // Compares the memory context to each context in the given array in the manner indicated by compare flags,
        // returning an index of the first context that matches.
        public int Compare(enum_CONTEXT_COMPARE uContextCompare, IDebugMemoryContext2[] compareToItems, uint compareToLength, out uint foundIndex)
        {
            foundIndex = uint.MaxValue;

            try
            {
                enum_CONTEXT_COMPARE contextCompare = (enum_CONTEXT_COMPARE)uContextCompare;

                for (uint c = 0; c < compareToLength; c++)
                {
                    AD7MemoryAddress compareTo = compareToItems[c] as AD7MemoryAddress;
                    if (compareTo == null)
                    {
                        continue;
                    }

                    if (!AD7Engine.ReferenceEquals(this.m_engine, compareTo.m_engine))
                    {
                        continue;
                    }

                    bool result;

                    switch (contextCompare)
                    {
                    case enum_CONTEXT_COMPARE.CONTEXT_EQUAL:
                        result = (this.m_address == compareTo.m_address);
                        break;

                    case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN:
                        result = (this.m_address < compareTo.m_address);
                        break;

                    case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN:
                        result = (this.m_address > compareTo.m_address);
                        break;

                    case enum_CONTEXT_COMPARE.CONTEXT_LESS_THAN_OR_EQUAL:
                        result = (this.m_address <= compareTo.m_address);
                        break;

                    case enum_CONTEXT_COMPARE.CONTEXT_GREATER_THAN_OR_EQUAL:
                        result = (this.m_address >= compareTo.m_address);
                        break;

                    // The sample debug engine doesn't understand scopes or functions
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_SCOPE:
                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_FUNCTION:
                        result = (this.m_address == compareTo.m_address);
                        break;

                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_MODULE:
                        result = (this.m_address == compareTo.m_address);
                        if (result == false)
                        {
                            DebuggedModule module = m_engine.DebuggedProcess.ResolveAddress(m_address);

                            if (module != null)
                            {
                                result = (compareTo.m_address >= module.BaseAddress) &&
                                         (compareTo.m_address < module.BaseAddress + module.Size);
                            }
                        }
                        break;

                    case enum_CONTEXT_COMPARE.CONTEXT_SAME_PROCESS:
                        result = true;
                        break;

                    default:
                        // A new comparison was invented that we don't support
                        return(Constants.E_NOTIMPL);
                    }

                    if (result)
                    {
                        foundIndex = c;
                        return(Constants.S_OK);
                    }
                }

                return(Constants.S_FALSE);
            }
            catch (ComponentException e)
            {
                return(e.HResult);
            }
            catch (Exception e)
            {
                return(EngineUtils.UnexpectedException(e));
            }
        }
Exemple #20
0
 AD7EngineCreateEvent(AD7Engine engine)
 {
     m_engine = engine;
 }
 public AD7BreakpointResolution(AD7Engine engine, uint address, AD7DocumentContext documentContext)
 {
     m_engine          = engine;
     m_address         = address;
     m_documentContext = documentContext;
 }
Exemple #22
0
 public static void Send(AD7Engine engine)
 {
     AD7EngineCreateEvent eventObject = new AD7EngineCreateEvent(engine);
     engine.Callback.Send(eventObject, IID, null, null);
 }