本文整理汇总了C#中Mono.Debugging.Client.SourceLocation类的典型用法代码示例。如果您正苦于以下问题:C# SourceLocation类的具体用法?C# SourceLocation怎么用?C# SourceLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SourceLocation类属于Mono.Debugging.Client命名空间,在下文中一共展示了SourceLocation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SoftEvaluationContext
public SoftEvaluationContext(SoftDebuggerSession session, StackFrame frame, DC.EvaluationOptions options)
: base(options)
{
Frame = frame;
Thread = frame.Thread;
Domain = frame.Domain;
string method = frame.Method.Name;
if (frame.Method.DeclaringType != null)
method = frame.Method.DeclaringType.FullName + "." + method;
var location = new DC.SourceLocation (method, frame.FileName, frame.LineNumber, frame.ColumnNumber, frame.EndLineNumber, frame.EndColumnNumber, frame.Location.SourceFileHash);
string language;
if (frame.Method != null) {
language = frame.IsNativeTransition ? "Transition" : "Managed";
} else {
language = "Native";
}
Evaluator = session.GetEvaluator (new DC.StackFrame (frame.ILOffset, location, language, session.IsExternalCode (frame), true));
Adapter = session.Adaptor;
this.session = session;
stackVersion = session.StackVersion;
sourceAvailable = !string.IsNullOrEmpty (frame.FileName) && System.IO.File.Exists (frame.FileName);
}
示例2: ResolveType
static string ResolveType (string identifier, SourceLocation location)
{
switch (identifier) {
case "SomeClassInNamespace":
return "MonoDevelop.Debugger.Tests.TestApp.SomeClassInNamespace";
case "ParentNestedClass":
return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluationParent.ParentNestedClass";
case "NestedClass":
return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedClass";
case "TestEvaluation":
return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation";
case "NestedGenericClass`2":
return "MonoDevelop.Debugger.Tests.TestApp.TestEvaluation.NestedGenericClass";
case "Dictionary`2":
return "System.Collections.Generic.Dictionary";
case "Thing`1":
return "Thing";
case "A":
return "A";
case "B":
return "B";
case "C":
return "C";
case "System":
return "System";
case "MonoDevelop":
return "MonoDevelop";
case "SomeEnum":
return "SomeEnum";
}
return null;
}
示例3: StackFrame
public StackFrame (long address, SourceLocation location, string language, bool isExternalCode, bool hasDebugInfo)
{
this.address = address;
this.location = location;
this.language = language;
this.isExternalCode = isExternalCode;
this.hasDebugInfo = hasDebugInfo;
}
示例4: CreateStackFrame
DC.StackFrame CreateStackFrame (MDB.StackFrame frame)
{
string method = frame.Method.Name;
if (frame.Method.DeclaringType != null)
method = frame.Method.DeclaringType.FullName + "." + method;
var location = new DC.SourceLocation (method, frame.FileName, frame.LineNumber);
var lang = frame.Method != null? "Managed" : "Native";
return new DC.StackFrame (frame.ILOffset, frame.Method.FullName, location, lang, session.IsExternalCode (frame), true);
}
示例5: CreateStackFrame
DC.StackFrame CreateStackFrame (MDB.StackFrame frame)
{
MDB.MethodMirror method = frame.Method;
MDB.TypeMirror type = method.DeclaringType;
string methodName = method.Name;
if (type != null)
methodName = type.FullName + "." + methodName;
var location = new DC.SourceLocation (methodName, SoftDebuggerSession.NormalizePath (frame.FileName), frame.LineNumber);
var lang = frame.Method != null ? "Managed" : "Native";
return new DC.StackFrame (frame.ILOffset, method.FullName, location, lang, session.IsExternalCode (frame), true, type.Module.FullyQualifiedName, type.FullName);
}
示例6: StackFrame
public StackFrame (long address, string addressSpace, SourceLocation location, string language, bool isExternalCode, bool hasDebugInfo, string fullModuleName, string fullTypeName)
{
this.address = address;
this.addressSpace = addressSpace;
this.location = location;
this.language = language;
this.isExternalCode = isExternalCode;
this.hasDebugInfo = hasDebugInfo;
this.fullModuleName = fullModuleName;
this.fullTypeName = fullTypeName;
}
示例7: SoftEvaluationContext
public SoftEvaluationContext (SoftDebuggerSession session, StackFrame frame, DC.EvaluationOptions options): base (options)
{
Frame = frame;
Thread = frame.Thread;
string method = frame.Method.Name;
if (frame.Method.DeclaringType != null)
method = frame.Method.DeclaringType.FullName + "." + method;
var location = new DC.SourceLocation (method, frame.FileName, frame.LineNumber);
var lang = frame.Method != null? "Managed" : "Native";
Evaluator = session.GetEvaluator (new DC.StackFrame (frame.ILOffset, location, lang, session.IsExternalCode (frame), true));
Adapter = session.Adaptor;
this.session = session;
this.stackVersion = session.StackVersion;
sourceAvailable = !string.IsNullOrEmpty (frame.FileName) && System.IO.File.Exists (frame.FileName);
}
示例8: Start
protected void Start (string test)
{
TargetRuntime runtime;
switch (EngineId) {
case "MonoDevelop.Debugger.Win32":
runtime = Runtime.SystemAssemblyService.GetTargetRuntime ("MS.NET");
break;
case "Mono.Debugger.Soft":
runtime = Runtime.SystemAssemblyService.GetTargetRuntimes ()
.OfType<MonoTargetRuntime> ()
.OrderByDescending(o => o.Version)
.FirstOrDefault ();
break;
default:
runtime = Runtime.SystemAssemblyService.DefaultRuntime;
break;
}
if (runtime == null) {
Assert.Ignore ("Runtime not found for: {0}", EngineId);
return;
}
Console.WriteLine ("Target Runtime: " + runtime.DisplayRuntimeName + " " + runtime.Version);
// main/build/tests
FilePath path = Path.GetDirectoryName (GetType ().Assembly.Location);
var exe = Path.Combine (path, "MonoDevelop.Debugger.Tests.TestApp.exe");
var cmd = new DotNetExecutionCommand ();
cmd.TargetRuntime = runtime;
cmd.Command = exe;
cmd.Arguments = test;
if (Platform.IsWindows) {
var monoRuntime = runtime as MonoTargetRuntime;
if (monoRuntime != null) {
var psi = new System.Diagnostics.ProcessStartInfo (Path.Combine (monoRuntime.Prefix, "bin", "pdb2mdb.bat"), cmd.Command);
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
System.Diagnostics.Process.Start (psi).WaitForExit ();
}
}
var dsi = engine.CreateDebuggerStartInfo (cmd);
var soft = dsi as SoftDebuggerStartInfo;
if (soft != null) {
var assemblyName = AssemblyName.GetAssemblyName (exe);
soft.UserAssemblyNames = new List<AssemblyName> ();
soft.UserAssemblyNames.Add (assemblyName);
}
Session = engine.CreateSession ();
var ops = new DebuggerSessionOptions ();
ops.EvaluationOptions = EvaluationOptions.DefaultOptions;
ops.EvaluationOptions.AllowTargetInvoke = AllowTargetInvokes;
ops.EvaluationOptions.EvaluationTimeout = 100000;
path = path.ParentDirectory.ParentDirectory.Combine ("src", "addins", "MonoDevelop.Debugger", "MonoDevelop.Debugger.Tests.TestApp", test + ".cs").FullPath;
SourceFile = TextFile.ReadFile (path);
TestName = test;
AddBreakpoint ("break");
var done = new ManualResetEvent (false);
Session.OutputWriter = (isStderr, text) => Console.WriteLine ("PROC:" + text);
Session.TargetHitBreakpoint += (sender, e) => {
done.Set ();
Frame = e.Backtrace.GetFrame (0);
lastStoppedPosition = Frame.SourceLocation;
targetStoppedEvent.Set ();
};
Session.TargetExceptionThrown += (sender, e) => {
Frame = e.Backtrace.GetFrame (0);
for (int i = 0; i < e.Backtrace.FrameCount; i++) {
if (!e.Backtrace.GetFrame (i).IsExternalCode) {
Frame = e.Backtrace.GetFrame (i);
break;
}
}
lastStoppedPosition = Frame.SourceLocation;
targetStoppedEvent.Set ();
};
Session.TargetStopped += (sender, e) => {
Frame = e.Backtrace.GetFrame (0);
lastStoppedPosition = Frame.SourceLocation;
targetStoppedEvent.Set ();
};
var targetExited = new ManualResetEvent (false);
Session.TargetExited += delegate {
targetExited.Set ();
};
//.........这里部分代码省略.........
示例9: Resolve
public abstract string Resolve (DebuggerSession session, SourceLocation location, string exp);
示例10: OnResolveExpression
/// <summary>
/// Called when an expression needs to be resolved
/// </summary>
/// <param name='expression'>
/// The expression
/// </param>
/// <param name='location'>
/// The source code location
/// </param>
/// <returns>
/// The resolved expression
/// </returns>
protected virtual string OnResolveExpression (string expression, SourceLocation location)
{
return defaultResolver.Resolve (this, location, expression);
}
示例11: UpdateSourceFile
public void UpdateSourceFile(string newFilePath)
{
location = new SourceLocation (location.MethodName, newFilePath, location.Line, location.Column, location.EndLine, location.EndColumn, location.FileHash);
}
示例12: CreateStackFrame
DC.StackFrame CreateStackFrame (MDB.StackFrame frame)
{
MDB.MethodMirror method = frame.Method;
MDB.TypeMirror type = method.DeclaringType;
string fileName = frame.FileName;
string typeFullName = null;
string typeFQN = null;
string methodName;
if (fileName != null)
fileName = SoftDebuggerSession.NormalizePath (fileName);
if (method.VirtualMachine.Version.AtLeast (2, 12) && method.IsGenericMethod) {
StringBuilder name = new StringBuilder (method.Name);
name.Append ('<');
if (method.VirtualMachine.Version.AtLeast (2, 15)) {
bool first = true;
foreach (var argumentType in method.GetGenericArguments ()) {
if (!first)
name.Append (", ");
name.Append (session.Adaptor.GetDisplayTypeName (argumentType.FullName));
first = false;
}
}
name.Append ('>');
methodName = name.ToString ();
} else {
methodName = method.Name;
}
// Compiler generated anonymous/lambda methods
bool special_method = false;
if (methodName [0] == '<' && methodName.Contains (">m__")) {
int nidx = methodName.IndexOf (">m__") + 2;
methodName = "AnonymousMethod" + methodName.Substring (nidx, method.Name.Length - nidx);
special_method = true;
}
if (type != null) {
string typeDisplayName = session.Adaptor.GetDisplayTypeName (type.FullName);
if (SoftDebuggerAdaptor.IsGeneratedType (type)) {
// The user-friendly method name is embedded in the generated type name
var mn = SoftDebuggerAdaptor.GetNameFromGeneratedType (type);
// Strip off the generated type name
int dot = typeDisplayName.LastIndexOf ('.');
var tname = typeDisplayName.Substring (0, dot);
// Keep any type arguments
int targs = typeDisplayName.LastIndexOf ('<');
if (targs > dot + 1)
mn += typeDisplayName.Substring (targs, typeDisplayName.Length - targs);
typeDisplayName = tname;
if (special_method)
typeDisplayName += "." + mn;
else
methodName = mn;
}
methodName = typeDisplayName + "." + methodName;
typeFQN = type.Module.FullyQualifiedName;
typeFullName = type.FullName;
}
var location = new DC.SourceLocation (methodName, fileName, frame.LineNumber);
var external = session.IsExternalCode (frame);
return new SoftDebuggerStackFrame (frame, method.FullName, location, "Managed", external, true, typeFQN, typeFullName);
}
示例13: CreateFrame
internal static StackFrame CreateFrame (MicroFrameworkDebuggerSession session, CorDebugFrame frame)
{
string file = "";
int line = 0;
string method = "";
string lang = "";
if (frame.FrameType == CorFrameType.ILFrame) {
if (frame.Function != null) {
uint tk = TinyCLR_TypeSystem.SymbollessSupport.TinyCLRTokenFromMethodDefToken (frame.Function.Token);
uint md = TinyCLR_TypeSystem.ClassMemberIndexFromTinyCLRToken (tk, frame.Function.Assembly);
method = session.Engine.GetMethodName (md, true);
var reader = frame.Function.Assembly.DebugData;
if (reader != null) {
var sim = new MethodSymbols (new Mono.Cecil.MetadataToken (frame.Function.Token));
//Ugliest hack ever
if(reader is Mono.Cecil.Mdb.MdbReader) {
for(int i = 0; i < 100; i++)
sim.Variables.Add(new VariableDefinition(null));
}
reader.Read (sim);
InstructionSymbol prevSp = new InstructionSymbol (-1, null);
foreach (var sp in sim.Instructions) {
if (sp.Offset > frame.IP)
break;
prevSp = sp;
}
if (prevSp.Offset != -1) {
line = prevSp.SequencePoint.StartLine;
file = prevSp.SequencePoint.Document.Url;
}
}
}
lang = "Managed";
}
// else if(frame.FrameType == CorFrameType.NativeFrame)
// {
// frame.GetNativeIP(out address);
// method = "<Unknown>";
// lang = "Native";
// }
else if (frame.FrameType == CorFrameType.InternalFrame) {
switch (((CorDebugInternalFrame)frame).FrameInternalType) {
case CorDebugInternalFrameType.STUBFRAME_M2U:
method = "[Managed to Native Transition]";
break;
case CorDebugInternalFrameType.STUBFRAME_U2M:
method = "[Native to Managed Transition]";
break;
case CorDebugInternalFrameType.STUBFRAME_LIGHTWEIGHT_FUNCTION:
method = "[Lightweight Method Call]";
break;
case CorDebugInternalFrameType.STUBFRAME_APPDOMAIN_TRANSITION:
method = "[Application Domain Transition]";
break;
case CorDebugInternalFrameType.STUBFRAME_FUNC_EVAL:
method = "[Function Evaluation]";
break;
}
}
if (method == null)
method = "<Unknown>";
var loc = new SourceLocation (method, file, line);
return new StackFrame ((long)0, loc, lang);
}
示例14: Resolve
public override string Resolve (DebuggerSession session, SourceLocation location, string exp)
{
return Resolve (session, location, exp, false);
}
示例15: NRefactoryExpressionResolverVisitor
public NRefactoryExpressionResolverVisitor(DebuggerSession session, SourceLocation location, string expression)
{
this.expression = expression.Replace ("\n", "").Replace ("\r", "");
this.session = session;
this.location = location;
}