本文整理汇总了C#中IDebugStackFrame2类的典型用法代码示例。如果您正苦于以下问题:C# IDebugStackFrame2类的具体用法?C# IDebugStackFrame2怎么用?C# IDebugStackFrame2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDebugStackFrame2类属于命名空间,在下文中一共展示了IDebugStackFrame2类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanSetNextStatement
public int CanSetNextStatement(IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext)
{
DLog.Debug(DContext.VSDebuggerComCall, "IDebugThread2.CanSetNextStatement");
var stack = (DebugStackFrame)pStackFrame;
var ctx = (DebugCodeContext)pCodeContext;
if (stack == null || ctx == null)
return VSConstants.E_FAIL;
if (ctx.Location.Equals(stack.Location))
return VSConstants.S_OK;
if (!ctx.Location.IsSameMethod(stack.Location))
return HResults.E_CANNOT_SETIP_TO_DIFFERENT_FUNCTION;
// for now, only allow to set the position above the current position.
if(ctx.Location.Index >= stack.Location.Index)
return VSConstants.E_FAIL;
// don't check existence of special code, so that we can produce a warning
// below.
//var loc = stack.GetDocumentLocationAsync().Await(DalvikProcess.VmTimeout);
//if (loc.Document == null)
// return VSConstants.E_FAIL;
return VSConstants.S_OK;
}
示例2: SetNextStatement
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public override int SetNextStatement (IDebugStackFrame2 stackFrame, IDebugCodeContext2 codeContext)
{
//
// Sets the next statement to the given stack frame and code context.
//
LoggingUtils.PrintFunction ();
try
{
throw new NotImplementedException ();
return Constants.S_OK;
}
catch (Exception e)
{
LoggingUtils.HandleException (e);
return Constants.E_FAIL;
}
}
示例3:
// Determines whether the next statement can be set to the given stack frame and code context.
int IDebugThread2.CanSetNextStatement(IDebugStackFrame2 stackFrame, IDebugCodeContext2 codeContext)
{
// CLRDBG TODO: This implementation should be changed to compare the method token
ulong addr = ((AD7MemoryAddress)codeContext).Address;
AD7StackFrame frame = ((AD7StackFrame)stackFrame);
if (frame.ThreadContext.Level != 0 || frame.Thread != this || !frame.ThreadContext.pc.HasValue || _engine.DebuggedProcess.MICommandFactory.Mode == MIMode.Clrdbg)
{
return Constants.S_FALSE;
}
if (addr == frame.ThreadContext.pc)
{
return Constants.S_OK;
}
string toFunc = EngineUtils.GetAddressDescription(_engine.DebuggedProcess, addr);
string fromFunc = EngineUtils.GetAddressDescription(_engine.DebuggedProcess, frame.ThreadContext.pc.Value);
if (toFunc != fromFunc)
{
return Constants.S_FALSE;
}
return Constants.S_OK;
}
示例4: GetLogicalThread
public int GetLogicalThread(IDebugStackFrame2 pStackFrame, out IDebugLogicalThread2 ppLogicalThread)
{
throw new NotImplementedException();
}
示例5: SetNextStatement
public int SetNextStatement(IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext)
{
return VSConstants.S_FALSE;
}
示例6: NotSupportedException
int IDebugProgram3.EnumCodePaths(string pszHint, IDebugCodeContext2 pStart, IDebugStackFrame2 pFrame, int fSource, out IEnumCodePaths2 ppEnum, out IDebugCodeContext2 ppSafety)
{
throw new NotSupportedException("This method has been replaced by IDebugProgramEnhancedStep90.EnumCodePaths.");
}
示例7:
int IDebugThread2.CanSetNextStatement(IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext)
{
Debug.WriteLine("AD7ProgramNode: Entering CanSetNextStatement");
return VSConstants.S_OK;
}
示例8: CanSetNextStatement
/// <summary>
/// Determines whether the current instruction pointer can be set to the given stack frame.
/// </summary>
/// <param name="pStackFrame">Reserved for future use; set to a null value. If this is a null value, use the current stack frame.</param>
/// <param name="pCodeContext">An IDebugCodeContext2 object that describes the code location about to be executed and its context.</param>
/// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
/// <remarks>If this method returns S_OK, then call the IDebugThread2::SetNextStatement method to actually set the next statement.</remarks>
public virtual int CanSetNextStatement( IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext )
{
Logger.Debug( string.Empty );
return VSConstants.E_NOTIMPL;
}
示例9: NotImplementedException
int IDebugThread2.GetLogicalThread(IDebugStackFrame2 pStackFrame, out IDebugLogicalThread2 ppLogicalThread)
{
Debug.WriteLine("AD7ProgramNode: Entering GetLogicalThread");
throw new NotImplementedException();
}
示例10:
int IDebugThread2.CanSetNextStatement(IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext)
{
return VSConstants.S_OK;
}
示例11: GetLogicalThread
public int GetLogicalThread(IDebugStackFrame2 pStackFrame, out IDebugLogicalThread2 ppLogicalThread)
{
DLog.Debug(DContext.VSDebuggerComCall, "IDebugThread2.GetLogicalThread");
throw new NotImplementedException();
}
示例12: SetNextStatement
/// <summary>
///
/// </summary>
public int SetNextStatement(IDebugStackFrame2 pStackFrame, IDebugCodeContext2 pCodeContext)
{
// TODO: move this code to DalvikThread, or to a SetNextInstructionManager
DLog.Debug(DContext.VSDebuggerComCall, "IDebugThread2.SetNextStatement");
var stack = (DebugStackFrame)pStackFrame;
var ctx = (DebugCodeContext)pCodeContext;
// nothing to do.
if (ctx.Location.Equals(stack.Location))
return VSConstants.S_OK;
if (!ctx.Location.IsSameMethod(stack.Location))
return HResults.E_CANNOT_SETIP_TO_DIFFERENT_FUNCTION;
var loc = stack.GetDocumentLocationAsync().Await(DalvikProcess.VmTimeout);
if (loc.MethodEntry == null)
{
DLog.Info(DContext.VSStatusBar, "Can not set next instruction: Debug info not available.");
return HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL;
}
var nextInstrVar = loc.MethodEntry.Variables.FirstOrDefault(v => v.Name == DebuggerConstants.SetNextInstructionVariableName);
if (nextInstrVar == null)
{
DLog.Info(DContext.VSStatusBar, "Can not set next instruction: missing compiler setting or method optimized.");
return HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL;
}
// make sure there are no branch instructions
// between the current instruction and our branch instruction.
// note that for convinence, we *do* allow assignments to
// fields of objects, even though these are visible to the
// program.
var disassembly = Program.DisassemblyProvider.GetFromLocation(loc);
if (disassembly == null)
return HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL;
var body = disassembly.Method.Body;
int idx = body.Instructions.FindIndex(i => (ulong)i.Offset == loc.Location.Index);
if(idx == -1)
return HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL;
bool foundSetNextInstruction = false;
for (;idx < body.Instructions.Count; ++idx)
{
var ins = body.Instructions[idx];
foundSetNextInstruction = ins.OpCode == OpCodes.If_nez && ins.Registers.Count == 1
&& ins.Registers[0].Index == nextInstrVar.Register;
if (foundSetNextInstruction)
break;
if (ins.OpCode.IsJump())
break;
}
if (!foundSetNextInstruction)
{
DLog.Info(DContext.VSStatusBar, "Can not set next instruction from current position. Try again at a later position if any.");
return HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL;
}
DLog.Info(DContext.VSStatusBar, "Setting next instruction to beginning of block.");
// find target instruction.
var targetIns = (Instruction)body.Instructions[idx].Operand;
idx = body.Instructions.FindIndex(p => p.Offset == targetIns.Offset);
idx = FindNextLocationWithSource(disassembly, idx) ?? idx;
targetIns = body.Instructions[idx];
var targetLoc = loc.Location.GetAtIndex(targetIns.Offset);
// set a temporary breakpoint. The reset logic could get into a "DalvikTemporaryBreakpoint" class.
var bp = new DalvikAwaitableBreakpoint(targetLoc);
var waitBp = bp.WaitUntilHit();
var waitBound = Debugger.Process.BreakpointManager.SetBreakpoint(bp);
try
{
if (!waitBound.Await(DalvikProcess.VmTimeout))
return HResults.E_CANNOT_SET_NEXT_STATEMENT_GENERAL;
// set the special variable.
var newSlotVal = new SlotValue(nextInstrVar.Register, Jdwp.Tag.Int, 1);
Debugger.StackFrame.SetValuesAsync(stack.Thread.Id, stack.Id, newSlotVal)
.Await(DalvikProcess.VmTimeout);
// resume the process.
Debugger.Process.ResumeAsync();
// wait for breakpoint to be hit.
try
{
waitBp.Await(1000);
}
catch (Exception)
//.........这里部分代码省略.........
示例13:
// Determines whether the next statement can be set to the given stack frame and code context.
// The sample debug engine does not support set next statement, so S_FALSE is returned.
int IDebugThread2.CanSetNextStatement(IDebugStackFrame2 stackFrame, IDebugCodeContext2 codeContext)
{
return Constants.S_FALSE;
}
示例14: EnumCodePaths
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public int EnumCodePaths (string pszHint, IDebugCodeContext2 pStart, IDebugStackFrame2 pFrame, int fSource, out IEnumCodePaths2 ppEnum, out IDebugCodeContext2 ppSafety)
{
//
// Enumerates the code paths of this program.
//
LoggingUtils.PrintFunction ();
try
{
//
// Get the entire call-stack for the current thread, and enumerate.
//
CLangDebuggeeStackFrame stackFrame = pFrame as CLangDebuggeeStackFrame;
IDebugThread2 thread;
LoggingUtils.RequireOk (stackFrame.GetThread (out thread));
CLangDebuggeeThread stackFrameThread = thread as CLangDebuggeeThread;
List<DebuggeeStackFrame> threadCallStack = stackFrameThread.StackTrace (uint.MaxValue);
List <CODE_PATH> threadCodePaths = new List <CODE_PATH> ();
for (int i = 0; i < threadCallStack.Count; ++i)
{
string frameName;
IDebugCodeContext2 codeContext;
DebuggeeStackFrame frame = threadCallStack [i] as DebuggeeStackFrame;
LoggingUtils.RequireOk (frame.GetName (out frameName));
LoggingUtils.RequireOk (frame.GetCodeContext (out codeContext));
if (codeContext != null)
{
CODE_PATH codePath = new CODE_PATH ();
codePath.bstrName = frameName;
codePath.pCode = codeContext;
threadCodePaths.Add (codePath);
}
}
ppEnum = new DebuggeeProgram.EnumeratorCodePaths (threadCodePaths);
ppSafety = null;
return Constants.S_OK;
}
catch (Exception e)
{
LoggingUtils.HandleException (e);
ppEnum = null;
ppSafety = null;
return Constants.E_FAIL;
}
}
示例15: GetLogicalThread
/// <summary>
/// Debug engines do not implement this method.
/// </summary>
/// <param name="pStackFrame">An IDebugStackFrame2 object that represents the stack frame.</param>
/// <param name="ppLogicalThread">Returns an IDebugLogicalThread2 interface that represents the associated logical thread. A debug engine implementation should set this to a null value.</param>
/// <returns>Debug engine implementations always return E_NOTIMPL.</returns>
public virtual int GetLogicalThread( IDebugStackFrame2 pStackFrame, out IDebugLogicalThread2 ppLogicalThread )
{
Logger.Debug( string.Empty );
ppLogicalThread = null;
return VSConstants.E_NOTIMPL;
}