本文整理汇总了C#中StackFrame类的典型用法代码示例。如果您正苦于以下问题:C# StackFrame类的具体用法?C# StackFrame怎么用?C# StackFrame使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StackFrame类属于命名空间,在下文中一共展示了StackFrame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: execute
public override void execute(StackFrame frame)
{
long val1 = (long) frame.popOperand();
long val2 = (long) frame.popOperand();
frame.pushOperand(val1 & val2);
}
示例2: execute
// TODO: Actually implement threads
public override void execute(StackFrame frame)
{
Heap.HeapReference heapRef = (Heap.HeapReference) frame.popOperand();
ToyVMObject obj = (ToyVMObject) heapRef.obj;
obj.monitorExit();
}
示例3: WhoAmI
public void WhoAmI(string arg1)
{
Assembly assembly = Assembly.GetExecutingAssembly();
System.Type t = assembly.GetType(this.ToString()); // Get only this class
Console.WriteLine("This class name is: {0}", t.ToString());
MethodInfo[] mInfo = t.GetMethods();
MemberInfo[] bInfo = t.GetMembers();
FieldInfo[] fInfo = t.GetFields();
foreach (MethodInfo m in mInfo)
Console.WriteLine("Method: {0}", m.Name);
foreach (MemberInfo b in bInfo)
Console.WriteLine("Member: {0}", b.Name);
foreach (FieldInfo f in fInfo)
Console.WriteLine("Field: {0}", f.Name);
StackFrame stackFrame = new StackFrame();
MethodBase methodBase = stackFrame.GetMethod();
Console.WriteLine("This method name is : {0}", methodBase.Name );
/*System.Type[] types = assembly.GetTypes();
foreach (System.Type t in types)
{
Console.WriteLine("Tipo: {0}", t.ToString());
MethodInfo[] mInfo = t.GetMethods();
MemberInfo[] bInfo = t.GetMembers();
foreach (MethodInfo m in mInfo)
Console.WriteLine("Modulo: {0}", m.Name);
foreach (MemberInfo b in bInfo)
Console.WriteLine("Miembro: {0}", b.Name);
}*/
}
示例4: execute
public override void execute(StackFrame frame)
{
if (depth > 0){
throw new ToyVMException("Don't support dup2 with depth of " + depth,frame);
}
Object obj = frame.popOperand();
Object obj2 = null;
if (frame.hasMoreOperands()){
obj2 = frame.popOperand();
}
/*System.Collections.Stack temp = new System.Collections.Stack();
for (int i = 0; i < depth; i++){
temp.Push(frame.popOperand());
}
frame.pushOperand(obj); // insert at depth depth
while (temp.Count > 0){
frame.pushOperand(temp.Pop());
}
*/
frame.pushOperand(obj); // put the duplicated one back on top
if (obj2 != null){
frame.pushOperand(obj2);
}
frame.pushOperand(obj); // put the duplicated one back on top
if (obj2 != null){
frame.pushOperand(obj2);
}
}
示例5: StackFrameNode
public StackFrameNode(StackFrame stackFrame)
{
this.stackFrame = stackFrame;
this.Name = stackFrame.MethodInfo.Name;
this.ChildNodes = GetChildNodes();
}
示例6: execute
public override void execute(StackFrame frame)
{
Object val2 = frame.popOperand();
Object val1 = frame.popOperand();
//Heap.HeapReference val2 = (Heap.HeapReference) frame.popOperand();
//Heap.HeapReference val1 = (Heap.HeapReference) frame.popOperand();
bool eval = false;
switch (opval){
case OP_EQ:{
eval = (val1 == val2);
break;
}
case OP_NE:{
eval = (val1 != val2);
break;
}
default: throw new ToyVMException("Not handling " + opval,frame);
}
if (eval){
int pc = frame.getProgramCounter();
frame.setProgramCounter(pc + branch - size);
}
}
示例7: execute
public override void execute(StackFrame frame)
{
int val1 = (int) frame.popOperand();
int val2 = (int) frame.popOperand();
frame.pushOperand(val1 & val2);
}
示例8: GetLocation
public TargetLocation GetLocation(StackFrame frame)
{
return (TargetLocation) frame.Thread.ThreadServant.DoTargetAccess (
delegate (TargetMemoryAccess target) {
return GetLocation (frame, target);
});
}
示例9: execute
public override void execute(StackFrame frame)
{
ClassFile clazz = ToyVMClassLoader.loadClass(method.GetClassInfo().getClassName());
ConstantPoolInfo_NameAndType nameAndType = method.GetMethodNameAndType();
if (log.IsDebugEnabled) log.DebugFormat("Will be executing {0} on {1}",nameAndType,clazz.GetName());
MethodInfo methodInfo = clazz.getMethod(nameAndType);
// TODO: Need better way of handling access to the method
if (methodInfo == null){
throw new ToyVMException("Unable to locate method " + nameAndType + " on " + clazz,frame);
}
StackFrame frame2 = new StackFrame(frame);
int paramCount = method.getParameterCount();
frame2.setMethod(clazz,methodInfo,paramCount);
if (log.IsDebugEnabled) log.DebugFormat("Have {0} parameters",paramCount);
// Store the parameters from the operand stack
// into the local variables of the outgoing frame
for (int i = paramCount; i > 0; i--){
frame2.getLocalVariables()[i-1]=frame.popOperand();
if (log.IsDebugEnabled) log.DebugFormat("Parameter {0} = {1}",i,frame2.getLocalVariables()[i-1]);
}
clazz.execute(nameAndType,frame2);
/*methodInfo.execute(frame2);
if (methodInfo != null){
}
else {
throw new Exception("Unable to locate " + nameAndType.ToString());
}
*/
}
示例10: execute
public override void execute(StackFrame frame)
{
double val1 = (double) frame.popOperand();
double val2 = (double) frame.popOperand();
frame.pushOperand(val2 - val1);
}
示例11: GetObject
// <summary>
// Retrieve an instance of this variable from the stack-frame @frame.
// May only be called if Type.HasObject is true.
// </summary>
// <remarks>
// An instance of IVariable contains information about a variable (for
// instance a parameter of local variable of a method), but it's not
// bound to any particular target location. This also means that it won't
// get invalid after the target exited.
// </remarks>
public TargetObject GetObject(StackFrame frame)
{
return (TargetObject) frame.Thread.ThreadServant.DoTargetAccess (
delegate (TargetMemoryAccess target) {
return GetObject (frame, target);
});
}
示例12: execute
public override void execute(StackFrame frame)
{
Object val = frame.popOperand();
int index = (int) frame.popOperand();
Heap.HeapReference heapRef = (Heap.HeapReference) frame.popOperand();
if (! heapRef.isArray){
throw new ToyVMException("Expected array, got " + heapRef,frame);
}
if (! heapRef.isPrimitive){
ArrayList arr = (ArrayList) heapRef.obj;
arr[index] = val;
}
else if (heapRef.primitiveType.Equals(Type.GetType("System.Char[]"))){
ArrayList arr = (ArrayList) heapRef.obj;
arr[index] = val;
//System.Char[][] arr = (System.Char[][]) heapRef.obj;
//Heap.HeapReference arrVal = (Heap.HeapReference)val;
//arr[index] = (System.Char[])arrVal.obj;
}
else {
throw new ToyVMException("Can't handle " + heapRef,frame);
}
if (log.IsDebugEnabled) log.DebugFormat("Stored {0} at index {1}",val,index);
}
示例13: execute
public override void execute(StackFrame frame)
{
float val1 = (float) frame.popOperand();
float val2 = (float) frame.popOperand();
frame.pushOperand(val1 + val2);
}
示例14: GetFilteredFrames
/// <summary>
/// Filters and copies the specified array of .NET stack frames
/// </summary>
/// <param name="stackFrames"></param>
/// <returns></returns>
private StackFrame[] GetFilteredFrames(SysStackFrame[] stackFrames) {
StackFrame[] result = null;
int resultIndex = 0;
for (int i = 0; i < stackFrames.Length; i++) {
SysStackFrame current = stackFrames[i];
// postpone allocating the array until we know how big it should be
if (result == null) {
// filter the top irrelevant frames from the stack
if (!this._stackTraceFilter.IsRelevant(current)) {
continue;
}
result = new StackFrame[stackFrames.Length + MethodsToKeep - i];
// copy last frames to stack
for (int j = i-MethodsToKeep; j < i; j++) {
result[resultIndex] = StackFrame.Create(stackFrames[j]);
resultIndex++;
}
}
result[resultIndex] = StackFrame.Create(stackFrames[i]);
resultIndex ++;
}
return result;
}
示例15: Analyze
protected override void Analyze(StackFrame frame, string framePointer)
{
EnsureRelativeUriWithUriBaseId(
frame.Uri,
frame.UriBaseId,
framePointer);
}