From 021e7c4129c95845ecc538d3f0b87966a4cdedd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Sun, 24 Jul 2005 18:37:17 +0000 Subject: [PATCH] CurrentLineBookmark does not use whole line, 'Debug' layout used during debugging git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@244 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Service/WindowsDebugger.cs | 2 +- .../Project/Src/Breakpoints/Breakpoint.cs | 2 +- .../Src/Breakpoints/NDebugger-Breakpoints.cs | 1 - .../Src/Debugger/Internal/ManagedCallback.cs | 25 +++++++--------- .../Project/Src/Debugger/NDebugger.cs | 2 -- .../Services/Debugger/CurrentLineBookmark.cs | 29 ++++++++++++------- .../Src/Services/Debugger/DebuggerService.cs | 6 ++-- .../Src/TextEditor/Bookmarks/Bookmark.cs | 2 ++ 8 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs index 087f2cdbe6..f0797e250e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs @@ -343,7 +343,7 @@ namespace ICSharpCode.SharpDevelop.Services if (e.Reason == PausedReason.Exception) { exceptionHistory.Add(debugger.CurrentThread.CurrentException); OnExceptionHistoryModified(); - if (debugger.CurrentThread.CurrentException.ExceptionType != ExceptionType.DEBUG_EXCEPTION_UNHANDLED && (debugger.CatchHandledExceptions == false)) { + if (debugger.CurrentThread.CurrentException.ExceptionType != ExceptionType.DEBUG_EXCEPTION_UNHANDLED) { // Ignore the exception e.ResumeDebuggingAfterEvent(); return; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs index 71e44b409b..aa4123d2a0 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/Breakpoint.cs @@ -102,7 +102,7 @@ namespace DebuggerLibrary return base.GetHashCode(); } - internal unsafe void ResetBreakpoint() //TODO + internal unsafe void ResetBreakpoint() { hadBeenSet = false; OnBreakpointStateChanged(); diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs index bc214fd584..2d39872858 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Breakpoints/NDebugger-Breakpoints.cs @@ -99,7 +99,6 @@ namespace DebuggerLibrary public void ResetBreakpoints() { foreach (Breakpoint b in breakpointCollection) { - b.HadBeenSet = false; b.ResetBreakpoint(); } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs index 202e3173a8..9ac0be53ca 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/Internal/ManagedCallback.cs @@ -92,9 +92,9 @@ namespace DebuggerLibrary throw new DebuggerException("You are not allowed to pause since CurrentThread is not set"); } debugger.CurrentThread.DeactivateAllSteppers(); - if (reason != PausedReason.EvalComplete) { - debugger.OnDebuggingPaused(reason); - } + + debugger.OnDebuggingPaused(reason); + handlingCallback = false; } @@ -154,11 +154,6 @@ namespace DebuggerLibrary EnterCallback("Exception", pThread); // Exception2 is used in .NET Framework 2.0 - - /*if (!debugger.CatchHandledExceptions && (unhandled == 0)) { - ExitCallback_Continue(); - return; - }*/ ExitCallback_Paused(PausedReason.Exception); } @@ -265,16 +260,21 @@ namespace DebuggerLibrary public void NameChange(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread) { if (pAppDomain != null) { + EnterCallback("NameChange: pAppDomain", pAppDomain); + ExitCallback_Continue(); - return; + } if (pThread != null) { + EnterCallback("NameChange: pThread", pThread); + Thread thread = debugger.GetThread(pThread); thread.HasBeenLoaded = true; + ExitCallback_Continue(); - return; + } } @@ -390,11 +390,6 @@ namespace DebuggerLibrary public void Exception2(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, ICorDebugFrame pFrame, uint nOffset, CorDebugExceptionCallbackType dwEventType, uint dwFlags) { EnterCallback("Exception2", pThread); - - //if (!NDebugger.CatchHandledExceptions && dwEventType != CorDebugExceptionCallbackType.DEBUG_EXCEPTION_UNHANDLED) { - // ExitCallback_Continue(); - // return; - //} debugger.CurrentThread.CurrentExceptionType = (ExceptionType)dwEventType; diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs index e45f5858a7..c82a32b322 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs @@ -22,8 +22,6 @@ namespace DebuggerLibrary ICorDebug corDebug; ManagedCallback managedCallback; ManagedCallbackProxy managedCallbackProxy; - - public bool CatchHandledExceptions = false; ApartmentState requiredApartmentState; diff --git a/src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs b/src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs index ea917733e5..5780262924 100644 --- a/src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs +++ b/src/Main/Base/Project/Src/Services/Debugger/CurrentLineBookmark.cs @@ -23,26 +23,34 @@ namespace ICSharpCode.Core public class CurrentLineBookmark: SDMarkerBookmark { static CurrentLineBookmark instance; + + static int startLine; + static int startColumn; + static int endLine; + static int endColumn; - public static void SetPosition(IViewContent viewContent, int startLine, int startColumn, int endLine, int endColumn) + public static void SetPosition(IViewContent viewContent, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn) { ITextEditorControlProvider tecp = viewContent as ITextEditorControlProvider; if (tecp != null) - SetPosition(tecp.TextEditorControl.FileName, tecp.TextEditorControl.Document, startLine, startColumn, endLine, endColumn); + SetPosition(tecp.TextEditorControl.FileName, tecp.TextEditorControl.Document, makerStartLine, makerStartColumn, makerEndLine, makerEndColumn); else Remove(); } - public static void SetPosition(string fileName, IDocument document, int startLine, int startColumn, int endLine, int endColumn) + public static void SetPosition(string fileName, IDocument document, int makerStartLine, int makerStartColumn, int makerEndLine, int makerEndColumn) { Remove(); + + startLine = makerStartLine; + startColumn = makerStartColumn; + endLine = makerEndLine; + endColumn = makerEndColumn; + LineSegment line = document.GetLineSegment(startLine - 1); int offset = line.Offset + startColumn; instance = new CurrentLineBookmark(fileName, document, startLine - 1); document.BookmarkManager.AddMark(instance); - //currentLineMarker = new TextMarker(offset, endColumn - startColumn, TextMarkerType.SolidBlock, Color.Yellow, Color.Blue); - //currentLineMarkerParent = document; - //currentLineMarkerParent.MarkerStrategy.AddMarker(currentLineMarker); document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, startLine - 1)); document.CommitUpdate(); } @@ -50,8 +58,8 @@ namespace ICSharpCode.Core public static void Remove() { if (instance != null) { - instance.RemoveMarker(); instance.Document.BookmarkManager.RemoveMark(instance); + instance.RemoveMarker(); instance = null; } } @@ -62,8 +70,9 @@ namespace ICSharpCode.Core } } - public CurrentLineBookmark(string fileName, IDocument document, int lineNumber) : base(fileName, document, lineNumber) + public CurrentLineBookmark(string fileName, IDocument document, int startLine) : base(fileName, document, startLine) { + } public override void Draw(IconBarMargin margin, Graphics g, Point p) @@ -73,8 +82,8 @@ namespace ICSharpCode.Core protected override TextMarker CreateMarker() { - LineSegment lineSeg = Document.GetLineSegment(LineNumber); - TextMarker marker = new TextMarker(lineSeg.Offset, lineSeg.Length, TextMarkerType.SolidBlock, Color.Yellow, Color.Blue); + LineSegment lineSeg = Document.GetLineSegment(startLine - 1); + TextMarker marker = new TextMarker(lineSeg.Offset + startColumn, endColumn - startColumn, TextMarkerType.SolidBlock, Color.Yellow, Color.Blue); Document.MarkerStrategy.InsertMarker(0, marker); return marker; } diff --git a/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs b/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs index f43500b6f3..5f2efb9c32 100644 --- a/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs +++ b/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs @@ -84,8 +84,8 @@ namespace ICSharpCode.Core static void DebugStarted(object sender, EventArgs e) { - //oldLayoutConfiguration = LayoutConfiguration.CurrentLayoutName; - //LayoutConfiguration.CurrentLayoutName = "Debug"; + oldLayoutConfiguration = LayoutConfiguration.CurrentLayoutName; + LayoutConfiguration.CurrentLayoutName = "Debug"; ClearDebugMessages(); } @@ -93,7 +93,7 @@ namespace ICSharpCode.Core static void DebugStopped(object sender, EventArgs e) { CurrentLineBookmark.Remove(); - //LayoutConfiguration.CurrentLayoutName = oldLayoutConfiguration; + LayoutConfiguration.CurrentLayoutName = oldLayoutConfiguration; } diff --git a/src/Main/Base/Project/Src/TextEditor/Bookmarks/Bookmark.cs b/src/Main/Base/Project/Src/TextEditor/Bookmarks/Bookmark.cs index 79065f39a1..d394cc442c 100644 --- a/src/Main/Base/Project/Src/TextEditor/Bookmarks/Bookmark.cs +++ b/src/Main/Base/Project/Src/TextEditor/Bookmarks/Bookmark.cs @@ -78,6 +78,8 @@ namespace ICSharpCode.SharpDevelop.Bookmarks { if (oldDocument != null) { oldDocument.MarkerStrategy.RemoveMarker(oldMarker); + oldDocument.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, LineNumber)); + oldDocument.CommitUpdate(); } oldDocument = null; oldMarker = null;