Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Karlaš <david.karlas@xamarin.com>2014-04-25 13:20:21 +0400
committerDavid Karlaš <david.karlas@xamarin.com>2014-04-25 13:20:21 +0400
commitb6279b688c39e4ace8ceacbcad6b703a8553bf45 (patch)
treeafc930cdef23c1d017b74ff94486d19fedc6416c /main/src/addins/MonoDevelop.Debugger.Win32
parent738621f0052bdb7896146bd35bb8825f3e325230 (diff)
[UnitTests] Catchpoints, RunToCursor and SetNextStatemnt
[Win32] Support for adding breakpoints on columns [Win32] Implemented SetNextStatement [Win32] IncludeSubclasses on Catchpoints works as it should [Win32] Removed dead code in OnUpdateModuleSymbols
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger.Win32')
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs22
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs110
2 files changed, 101 insertions, 31 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs
index 9f22eb9eb6..d8ff9db670 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerBacktrace.cs
@@ -129,8 +129,10 @@ namespace MonoDevelop.Debugger.Win32
return new SequencePoint () {
IsSpecial = true,
Offset = offsets [j],
- Line = lines [j],
- Column = columns [j],
+ StartLine = lines [j],
+ EndLine = endLines [j],
+ StartColumn = columns [j],
+ EndColumn = endColumns [j],
Document = docs [j]
};
}
@@ -143,8 +145,10 @@ namespace MonoDevelop.Debugger.Win32
return new SequencePoint () {
IsSpecial = true,
Offset = offsets [j],
- Line = lines [j],
- Column = columns [j],
+ StartLine = lines [j],
+ EndLine = endLines [j],
+ StartColumn = columns [j],
+ EndColumn = endColumns [j],
Document = docs [j]
};
}
@@ -158,8 +162,10 @@ namespace MonoDevelop.Debugger.Win32
return new SequencePoint () {
IsSpecial = false,
Offset = offsets [i],
- Line = lines [i],
- Column = columns [i],
+ StartLine = lines [i],
+ EndLine = endLines [i],
+ StartColumn = columns [i],
+ EndColumn = endColumns [i],
Document = docs [i]
};
}
@@ -196,8 +202,8 @@ namespace MonoDevelop.Debugger.Win32
var sp = GetSequencePoint (session, frame);
if (sp != null) {
- line = sp.Line;
- column = sp.Column;
+ line = sp.StartLine;
+ column = sp.StartColumn;
file = sp.Document.URL;
address = (uint)sp.Offset;
}
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs
index d8cd4e50c9..60e6731729 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/CorDebuggerSession.cs
@@ -430,15 +430,6 @@ namespace MonoDevelop.Debugger.Win32
void OnUpdateModuleSymbols (object sender, CorUpdateModuleSymbolsEventArgs e)
{
- SymbolBinder binder = new SymbolBinder ();
- CorMetadataImport mi = new CorMetadataImport (e.Module);
- ISymbolReader reader = binder.GetReaderFromStream (mi.RawCOMObject, e.Stream);
- foreach (ISymbolDocument doc in reader.GetDocuments ()) {
- Console.WriteLine (doc.URL);
- }
- var disposable = reader as IDisposable;
- if (disposable != null)
- disposable.Dispose ();
e.Continue = true;
}
@@ -635,10 +626,13 @@ namespace MonoDevelop.Debugger.Win32
exceptions.Add(t.GetTypeInfo(this).FullName);
t = t.Base;
}
-
+ if (exceptions.Count == 0)
+ return false;
// See if a catchpoint is set for this exception.
foreach (Catchpoint cp in Breakpoints.GetCatchpoints()) {
- if (cp.Enabled && exceptions.Contains(cp.ExceptionName)) {
+ if (cp.Enabled &&
+ ((cp.IncludeSubclasses && exceptions.Contains (cp.ExceptionName)) ||
+ (exceptions [0] == cp.ExceptionName))) {
return true;
}
}
@@ -778,8 +772,7 @@ namespace MonoDevelop.Debugger.Win32
protected override BreakEventInfo OnInsertBreakEvent (BreakEvent be)
{
- return MtaThread.Run (delegate
- {
+ return MtaThread.Run (delegate {
var binfo = new BreakEventInfo ();
lock (documents) {
@@ -789,8 +782,7 @@ namespace MonoDevelop.Debugger.Win32
// FIXME: implement breaking on function name
binfo.SetStatus (BreakEventStatus.Invalid, null);
return binfo;
- }
- else {
+ } else {
DocInfo doc;
if (!documents.TryGetValue (System.IO.Path.GetFullPath (bp.FileName), out doc)) {
binfo.SetStatus (BreakEventStatus.NotBound, null);
@@ -800,8 +792,7 @@ namespace MonoDevelop.Debugger.Win32
int line;
try {
line = doc.Document.FindClosestLine (bp.Line);
- }
- catch {
+ } catch {
// Invalid line
binfo.SetStatus (BreakEventStatus.Invalid, null);
return binfo;
@@ -813,12 +804,20 @@ namespace MonoDevelop.Debugger.Win32
}
int offset = -1;
+ int firstSpInLine = -1;
foreach (SequencePoint sp in met.GetSequencePoints ()) {
- if (sp.Line == line && sp.Document.URL == doc.Document.URL) {
+ if (sp.IsInside (doc.Document.URL, line, bp.Column)) {
offset = sp.Offset;
break;
+ } else if (firstSpInLine == -1
+ && sp.StartLine == line
+ && sp.Document.URL.Equals (doc.Document.URL, StringComparison.OrdinalIgnoreCase)) {
+ firstSpInLine = sp.Offset;
}
}
+ if (offset == -1) {//No exact match? Use first match in that line
+ offset = firstSpInLine;
+ }
if (offset == -1) {
binfo.SetStatus (BreakEventStatus.Invalid, null);
return binfo;
@@ -827,7 +826,7 @@ namespace MonoDevelop.Debugger.Win32
CorFunction func = doc.Module.GetFunctionFromToken (met.Token.GetToken ());
CorFunctionBreakpoint corBp = func.ILCode.CreateBreakpoint (offset);
corBp.Activate (bp.Enabled);
- breakpoints[corBp] = binfo;
+ breakpoints [corBp] = binfo;
binfo.Handle = corBp;
binfo.SetStatus (BreakEventStatus.Bound, null);
@@ -1352,15 +1351,78 @@ namespace MonoDevelop.Debugger.Win32
return (T)(object)new MtaRawValueString ((IRawValueString)obj);
return obj;
}
+
+ public override bool CanSetNextStatement {
+ get {
+ return true;
+ }
+ }
+
+ protected override void OnSetNextStatement (long threadId, string fileName, int line, int column)
+ {
+ if (!CanSetNextStatement)
+ throw new NotSupportedException ();
+ MtaThread.Run (delegate {
+ var thread = GetThread ((int)threadId);
+ if (thread == null)
+ throw new ArgumentException ("Unknown thread.");
+
+ CorFrame frame = thread.ActiveFrame;
+ if (frame == null)
+ throw new NotSupportedException ();
+
+ ISymbolMethod met = frame.Function.GetSymbolMethod (this);
+ if (met == null) {
+ throw new NotSupportedException ();
+ }
+
+ int offset = -1;
+ int firstSpInLine = -1;
+ foreach (SequencePoint sp in met.GetSequencePoints ()) {
+ if (sp.IsInside (fileName, line, column)) {
+ offset = sp.Offset;
+ break;
+ } else if (firstSpInLine == -1
+ && sp.StartLine == line
+ && sp.Document.URL.Equals (fileName, StringComparison.OrdinalIgnoreCase)) {
+ firstSpInLine = sp.Offset;
+ }
+ }
+ if (offset == -1) {//No exact match? Use first match in that line
+ offset = firstSpInLine;
+ }
+ if (offset == -1) {
+ throw new NotSupportedException ();
+ }
+ try {
+ frame.SetIP (offset);
+ } catch {
+ throw new NotSupportedException ();
+ }
+ });
+ }
}
class SequencePoint
{
- public int Line;
- public int Column;
+ public int StartLine;
+ public int EndLine;
+ public int StartColumn;
+ public int EndColumn;
public int Offset;
public bool IsSpecial;
public ISymbolDocument Document;
+
+ public bool IsInside (string fileUrl, int line, int column)
+ {
+ if (!Document.URL.Equals (fileUrl, StringComparison.OrdinalIgnoreCase))
+ return false;
+ if (line < StartLine || (line == StartLine && column < StartColumn))
+ return false;
+ if (line > EndLine || (line == EndLine && column > EndColumn))
+ return false;
+ return true;
+ }
}
static class SequencePointExt
@@ -1379,8 +1441,10 @@ namespace MonoDevelop.Debugger.Win32
for (int n = 0; n < sc; n++) {
SequencePoint sp = new SequencePoint ();
sp.Document = docs[n];
- sp.Line = lines[n];
- sp.Column = columns[n];
+ sp.StartLine = lines[n];
+ sp.EndLine = endLines[n];
+ sp.StartColumn = columns[n];
+ sp.EndColumn = endColumns[n];
sp.Offset = offsets[n];
yield return sp;
}