diff --git a/data/resources/StringResources.nl.resources b/data/resources/StringResources.nl.resources index fb328abf69..8a2d5dfcf9 100644 Binary files a/data/resources/StringResources.nl.resources and b/data/resources/StringResources.nl.resources differ 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 767259fb88..1be6f4314e 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin @@ -63,4 +63,17 @@ shortcut = "Control|Alt|V" class = "ICSharpCode.SharpDevelop.Gui.Pads.LocalVarPad"/> + + + + + + + diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj index 99eb227ce4..860e03ffee 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.csproj @@ -46,6 +46,15 @@ + + + + DebuggingOptionsPanel.cs + + + + DebuggingSymbolsPanel.cs + @@ -59,6 +68,12 @@ + + DebuggingOptionsPanel.cs + + + DebuggingSymbolsPanel.cs + DebuggerEventForm.cs @@ -129,6 +144,7 @@ + @@ -150,4 +166,4 @@ - \ No newline at end of file + diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptions.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptions.cs new file mode 100644 index 0000000000..d6882a119c --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptions.cs @@ -0,0 +1,70 @@ +// +// +// +// +// $Revision$ +// + +using Debugger; +using System; +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Debugging; + +namespace ICSharpCode.SharpDevelop.Services +{ + public static class DebuggingOptions + { + public static Properties DebuggingProperties { + get { + return PropertyService.Get("Debugging", new Properties()); + } + } + + public static bool ShowValuesInHexadecimal { + get { return DebuggingProperties.Get("ShowValuesInHexadecimal", false); } + set { DebuggingProperties.Set("ShowValuesInHexadecimal", value); } + } + + public static bool ShowArgumentNames { + get { return DebuggingProperties.Get("ShowArgumentNames", true); } + set { DebuggingProperties.Set("ShowArgumentNames", value); } + } + + public static bool ShowArgumentValues { + get { return DebuggingProperties.Get("ShowArgumentValues", true); } + set { DebuggingProperties.Set("ShowArgumentValues", value); } + } + + public static bool ShowExternalMethods { + get { return DebuggingProperties.Get("ShowExternalMethods", false); } + set { DebuggingProperties.Set("ShowExternalMethods", value); } + } + + public static bool JustMyCodeEnabled { + get { return DebuggingProperties.Get("JustMyCodeEnabled", true); } + set { DebuggingProperties.Set("JustMyCodeEnabled", value); } + } + + public static bool ObeyDebuggerAttributes { + get { return DebuggingProperties.Get("ObeyDebuggerAttributes", true); } + set { DebuggingProperties.Set("ObeyDebuggerAttributes", value); } + } + + public static string[] SymbolsSearchPaths { + get { return DebuggingProperties.Get("SymbolsSearchPaths", new string[0]); } + set { DebuggingProperties.Set("SymbolsSearchPaths", value); } + } + + public static void ApplyToCurrentDebugger() + { + WindowsDebugger winDbg = DebuggerService.CurrentDebugger as WindowsDebugger; + if (winDbg != null && winDbg.DebuggerCore != null) { + NDebugger debugger = winDbg.DebuggerCore; + + debugger.JustMyCodeEnabled = JustMyCodeEnabled; + debugger.ObeyDebuggerAttributes = ObeyDebuggerAttributes; + debugger.SymbolsSearchPaths = SymbolsSearchPaths; + } + } + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.Designer.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.Designer.cs new file mode 100644 index 0000000000..df37523678 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.Designer.cs @@ -0,0 +1,76 @@ +// +// +// +// +// $Revision$ +// + +namespace ICSharpCode.SharpDevelop.Gui.OptionPanels +{ + public partial class DebuggingOptionsPanel + { + /// + /// Designer variable used to keep track of non-visual components. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Disposes resources used by the control. + /// + /// 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.jmc = new System.Windows.Forms.CheckBox(); + this.obeyDebuggerAttributes = new System.Windows.Forms.CheckBox(); + this.SuspendLayout(); + // + // jmc + // + this.jmc.AutoSize = true; + this.jmc.Location = new System.Drawing.Point(13, 15); + this.jmc.Name = "jmc"; + this.jmc.Size = new System.Drawing.Size(491, 24); + this.jmc.TabIndex = 0; + this.jmc.Text = "${res:Dialog.Options.IDEOptions.Debugging.EnableJustMyCode}"; + this.jmc.UseVisualStyleBackColor = true; + // + // obeyDebuggerAttributes + // + this.obeyDebuggerAttributes.AutoSize = true; + this.obeyDebuggerAttributes.Location = new System.Drawing.Point(37, 45); + this.obeyDebuggerAttributes.Name = "obeyDebuggerAttributes"; + this.obeyDebuggerAttributes.Size = new System.Drawing.Size(530, 24); + this.obeyDebuggerAttributes.TabIndex = 1; + this.obeyDebuggerAttributes.Text = "${res:Dialog.Options.IDEOptions.Debugging.ObeyDebuggerAttributes}"; + this.obeyDebuggerAttributes.UseVisualStyleBackColor = true; + // + // DebuggingOptionsPanel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.obeyDebuggerAttributes); + this.Controls.Add(this.jmc); + this.Name = "DebuggingOptionsPanel"; + this.Size = new System.Drawing.Size(626, 300); + this.ResumeLayout(false); + this.PerformLayout(); + } + private System.Windows.Forms.CheckBox obeyDebuggerAttributes; + private System.Windows.Forms.CheckBox jmc; + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.cs new file mode 100644 index 0000000000..d509fd5a35 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.cs @@ -0,0 +1,47 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Services; + +namespace ICSharpCode.SharpDevelop.Gui.OptionPanels +{ + /// + /// Panel for general debugging options + /// + public partial class DebuggingOptionsPanel : AbstractOptionPanel + { + public DebuggingOptionsPanel() + { + InitializeComponent(); + foreach (Control ctl in Controls.GetRecursive()) { + ctl.Text = StringParser.Parse(ctl.Text); + } + } + + public override void LoadPanelContents() + { + jmc.Checked = DebuggingOptions.JustMyCodeEnabled; + obeyDebuggerAttributes.Checked = DebuggingOptions.ObeyDebuggerAttributes; + } + + public override bool StorePanelContents() + { + DebuggingOptions.JustMyCodeEnabled = jmc.Checked; + DebuggingOptions.ObeyDebuggerAttributes = obeyDebuggerAttributes.Checked; + + DebuggingOptions.ApplyToCurrentDebugger(); + + return true; + } + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.resx b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.resx new file mode 100644 index 0000000000..7080a7d118 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingOptionsPanel.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/Options/DebuggingSymbolsPanel.Designer.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingSymbolsPanel.Designer.cs new file mode 100644 index 0000000000..500c965a31 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingSymbolsPanel.Designer.cs @@ -0,0 +1,68 @@ +// +// +// +// +// $Revision$ +// + +namespace ICSharpCode.SharpDevelop.Gui.OptionPanels +{ + partial class DebuggingSymbolsPanel + { + /// + /// 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.pathList = new ICSharpCode.SharpDevelop.Gui.StringListEditor(); + this.SuspendLayout(); + // + // pathList + // + this.pathList.AddButtonText = "${res:Global.AddButtonText}"; + this.pathList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pathList.AutoAddAfterBrowse = true; + this.pathList.BrowseForDirectory = true; + this.pathList.ListCaption = "${res:Dialog.Options.IDEOptions.DebuggingSymbols.ListCaption}"; + this.pathList.Location = new System.Drawing.Point(0, 0); + this.pathList.ManualOrder = true; + this.pathList.Name = "pathList"; + this.pathList.Size = new System.Drawing.Size(349, 295); + this.pathList.TabIndex = 4; + this.pathList.TitleText = "${res:Global.Folder}:"; + // + // DebuggingSymbolsPanel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pathList); + this.Name = "DebuggingSymbolsPanel"; + this.Size = new System.Drawing.Size(352, 298); + this.ResumeLayout(false); + } + private ICSharpCode.SharpDevelop.Gui.StringListEditor pathList; + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingSymbolsPanel.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingSymbolsPanel.cs new file mode 100644 index 0000000000..4c1e19b427 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingSymbolsPanel.cs @@ -0,0 +1,46 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Windows.Forms; + +using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Services; + +namespace ICSharpCode.SharpDevelop.Gui.OptionPanels +{ + /// + /// Options panel which allows user to specify where to look + /// for symbols (pdb files) and source codes + /// + public partial class DebuggingSymbolsPanel : AbstractOptionPanel + { + public DebuggingSymbolsPanel() + { + InitializeComponent(); + foreach (Control ctl in Controls.GetRecursive()) { + ctl.Text = StringParser.Parse(ctl.Text); + } + } + + public override void LoadPanelContents() + { + pathList.LoadList(DebuggingOptions.SymbolsSearchPaths); + } + + public override bool StorePanelContents() + { + DebuggingOptions.SymbolsSearchPaths = pathList.GetList(); + + DebuggingOptions.ApplyToCurrentDebugger(); + + return true; + } + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingSymbolsPanel.resx b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingSymbolsPanel.resx new file mode 100644 index 0000000000..7080a7d118 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Options/DebuggingSymbolsPanel.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/Pads/CallStackPad.Menu.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.Menu.cs index 01ccc2fa5c..e08ea05d40 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.Menu.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.Menu.cs @@ -42,38 +42,12 @@ using System.ComponentModel; using System.Windows.Forms; using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Services; namespace ICSharpCode.SharpDevelop.Gui.Pads { public partial class CallStackPad { - public bool ShowArgumentNames { - get { - return debugger.Properties.Get("ShowArgumentNames", true); - } - set { - debugger.Properties.Set("ShowArgumentNames", value); - } - } - - public bool ShowArgumentValues { - get { - return debugger.Properties.Get("ShowArgumentValues", true); - } - set { - debugger.Properties.Set("ShowArgumentValues", value); - } - } - - public bool ShowExternalMethods { - get { - return debugger.Properties.Get("ShowExternalMethods", false); - } - set { - debugger.Properties.Set("ShowExternalMethods", value); - } - } - ContextMenuStrip CreateContextMenuStrip() { ContextMenuStrip menu = new ContextMenuStrip(); @@ -89,27 +63,27 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads ToolStripMenuItem argNamesItem; argNamesItem = new ToolStripMenuItem(); argNamesItem.Text = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowArgumentNames"); - argNamesItem.Checked = ShowArgumentNames; + argNamesItem.Checked = DebuggingOptions.ShowArgumentNames; argNamesItem.Click += delegate { - ShowArgumentNames = !ShowArgumentNames; + DebuggingOptions.ShowArgumentNames = !DebuggingOptions.ShowArgumentNames; RefreshPad(); }; ToolStripMenuItem argValuesItem; argValuesItem = new ToolStripMenuItem(); argValuesItem.Text = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowArgumentValues"); - argValuesItem.Checked = ShowArgumentValues; + argValuesItem.Checked = DebuggingOptions.ShowArgumentValues; argValuesItem.Click += delegate { - ShowArgumentValues = !ShowArgumentValues; + DebuggingOptions.ShowArgumentValues = !DebuggingOptions.ShowArgumentValues; RefreshPad(); }; ToolStripMenuItem extMethodsItem; extMethodsItem = new ToolStripMenuItem(); extMethodsItem.Text = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowExternalMethods"); - extMethodsItem.Checked = ShowExternalMethods; + extMethodsItem.Checked = DebuggingOptions.ShowExternalMethods; extMethodsItem.Click += delegate { - ShowExternalMethods = !ShowExternalMethods; + DebuggingOptions.ShowExternalMethods = !DebuggingOptions.ShowExternalMethods; RefreshPad(); }; diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs index ca6cd3d844..63e6e91867 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/CallStackPad.cs @@ -42,10 +42,11 @@ using System.Collections.Generic; using System.Drawing; using System.Text; using System.Windows.Forms; - using Debugger; using Debugger.AddIn.TreeModel; + using ICSharpCode.Core; +using ICSharpCode.SharpDevelop.Services; namespace ICSharpCode.SharpDevelop.Gui.Pads { @@ -148,7 +149,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads public List CreateItems() { - bool showExternalMethods = ShowExternalMethods; + bool showExternalMethods = DebuggingOptions.ShowExternalMethods; bool lastItemIsExternalMethod = false; List items = new List(); @@ -199,8 +200,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads public string GetFullName(StackFrame frame) { - bool showArgumentNames = ShowArgumentNames; - bool showArgumentValues = ShowArgumentValues; + bool showArgumentNames = DebuggingOptions.ShowArgumentNames; + bool showArgumentValues = DebuggingOptions.ShowArgumentValues; StringBuilder name = new StringBuilder(); name.Append(frame.MethodInfo.Name); diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LoadedModulesPad.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LoadedModulesPad.cs index d595f39c85..e0ffbf0e80 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LoadedModulesPad.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LoadedModulesPad.cs @@ -137,18 +137,31 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads void AddModule(Module module) { - ListViewItem newItem = new ListViewItem(new string[] {module.Filename, - String.Format("{0:X8}", module.BaseAdress), - module.DirectoryName, - module.OrderOfLoading.ToString(), - "", - "", - "", - StringParser.Parse(module.SymbolsLoaded ? "${res:MainWindow.Windows.Debug.Modules.HasSymbols}" : "${res:MainWindow.Windows.Debug.Modules.HasNoSymbols}") - }); + ListViewItem newItem = new ListViewItem(); newItem.Tag = module; + RefreshItem(newItem); + module.SymbolsLoaded += delegate { RefreshItem(newItem); }; loadedModulesList.Items.Add(newItem); } + + void RefreshItem(ListViewItem item) + { + Module module = (Module)item.Tag; + item.SubItems.Clear(); + item.SubItems.AddRange( + new string[] { + module.Filename, + String.Format("{0:X8}", module.BaseAdress), + module.DirectoryName, + module.OrderOfLoading.ToString(), + "", + "", + "", + StringParser.Parse(module.HasSymbols ? "${res:MainWindow.Windows.Debug.Modules.HasSymbols}" : "${res:MainWindow.Windows.Debug.Modules.HasNoSymbols}") + } + ); + item.SubItems.RemoveAt(0); + } void RemoveModule(Module module) { 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 4db89ef821..71395ae354 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 @@ -60,8 +60,6 @@ namespace ICSharpCode.SharpDevelop.Services NDebugger debugger; - Properties properties; - Debugger.Process debuggedProcess; DynamicTreeDebuggerRow currentTooltipRow; @@ -88,12 +86,6 @@ namespace ICSharpCode.SharpDevelop.Services } } - public Properties Properties { - get { - return properties; - } - } - public bool ServiceInitialized { get { return debugger != null; @@ -102,7 +94,7 @@ namespace ICSharpCode.SharpDevelop.Services public WindowsDebugger() { - properties = PropertyService.Get("DebuggerProperties", new Properties()); + } #region IDebugger Members @@ -376,6 +368,8 @@ namespace ICSharpCode.SharpDevelop.Services debugger = new NDebugger(); + DebuggingOptions.ApplyToCurrentDebugger(); + debugger.DebuggerTraceMessage += debugger_TraceMessage; debugger.ProcessStarted += debugger_ProcessStarted; debugger.ProcessExited += debugger_ProcessExited; diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs index 17e6b33459..269b82d2da 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs @@ -78,7 +78,7 @@ namespace Debugger.AddIn.TreeModel this.Name = val.Expression.CodeTail; - if (ShowValuesInHexadecimal && val.IsInteger) { + if (DebuggingOptions.ShowValuesInHexadecimal && val.IsInteger) { this.Text = String.Format("0x{0:X}", val.PrimitiveValue); } else { this.Text = val.AsString; @@ -147,9 +147,9 @@ namespace Debugger.AddIn.TreeModel ToolStripMenuItem hexView; hexView = new ToolStripMenuItem(); hexView.Text = ResourceService.GetString("MainWindow.Windows.Debug.LocalVariables.ShowInHexadecimal"); - hexView.Checked = ShowValuesInHexadecimal; + hexView.Checked = DebuggingOptions.ShowValuesInHexadecimal; hexView.Click += delegate { - ShowValuesInHexadecimal = !ShowValuesInHexadecimal; + DebuggingOptions.ShowValuesInHexadecimal = !DebuggingOptions.ShowValuesInHexadecimal; }; menu.Items.AddRange(new ToolStripItem[] { @@ -165,14 +165,5 @@ namespace Debugger.AddIn.TreeModel return (WindowsDebugger)DebuggerService.CurrentDebugger; } } - - public static bool ShowValuesInHexadecimal { - get { - return WindowsDebugger.Properties.Get("ShowValuesInHexadecimal", false); - } - set { - WindowsDebugger.Properties.Set("ShowValuesInHexadecimal", value); - } - } } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj index 0ef2c16b5c..cfc3d53c84 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Debugger.Core.csproj @@ -45,6 +45,7 @@ + diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Module.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Module.cs index fb1bb4a678..975a758fe4 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Module.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Module.cs @@ -27,6 +27,15 @@ namespace Debugger ISymUnmanagedReader symReader; MetaDataImport metaData; + public event EventHandler SymbolsLoaded; + + protected virtual void OnSymbolsLoaded(ModuleEventArgs e) + { + if (SymbolsLoaded != null) { + SymbolsLoaded(this, e); + } + } + [Debugger.Tests.Ignore] public Process Process { get { @@ -119,7 +128,7 @@ namespace Debugger } } - public bool SymbolsLoaded { + public bool HasSymbols { get { return symReader != null; } @@ -134,15 +143,6 @@ namespace Debugger } } - public bool JMCStatus { - set { - uint unused = 0; - if (corModule.Is()) { // Is the debuggee .NET 2.0? - (corModule.CastTo()).SetJMCStatus(value?1:0, 0, ref unused); - } - } - } - /// Get all non-generic types defined in this module public List GetDefinedTypes() { @@ -169,40 +169,54 @@ namespace Debugger fullPath = pModule.Name; - symReader = metaData.GetSymReader(fullPath, null); - - JMCStatus = SymbolsLoaded; - - FindNonUserCode(); + LoadSymbols(process.Debugger.SymbolsSearchPaths); + SetJustMyCodeStatus(this.HasSymbols, process.Debugger.ObeyDebuggerAttributes); + } + + public void LoadSymbols(string[] searchPath) + { + if (symReader == null) { + symReader = metaData.GetSymReader(fullPath, string.Join("; ", searchPath ?? new string[0])); + if (symReader != null) { + process.OnModuleSymbolsLoaded(new ModuleEventArgs(this)); + OnSymbolsLoaded(new ModuleEventArgs(this)); + } + } } /// /// Finds all classes and methods marked with DebuggerNonUserCode attribute - /// and it marks them for JMC so that they are not stepped into + /// and marks them for JMC so that they are not stepped into /// - void FindNonUserCode() + public void SetJustMyCodeStatus(bool isMyCode, bool obeyAttributes) { - if (this.SymbolsLoaded) { - foreach(CustomAttributeProps ca in metaData.EnumCustomAttributeProps(0, 0)) { - MemberRefProps constructorMethod = metaData.GetMemberRefProps(ca.Type); - TypeRefProps attributeType = metaData.GetTypeRefProps(constructorMethod.DeclaringType); - if (attributeType.Name == "System.Diagnostics.DebuggerStepThroughAttribute" || - attributeType.Name == "System.Diagnostics.DebuggerNonUserCodeAttribute" || - attributeType.Name == "System.Diagnostics.DebuggerHiddenAttribute") - { - if (ca.Owner >> 24 == 0x02) { // TypeDef - ICorDebugClass2 corClass = corModule.GetClassFromToken(ca.Owner).CastTo(); - corClass.SetJMCStatus(0 /* false */); - this.Process.TraceMessage("Class {0} marked as non-user code", metaData.GetTypeDefProps(ca.Owner).Name); - } - if (ca.Owner >> 24 == 0x06) { // MethodDef - ICorDebugFunction2 corFunction = corModule.GetFunctionFromToken(ca.Owner).CastTo(); - corFunction.SetJMCStatus(0 /* false */); - MethodProps methodProps = metaData.GetMethodProps(ca.Owner); - this.Process.TraceMessage("Function {0}.{1} marked as non-user code", metaData.GetTypeDefProps(methodProps.ClassToken).Name, methodProps.Name); + uint unused = 0; + if (isMyCode) { + corModule.CastTo().SetJMCStatus(1, 0, ref unused); + if (obeyAttributes) { + foreach(CustomAttributeProps ca in metaData.EnumCustomAttributeProps(0, 0)) { + MemberRefProps constructorMethod = metaData.GetMemberRefProps(ca.Type); + TypeRefProps attributeType = metaData.GetTypeRefProps(constructorMethod.DeclaringType); + if (attributeType.Name == "System.Diagnostics.DebuggerStepThroughAttribute" || + attributeType.Name == "System.Diagnostics.DebuggerNonUserCodeAttribute" || + attributeType.Name == "System.Diagnostics.DebuggerHiddenAttribute") + { + if (ca.Owner >> 24 == 0x02) { // TypeDef + ICorDebugClass2 corClass = corModule.GetClassFromToken(ca.Owner).CastTo(); + corClass.SetJMCStatus(0 /* false */); + this.Process.TraceMessage("Class {0} marked as non-user code", metaData.GetTypeDefProps(ca.Owner).Name); + } + if (ca.Owner >> 24 == 0x06) { // MethodDef + ICorDebugFunction2 corFunction = corModule.GetFunctionFromToken(ca.Owner).CastTo(); + corFunction.SetJMCStatus(0 /* false */); + MethodProps methodProps = metaData.GetMethodProps(ca.Owner); + this.Process.TraceMessage("Function {0}.{1} marked as non-user code", metaData.GetTypeDefProps(methodProps.ClassToken).Name, methodProps.Name); + } } } } + } else { + corModule.CastTo().SetJMCStatus(0, 0, ref unused); } } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.Options.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.Options.cs new file mode 100644 index 0000000000..189b7a96c0 --- /dev/null +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/NDebugger.Options.cs @@ -0,0 +1,54 @@ +// +// +// +// +// $Revision$ +// + +using System; + +namespace Debugger +{ + public partial class NDebugger + { + bool justMyCodeEnabled; + bool obeyDebuggerAttributes; + string[] symbolsSearchPaths; + + public bool JustMyCodeEnabled { + get { return justMyCodeEnabled; } + // Affects steppers during their creation so there is nothing to update + set { justMyCodeEnabled = value; } + } + + public bool ObeyDebuggerAttributes { + get { return obeyDebuggerAttributes; } + set { + if (obeyDebuggerAttributes != value) { + obeyDebuggerAttributes = value; + foreach(Process process in this.Processes) { + foreach(Module module in process.Modules) { + // Rechceck the module for attributes + module.SetJustMyCodeStatus(module.HasSymbols, obeyDebuggerAttributes); + } + } + } + } + } + + public string[] SymbolsSearchPaths { + get { return symbolsSearchPaths; } + set { + if (symbolsSearchPaths != value) { + symbolsSearchPaths = value; + foreach(Process process in this.Processes) { + foreach(Module module in process.Modules) { + // Try to load the symbols + module.LoadSymbols(symbolsSearchPaths); + } + } + } + } + } + } +} diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-Modules.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-Modules.cs index d08354e5bb..a4b9dbf3e1 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-Modules.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Process-Modules.cs @@ -20,6 +20,7 @@ namespace Debugger public event EventHandler ModuleLoaded; public event EventHandler ModuleUnloaded; + public event EventHandler ModuleSymbolsLoaded; protected void OnModuleLoaded(Module module) { @@ -34,6 +35,13 @@ namespace Debugger ModuleUnloaded(this, new ModuleEventArgs(module)); } } + + internal virtual void OnModuleSymbolsLoaded(ModuleEventArgs e) + { + if (ModuleSymbolsLoaded != null) { + ModuleSymbolsLoaded(this, e); + } + } public IList Modules { get{ diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs index 7f715f0261..36f63d8df6 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/StackFrame.cs @@ -162,7 +162,7 @@ namespace Debugger void AsyncStep(bool stepIn) { - if (this.MethodInfo.Module.SymbolsLoaded == false) { + if (this.MethodInfo.Module.HasSymbols == false) { throw new DebuggerException("Unable to step. No symbols loaded."); } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Stepper.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Stepper.cs index 4ed8e21e26..640fcb2b6b 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Stepper.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Stepper.cs @@ -59,9 +59,12 @@ namespace Debugger public bool JustMyCode { set { - if (corStepper.Is()) { // Is the debuggee .NET 2.0? + if (value) { corStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE); - corStepper.CastTo().SetJMC(value ? 1 : 0); + corStepper.CastTo().SetJMC(1); + } else { + corStepper.SetUnmappedStopMask(CorDebugUnmappedStop.STOP_NONE); + corStepper.CastTo().SetJMC(0); } } } @@ -77,7 +80,7 @@ namespace Debugger corStepper = stackFrame.CorILFrame.CreateStepper(); - JustMyCode = true; + this.JustMyCode = Process.Debugger.JustMyCodeEnabled; stackFrame.Thread.Steppers.Add(this); } diff --git a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Thread.cs b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Thread.cs index 5286b27375..fd7f835298 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Thread.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Control/Thread.cs @@ -298,7 +298,7 @@ namespace Debugger public string GetStackTrace() { - return GetStackTrace("at {0} in {1}:line {2}", "at {0} in {1}"); + return GetStackTrace("at {0} in {1}:line {2}", "at {0}"); } public string GetStackTrace(string formatSymbols, string formatNoSymbols) diff --git a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs index af425ced19..3277db7897 100644 --- a/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs +++ b/src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/DebuggerTestsBase.cs @@ -145,7 +145,7 @@ namespace Debugger.Tests LogEvent("LogMessage", e.Message.Replace("\r",@"\r").Replace("\n",@"\n")); }; process.ModuleLoaded += delegate(object sender, ModuleEventArgs e) { - LogEvent("ModuleLoaded", e.Module.Filename + (e.Module.SymbolsLoaded ? " (Has symbols)" : " (No symbols)")); + LogEvent("ModuleLoaded", e.Module.Filename + (e.Module.HasSymbols ? " (Has symbols)" : " (No symbols)")); }; process.Paused += delegate(object sender, ProcessEventArgs e) { LogEvent("DebuggingPaused", e.Process.PauseSession.PausedReason.ToString()); diff --git a/src/Main/StartUp/Project/Resources/StringResources.resources b/src/Main/StartUp/Project/Resources/StringResources.resources index 3103bb54ab..0a1797f814 100644 Binary files a/src/Main/StartUp/Project/Resources/StringResources.resources and b/src/Main/StartUp/Project/Resources/StringResources.resources differ