diff options
author | David Karlaš <david.karlas@xamarin.com> | 2017-01-13 22:02:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-13 22:02:37 +0300 |
commit | 9be63ec0148b7667aafb96b17b9e06d6e8e4af91 (patch) | |
tree | c64dd0fadf0519b38ae1be672f8ca98ecb5a0aba /Mono.Debugging.Win32 | |
parent | e3fc88f03f95a8217d2971a6bbb1f2a1076e1022 (diff) | |
parent | e1c7bdd896df1cf9016a3608c19365c730a9c6ed (diff) |
Merge pull request #1781 from JetBrains/corDebugFixes3
Cor debug fixes #3
Diffstat (limited to 'Mono.Debugging.Win32')
-rw-r--r-- | Mono.Debugging.Win32/CorDebuggerBacktrace.cs | 23 | ||||
-rw-r--r-- | Mono.Debugging.Win32/CorDebuggerSession.cs | 9 | ||||
-rw-r--r-- | Mono.Debugging.Win32/CorObjectAdaptor.cs | 10 |
3 files changed, 25 insertions, 17 deletions
diff --git a/Mono.Debugging.Win32/CorDebuggerBacktrace.cs b/Mono.Debugging.Win32/CorDebuggerBacktrace.cs index 3a6aa60..5de0135 100644 --- a/Mono.Debugging.Win32/CorDebuggerBacktrace.cs +++ b/Mono.Debugging.Win32/CorDebuggerBacktrace.cs @@ -175,17 +175,14 @@ namespace Mono.Debugging.Win32 internal static StackFrame CreateFrame (CorDebuggerSession session, CorFrame frame)
{
- // TODO: Fix remaining.
uint address = 0;
- //string typeFQN;
- //string typeFullName;
string addressSpace = "";
string file = "";
int line = 0;
int endLine = 0;
int column = 0;
int endColumn = 0;
- string method = "";
+ string method = "[Unknown]";
string lang = "";
string module = "";
string type = "";
@@ -198,8 +195,15 @@ namespace Mono.Debugging.Win32 module = frame.Function.Module.Name;
CorMetadataImport importer = new CorMetadataImport (frame.Function.Module);
MethodInfo mi = importer.GetMethodInfo (frame.Function.Token);
- method = mi.DeclaringType.FullName + "." + mi.Name;
- type = mi.DeclaringType.FullName;
+ var declaringType = mi.DeclaringType;
+ if (declaringType != null) {
+ method = declaringType.FullName + "." + mi.Name;
+ type = declaringType.FullName;
+ }
+ else {
+ method = mi.Name;
+ }
+
addressSpace = mi.Name;
var sp = GetSequencePoint (session, frame);
@@ -230,7 +234,7 @@ namespace Mono.Debugging.Win32 hasDebugInfo = true;
} else if (frame.FrameType == CorFrameType.NativeFrame) {
frame.GetNativeIP (out address);
- method = "<Unknown>";
+ method = "[Native frame]";
lang = "Native";
} else if (frame.FrameType == CorFrameType.InternalFrame) {
switch (frame.InternalFrameType) {
@@ -252,11 +256,8 @@ namespace Mono.Debugging.Win32 }
}
- if (method == null)
- method = "<Unknown>";
-
var loc = new SourceLocation (method, file, line, column, endLine, endColumn);
- return new StackFrame ((long)address, addressSpace, loc, lang, external, hasDebugInfo, hidden, null, null);
+ return new StackFrame (address, addressSpace, loc, lang, external, hasDebugInfo, hidden, module, type);
}
#endregion
diff --git a/Mono.Debugging.Win32/CorDebuggerSession.cs b/Mono.Debugging.Win32/CorDebuggerSession.cs index 254afc7..de121c2 100644 --- a/Mono.Debugging.Win32/CorDebuggerSession.cs +++ b/Mono.Debugging.Win32/CorDebuggerSession.cs @@ -39,7 +39,7 @@ namespace Mono.Debugging.Win32 static int evaluationTimestamp;
- readonly SymbolBinder symbolBinder = new SymbolBinder ();
+ readonly SymbolBinder symbolBinder = MtaThread.Run (() => new SymbolBinder ());
readonly object appDomainsLock = new object ();
Dictionary<int, AppDomainInfo> appDomains = new Dictionary<int, AppDomainInfo> ();
@@ -1138,8 +1138,8 @@ namespace Mono.Debugging.Win32 private static void HandleBreakpointException (BreakEventInfo binfo, COMException e)
{
- if (Enum.IsDefined (typeof(HResult), e.ErrorCode)) {
- var code = (HResult) e.ErrorCode;
+ var code = e.ToHResult<HResult> ();
+ if (code != null) {
switch (code) {
case HResult.CORDBG_E_UNABLE_TO_SET_BREAKPOINT:
binfo.SetStatus (BreakEventStatus.Invalid, "Invalid breakpoint position");
@@ -1179,6 +1179,7 @@ namespace Mono.Debugging.Win32 void Step (bool into)
{
try {
+ ObjectAdapter.CancelAsyncOperations ();
if (stepper != null) {
CorFrame frame = activeThread.ActiveFrame;
ISymbolReader reader = GetReaderForModule (frame.Function.Module);
@@ -1222,7 +1223,7 @@ namespace Mono.Debugging.Win32 process.Continue (false);
}
} catch (Exception e) {
- OnDebuggerOutput (true, e.ToString ());
+ DebuggerLoggingService.LogError ("Exception on Step()", e);
}
}
diff --git a/Mono.Debugging.Win32/CorObjectAdaptor.cs b/Mono.Debugging.Win32/CorObjectAdaptor.cs index a70bce3..fc76944 100644 --- a/Mono.Debugging.Win32/CorObjectAdaptor.cs +++ b/Mono.Debugging.Win32/CorObjectAdaptor.cs @@ -851,10 +851,16 @@ namespace Mono.Debugging.Win32 public static CorValue GetRealObject (EvaluationContext cctx, object objr)
{
- if (objr == null || ((CorValRef)objr).Val == null)
+ if (objr == null)
return null;
- return GetRealObject (cctx, ((CorValRef)objr).Val);
+ var corValue = objr as CorValue;
+ if (corValue != null)
+ return GetRealObject (cctx, corValue);
+ var valRef = objr as CorValRef;
+ if (valRef != null)
+ return GetRealObject (cctx, valRef.Val);
+ return null;
}
public static CorValue GetRealObject (EvaluationContext ctx, CorValue obj)
|