From 3c29d64ad488366dcc325f0f214c82d8dc9ad42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Thu, 10 Jul 2008 19:26:00 +0000 Subject: [PATCH] All methods without symbols are marked as non-user code git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3212 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Control/Module.cs | 37 ++++++++++++------- .../Project/Src/Control/NDebugger.Options.cs | 8 +++- 2 files changed, 30 insertions(+), 15 deletions(-) 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 4e3bedacbc..4488b26137 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 @@ -198,6 +198,11 @@ namespace Debugger DateTime start = Util.HighPrecisionTimer.Now; uint unused = 0; + if (!this.Debugger.JustMyCodeEnabled) { + corModule.CastTo().SetJMCStatus(1, 0, ref unused); + return; + } + if (!this.HasSymbols) { corModule.CastTo().SetJMCStatus(0, 0, ref unused); return; @@ -227,19 +232,10 @@ namespace Debugger } } - // Mark generated constructors as non-user code + // Mark all methods without symbols as non-user code foreach(uint typeDef in metaData.EnumTypeDefs()) { - foreach(uint methodDef in metaData.EnumMethodsWithName(typeDef, ".ctor")) { - try { - this.SymReader.GetMethod(methodDef); - } catch (COMException) { // Symbols not found - DisableJustMyCode(methodDef); - } - } - foreach(uint methodDef in metaData.EnumMethodsWithName(typeDef, ".cctor")) { - try { - this.SymReader.GetMethod(methodDef); - } catch (COMException) { // Symbols not found + foreach(uint methodDef in metaData.EnumMethods(typeDef)) { + if (!HasMethodSymbols(methodDef)) { DisableJustMyCode(methodDef); } } @@ -267,6 +263,16 @@ namespace Debugger this.Process.TraceMessage("Set Just-My-Code for module \"{0}\" ({1} ms)", this.Filename, (end - start).TotalMilliseconds); } + bool HasMethodSymbols(uint methodDef) + { + try { + return this.SymReader.GetMethod(methodDef) != null; + } catch (COMException) { + // Symbols not found + return false; + } + } + void DisableJustMyCode(uint methodDef) { MethodProps methodProps = metaData.GetMethodProps(methodDef); @@ -279,7 +285,12 @@ namespace Debugger bool IsSingleLine(uint methodDef) { - ISymUnmanagedMethod symMethod = this.SymReader.GetMethod(methodDef); + ISymUnmanagedMethod symMethod; + try { + symMethod = this.SymReader.GetMethod(methodDef); + } catch (COMException) { + return false; // No symbols - can not determine + } List seqPoints = new List(symMethod.SequencePoints); seqPoints.Sort(); 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 index 4e2cf7d5af..56dcb3bac6 100644 --- 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 @@ -28,8 +28,12 @@ namespace Debugger public bool JustMyCodeEnabled { get { return justMyCodeEnabled; } - // Affects steppers during their creation so there is nothing to update - set { justMyCodeEnabled = value; } + set { + if (justMyCodeEnabled != value) { + justMyCodeEnabled = value; + ResetJustMyCodeInModules(); + } + } } public bool ObeyDebuggerAttributes {