diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin index ef965b2aa0..8da8a14168 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin @@ -4,7 +4,9 @@ - + + + @@ -35,6 +37,13 @@ insertbefore = "Refactoring" type = "Separator"/> + + + + + + + @@ -72,7 +81,7 @@ icon = "PadIcons.LocalVariables" shortcut = "Control|Alt|V" class = "ICSharpCode.SharpDevelop.Gui.Pads.LocalVarPad"/> - + false Always v2.0 + C:\Dokumente und Einstellungen\HP\Anwendungsdaten\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis true @@ -34,6 +35,10 @@ ..\..\..\..\..\..\AddIns\AddIns\Misc\Debugger\ TRACE + + Program + ..\..\..\..\..\..\bin\SharpDevelop.exe + @@ -43,6 +48,7 @@ + @@ -77,6 +83,10 @@ DebugeeExceptionForm.cs + + + EditBreakpointScriptForm.cs + @@ -89,6 +99,9 @@ DebuggerEventForm.cs + + EditBreakpointScriptForm.cs + Configuration\GlobalAssemblyInfo.cs diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/AstEvaluator.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/AstEvaluator.cs index bb9ac29e64..57d0bc0be6 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/AstEvaluator.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/AstEvaluator.cs @@ -27,6 +27,7 @@ namespace Debugger.AddIn } try { EvaluateAstVisitor visitor = new EvaluateAstVisitor(context); + return astRoot.AcceptVisitor(visitor, null) as Value; } catch (NotImplementedException e) { throw new GetValueException("Language feature not implemented: " + e.Message); diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/EvaluateAstVisitor.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/EvaluateAstVisitor.cs index 07731acdd3..f16e3ff388 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/EvaluateAstVisitor.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Expressions/EvaluateAstVisitor.cs @@ -142,5 +142,31 @@ namespace Debugger.AddIn { return context.GetThisValue(); } + + public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) + { + Value left = ((Value)binaryOperatorExpression.Left.AcceptVisitor(this, null)).GetPermanentReference(); + Value right = ((Value)binaryOperatorExpression.Right.AcceptVisitor(this, null)).GetPermanentReference(); + + if (!left.IsReference && left.Type.FullName != right.Type.FullName) { + throw new GetValueException(string.Format("Type {0} expected, {1} seen", left.Type.FullName, right.Type.FullName)); + } + + Value val = Eval.NewObjectNoConstructor(DebugType.Create(context.Process, null, typeof(bool).FullName)); + + switch (binaryOperatorExpression.Op) + { + case BinaryOperatorType.Equality : + val.PrimitiveValue = (right.PrimitiveValue.ToString() == left.PrimitiveValue.ToString()); + break; + case BinaryOperatorType.InEquality : + val.PrimitiveValue = (right.PrimitiveValue.ToString() != left.PrimitiveValue.ToString()); + break; + default : + throw new NotImplementedException("BinaryOperator not implemented!"); + } + + return val; + } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/IsBreakpointCondition.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/IsBreakpointCondition.cs new file mode 100644 index 0000000000..8d7485a58b --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/IsBreakpointCondition.cs @@ -0,0 +1,122 @@ +// +// +// +// +// $Revision: 2039 $ +// +using Debugger.AddIn.Service; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Windows.Forms; +using ICSharpCode.Core; +using ICSharpCode.Core.WinForms; +using ICSharpCode.NRefactory; +using ICSharpCode.SharpDevelop.Debugging; +using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; +using ICSharpCode.SharpDevelop.Gui; +using ICSharpCode.SharpDevelop.Project; + +namespace Debugger.AddIn +{ + public class IsBreakpointCondition : IConditionEvaluator + { + public IsBreakpointCondition() + { + } + + public bool IsValid(object caller, Condition condition) + { + if (WorkbenchSingleton.Workbench == null || WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == null) + return false; + ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent as ITextEditorControlProvider; + if (provider == null) + return false; + if (string.IsNullOrEmpty(provider.TextEditorControl.FileName)) + return false; + + foreach (BreakpointBookmark mark in DebuggerService.Breakpoints) { + if ((mark.FileName == provider.TextEditorControl.FileName) && + (mark.LineNumber == provider.TextEditorControl.ActiveTextAreaControl.Caret.Line)) + return true; + } + + return false; + } + } + + public class BreakpointChangeMenuBuilder : ISubmenuBuilder + { + public System.Windows.Forms.ToolStripItem[] BuildSubmenu(Codon codon, object owner) + { + List items = new List(); + + ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ActiveViewContent as ITextEditorControlProvider; + + BreakpointBookmark point = null; + + foreach (BreakpointBookmark breakpoint in DebuggerService.Breakpoints) { + if ((breakpoint.FileName == provider.TextEditorControl.FileName) && + (breakpoint.LineNumber == provider.TextEditorControl.ActiveTextAreaControl.Caret.Line)) { + point = breakpoint; + break; + } + } + + foreach (string item in BreakpointAction.GetNames(typeof(BreakpointAction))) { + items.Add(MakeItem("${res:MainWindow.Windows.Debug.Conditional.Breakpoints." + item + "}", item, point, point.Action.ToString(), delegate(object sender, EventArgs e) {HandleItem(sender);})); + } + + return items.ToArray(); + } + + void HandleItem(object sender) + { + ToolStripMenuItem item = null; + if (sender is ToolStripMenuItem) + item = (ToolStripMenuItem)sender; + + if (item != null) { + BreakpointBookmark bookmark = (BreakpointBookmark)item.Tag; + + switch (item.Name) { + case "Ask": + bookmark.Action = BreakpointAction.Ask; + break; + case "Break": + bookmark.Action = BreakpointAction.Break; + break; + case "Continue": + bookmark.Action = BreakpointAction.Continue; + break; + case "Script": + EditBreakpointScriptForm form = new EditBreakpointScriptForm(bookmark); + + if (form.ShowDialog() == DialogResult.OK) { + bookmark = form.Data; + } + break; + case "Terminate": + bookmark.Action = BreakpointAction.Terminate; + break; + case "Trace": + bookmark.Action = BreakpointAction.Trace; + break; + } + } + } + + ToolStripMenuItem MakeItem(string title, string name, BreakpointBookmark tag, string data, EventHandler onClick) + { + ToolStripMenuItem menuItem = new ToolStripMenuItem(StringParser.Parse(title)); + menuItem.Click += onClick; + menuItem.Name = name; + menuItem.Tag = tag; + + if (name == tag.Action.ToString()) + menuItem.Checked = true; + + return menuItem; + } + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.Designer.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.Designer.cs new file mode 100644 index 0000000000..85215ab5ff --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.Designer.cs @@ -0,0 +1,130 @@ +/* + * Created by SharpDevelop. + * User: HP + * Date: 25.08.2008 + * Time: 09:37 + */ +namespace Debugger.AddIn.Service +{ + partial class EditBreakpointScriptForm + { + /// + /// Designer variable used to keep track of non-visual components. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Disposes resources used by the form. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing) { + if (components != null) { + components.Dispose(); + } + } + base.Dispose(disposing); + } + + /// + /// This method is required for Windows Forms designer support. + /// Do not change the method contents inside the source code editor. The Forms designer might + /// not be able to load this method if it was changed manually. + /// + private void InitializeComponent() + { + this.txtCode = new ICSharpCode.TextEditor.TextEditorControl(); + this.cmbLanguage = new System.Windows.Forms.ComboBox(); + this.btnCheckSyntax = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); + this.btnOK = new System.Windows.Forms.Button(); + this.btnCancel = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // txtCode + // + this.txtCode.IsReadOnly = false; + this.txtCode.Location = new System.Drawing.Point(3, 31); + this.txtCode.Name = "txtCode"; + this.txtCode.Size = new System.Drawing.Size(575, 355); + this.txtCode.TabIndex = 0; + // + // cmbLanguage + // + this.cmbLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbLanguage.FormattingEnabled = true; + this.cmbLanguage.Location = new System.Drawing.Point(153, 4); + this.cmbLanguage.Name = "cmbLanguage"; + this.cmbLanguage.Size = new System.Drawing.Size(121, 21); + this.cmbLanguage.TabIndex = 1; + this.cmbLanguage.SelectedIndexChanged += new System.EventHandler(this.CmbLanguageSelectedIndexChanged); + // + // btnCheckSyntax + // + this.btnCheckSyntax.Location = new System.Drawing.Point(280, 2); + this.btnCheckSyntax.Name = "btnCheckSyntax"; + this.btnCheckSyntax.Size = new System.Drawing.Size(119, 22); + this.btnCheckSyntax.TabIndex = 2; + this.btnCheckSyntax.Text = "Check Syntax"; + this.btnCheckSyntax.UseVisualStyleBackColor = true; + this.btnCheckSyntax.Click += new System.EventHandler(this.BtnCheckSyntaxClick); + // + // label1 + // + this.label1.Location = new System.Drawing.Point(3, 7); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(144, 16); + this.label1.TabIndex = 3; + this.label1.Text = "Scripting Language:"; + // + // btnOK + // + this.btnOK.Location = new System.Drawing.Point(415, 390); + this.btnOK.Name = "btnOK"; + this.btnOK.Size = new System.Drawing.Size(75, 23); + this.btnOK.TabIndex = 4; + this.btnOK.Text = "OK"; + this.btnOK.UseVisualStyleBackColor = true; + this.btnOK.Click += new System.EventHandler(this.BtnOKClick); + // + // btnCancel + // + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(496, 390); + this.btnCancel.Name = "btnCancel"; + this.btnCancel.Size = new System.Drawing.Size(75, 23); + this.btnCancel.TabIndex = 5; + this.btnCancel.Text = "Cancel"; + this.btnCancel.UseVisualStyleBackColor = true; + // + // EditBreakpointScriptForm + // + this.AcceptButton = this.btnOK; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this.btnCancel; + this.ClientSize = new System.Drawing.Size(583, 418); + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Controls.Add(this.btnCancel); + this.Controls.Add(this.btnOK); + this.Controls.Add(this.label1); + this.Controls.Add(this.btnCheckSyntax); + this.Controls.Add(this.cmbLanguage); + this.Controls.Add(this.txtCode); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "EditBreakpointScriptForm"; + this.ShowIcon = false; + this.Text = "Edit Debugger Script"; + this.ResumeLayout(false); + } + private System.Windows.Forms.Button btnCancel; + private System.Windows.Forms.Button btnOK; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnCheckSyntax; + private System.Windows.Forms.ComboBox cmbLanguage; + private ICSharpCode.TextEditor.TextEditorControl txtCode; + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.cs new file mode 100644 index 0000000000..a1382118ca --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.cs @@ -0,0 +1,92 @@ +/* + * Created by SharpDevelop. + * User: HP + * Date: 25.08.2008 + * Time: 09:37 + */ +using ICSharpCode.SharpDevelop.Project; +using System; +using System.Drawing; +using System.IO; +using System.Windows.Forms; +using ICSharpCode.Core; +using ICSharpCode.NRefactory; +using ICSharpCode.SharpDevelop.Debugging; + +namespace Debugger.AddIn.Service +{ + /// + /// Description of EditBreakpointScriptForm. + /// + public partial class EditBreakpointScriptForm : Form + { + BreakpointBookmark data; + + public BreakpointBookmark Data { + get { return data; } + } + + public EditBreakpointScriptForm(BreakpointBookmark data) + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + + this.data = data; + + this.data.Action = BreakpointAction.Script; + + this.txtCode.Document.TextContent = data.Script; + this.cmbLanguage.Items.AddRange(new string[] { "C#", "VBNET" }); + this.cmbLanguage.SelectedIndex = + (!string.IsNullOrEmpty(data.ScriptLanguage)) ? + this.cmbLanguage.Items.IndexOf(data.ScriptLanguage.ToUpper()) : + this.cmbLanguage.Items.IndexOf(ProjectService.CurrentProject.Language.ToUpper()); + this.txtCode.SetHighlighting(data.ScriptLanguage.ToUpper()); + + // Setup translation text + this.Text = StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.Title}"); + + this.btnCancel.Text = StringParser.Parse("${res:Global.CancelButtonText}"); + this.btnOK.Text = StringParser.Parse("${res:Global.OKButtonText}"); + + this.label1.Text = StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.ScriptingLanguage}") + ":"; + this.btnCheckSyntax.Text = StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.ScriptingWindow.CheckSyntax}"); + } + + void CmbLanguageSelectedIndexChanged(object sender, EventArgs e) + { + this.txtCode.SetHighlighting(this.cmbLanguage.SelectedItem.ToString()); + this.data.ScriptLanguage = this.cmbLanguage.SelectedItem.ToString(); + } + + void BtnCheckSyntaxClick(object sender, EventArgs e) + { + CheckSyntax(); + } + + bool CheckSyntax() + { + SupportedLanguage language = (SupportedLanguage)Enum.Parse(typeof(SupportedLanguage), this.cmbLanguage.SelectedItem.ToString().Replace("#", "Sharp"), true); + using (IParser parser = ParserFactory.CreateParser(language, new StringReader(this.txtCode.Document.TextContent))) { + parser.ParseExpression(); + if (parser.Errors.Count > 0) { + MessageService.ShowError(parser.Errors.ErrorOutput); + return false; + } + } + + return true; + } + + void BtnOKClick(object sender, EventArgs e) + { + if (!this.CheckSyntax()) + return; + this.data.Script = this.txtCode.Document.TextContent; + this.DialogResult = DialogResult.OK; + this.Close(); + } + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.resx b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.resx new file mode 100644 index 0000000000..7080a7d118 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/EditBreakpointScriptForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file 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 07ec4dd2c5..68c467cb1d 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 @@ -192,7 +192,7 @@ namespace ICSharpCode.SharpDevelop.Services if (attachForm.ShowDialog() == DialogResult.OK) { Attach(attachForm.Process); } - } + } } public void Attach(System.Diagnostics.Process existingProcess) @@ -211,7 +211,7 @@ namespace ICSharpCode.SharpDevelop.Services } else { if (DebugStarting != null) DebugStarting(this, EventArgs.Empty); - + Debugger.Process process = debugger.Attach(existingProcess); attached = true; SelectProcess(process); @@ -240,11 +240,11 @@ namespace ICSharpCode.SharpDevelop.Services case StopAttachedProcessDialogResult.Terminate: debuggedProcess.Terminate(); attached = false; - break; + break; case StopAttachedProcessDialogResult.Detach: Detach(); attached = false; - break; + break; } } else { debuggedProcess.Terminate(); @@ -518,6 +518,52 @@ namespace ICSharpCode.SharpDevelop.Services EventHandler bp_debugger_ProcessExited = (sender, e) => { setBookmarkColor(); }; + + EventHandler bp_debugger_BreakpointHit = + new EventHandler( + delegate(object sender, BreakpointEventArgs e) + { + LoggingService.Debug(bookmark.Action + " " + bookmark.ScriptLanguage + " " + bookmark.Script); + + switch (bookmark.Action) { + case BreakpointAction.Ask: + Bitmap icon = WinFormsResourceService.GetBitmap(false ? "Icons.32x32.Error" : "Icons.32x32.Warning"); + + DebuggerEventForm.Result result = + DebuggerEventForm.Show(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHit}"), + string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAt}"), bookmark.LineNumber, bookmark.FileName), icon, true); + + switch (result) { + case DebuggerEventForm.Result.Break: + break; + case DebuggerEventForm.Result.Continue: + this.debuggedProcess.AsyncContinue(); + break; + case DebuggerEventForm.Result.Terminate: + this.debuggedProcess.AsyncTerminate(); + break; + } + break; + case BreakpointAction.Break: + break; + case BreakpointAction.Continue: + this.debuggedProcess.AsyncContinue(); + break; + case BreakpointAction.Script: + if (Evaluate(bookmark.Script, bookmark.ScriptLanguage)) + DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAtBecause}") + "\n", bookmark.LineNumber + 1, bookmark.FileName, bookmark.Script)); + else + this.debuggedProcess.AsyncContinue(); + break; + case BreakpointAction.Terminate: + this.debuggedProcess.AsyncTerminate(); + break; + case BreakpointAction.Trace: + DebuggerService.PrintDebugMessage(string.Format(StringParser.Parse("${res:MainWindow.Windows.Debug.Conditional.Breakpoints.BreakpointHitAt}") + "\n", bookmark.LineNumber + 1, bookmark.FileName)); + break; + } + }); + BM.BookmarkEventHandler bp_bookmarkManager_Removed = null; bp_bookmarkManager_Removed = (sender, e) => { if (bookmark == e.Bookmark) { @@ -526,15 +572,32 @@ namespace ICSharpCode.SharpDevelop.Services // unregister the events debugger.ProcessStarted -= bp_debugger_ProcessStarted; debugger.ProcessExited -= bp_debugger_ProcessExited; + breakpoint.Hit -= bp_debugger_BreakpointHit; BM.BookmarkManager.Removed -= bp_bookmarkManager_Removed; } }; // register the events debugger.ProcessStarted += bp_debugger_ProcessStarted; debugger.ProcessExited += bp_debugger_ProcessExited; + breakpoint.Hit += bp_debugger_BreakpointHit; BM.BookmarkManager.Removed += bp_bookmarkManager_Removed; } + bool Evaluate(string code, string language) + { + try { + SupportedLanguage supportedLanguage = (SupportedLanguage)Enum.Parse(typeof(SupportedLanguage), language.Replace("#", "Sharp"), true); + Value val = AstEvaluator.Evaluate(code, supportedLanguage, debuggedProcess.SelectedStackFrame); + + if (val.PrimitiveValue is bool) + return (bool)val.PrimitiveValue; + else + return false; + } catch (GetValueException e) { + throw e; + } + } + void LogMessage(object sender, MessageEventArgs e) { DebuggerService.PrintDebugMessage(e.Message); diff --git a/src/Main/Base/Project/Src/Services/Debugger/BreakpointBookmark.cs b/src/Main/Base/Project/Src/Services/Debugger/BreakpointBookmark.cs index dbb530dfc0..3c4eaa2640 100644 --- a/src/Main/Base/Project/Src/Services/Debugger/BreakpointBookmark.cs +++ b/src/Main/Base/Project/Src/Services/Debugger/BreakpointBookmark.cs @@ -13,6 +13,10 @@ using ICSharpCode.SharpDevelop.Bookmarks; namespace ICSharpCode.SharpDevelop.Debugging { + public enum BreakpointAction { + Ask, Break, Continue, Terminate, Trace, Script + } + public class BreakpointBookmark : SDMarkerBookmark { bool isHealthy = true; @@ -20,6 +24,25 @@ namespace ICSharpCode.SharpDevelop.Debugging static readonly Color defaultColor = Color.FromArgb(180, 38, 38); + BreakpointAction action = BreakpointAction.Ask; + string script; + string scriptLanguage; + + public string ScriptLanguage { + get { return scriptLanguage; } + set { scriptLanguage = value; } + } + + public string Script { + get { return script; } + set { script = value; } + } + + public BreakpointAction Action { + get { return action; } + set { this.action = value; } + } + public virtual bool IsHealthy { get { return isHealthy; @@ -38,8 +61,11 @@ namespace ICSharpCode.SharpDevelop.Debugging set { tooltip = value; } } - public BreakpointBookmark(string fileName, IDocument document, TextLocation location) : base(fileName, document, location) + public BreakpointBookmark(string fileName, IDocument document, TextLocation location, BreakpointAction action, string scriptLanguage, string script) : base(fileName, document, location) { + this.action = action; + this.scriptLanguage = scriptLanguage; + this.script = script; } public override void Draw(IconBarMargin margin, Graphics g, Point p) diff --git a/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs b/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs index fdb0997ca8..64f3800552 100644 --- a/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs +++ b/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs @@ -231,7 +231,7 @@ namespace ICSharpCode.SharpDevelop.Debugging int column = 0; foreach (char ch in document.GetText(document.GetLineSegment(lineNumber))) { if (!char.IsWhiteSpace(ch)) { - document.BookmarkManager.AddMark(new BreakpointBookmark(fileName, document, new TextLocation(column, lineNumber))); + document.BookmarkManager.AddMark(new BreakpointBookmark(fileName, document, new TextLocation(column, lineNumber), BreakpointAction.Break, "", "")); document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, lineNumber)); document.CommitUpdate(); break; diff --git a/src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkConverter.cs b/src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkConverter.cs index ab41b1ecaa..129fa4c1f7 100644 --- a/src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkConverter.cs +++ b/src/Main/Base/Project/Src/TextEditor/Bookmarks/BookmarkConverter.cs @@ -5,11 +5,12 @@ // $Revision$ // -using ICSharpCode.TextEditor; +using ICSharpCode.Core; using System; using System.ComponentModel; using System.Globalization; using System.Text; +using ICSharpCode.TextEditor; namespace ICSharpCode.SharpDevelop.Bookmarks { @@ -28,11 +29,19 @@ namespace ICSharpCode.SharpDevelop.Bookmarks { if (value is string) { string[] v = ((string)value).Split('|'); - if (v.Length != 5) + if (v.Length != 8) return null; string fileName = v[1]; int lineNumber = int.Parse(v[2], culture); int columnNumber = int.Parse(v[3], culture); + Debugging.BreakpointAction action = Debugging.BreakpointAction.Break; + string scriptLanguage = ""; + string script = ""; + if (v[0] == "Breakpoint") { + action = (Debugging.BreakpointAction)Enum.Parse(typeof(Debugging.BreakpointAction), v[5]); + scriptLanguage = v[6]; + script = v[7]; + } if (lineNumber < 0) return null; if (columnNumber < 0) @@ -40,7 +49,7 @@ namespace ICSharpCode.SharpDevelop.Bookmarks SDBookmark bookmark; switch (v[0]) { case "Breakpoint": - bookmark = new Debugging.BreakpointBookmark(fileName, null, new TextLocation(columnNumber, lineNumber)); + bookmark = new Debugging.BreakpointBookmark(fileName, null, new TextLocation(columnNumber, lineNumber), action, scriptLanguage, script); break; default: bookmark = new SDBookmark(fileName, null, new TextLocation(columnNumber, lineNumber)); @@ -71,6 +80,15 @@ namespace ICSharpCode.SharpDevelop.Bookmarks b.Append(bookmark.ColumnNumber); b.Append('|'); b.Append(bookmark.IsEnabled.ToString()); + if (bookmark is Debugging.BreakpointBookmark) { + Debugging.BreakpointBookmark bbm = (Debugging.BreakpointBookmark)bookmark; + b.Append('|'); + b.Append(bbm.Action); + b.Append('|'); + b.Append(bbm.ScriptLanguage); + b.Append('|'); + b.Append(bbm.Script); + } return b.ToString(); } else { return base.ConvertTo(context, culture, value, destinationType);