Browse Source

Fixed SD2-1467 - "Can't load file 17d14f5c-a337-4978-8281-53493378c1071.vb under ."

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5257 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
David Srbecký 16 years ago
parent
commit
58b7e7476a
  1. 3
      src/AddIns/Debugger/Debugger.AddIn/Pads/RunningThreadsPad.cs
  2. 4
      src/AddIns/Debugger/Debugger.Core/Eval.cs
  3. 12
      src/AddIns/Debugger/Debugger.Core/MetaData/DebugMethodInfo.cs
  4. 10
      src/AddIns/Debugger/Debugger.Core/Process.cs
  5. 22
      src/AddIns/Debugger/Debugger.Core/SourcecodeSegment.cs
  6. 39
      src/AddIns/Debugger/Debugger.Core/Thread.cs
  7. 12
      src/AddIns/Debugger/Debugger.Tests/Tests/ControlFlow_MainThreadExit.cs
  8. 14
      src/AddIns/Debugger/Debugger.Tests/Tests/Thread_Tests.cs

3
src/AddIns/Debugger/Debugger.AddIn/Pads/RunningThreadsPad.cs

@ -196,11 +196,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -196,11 +196,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
item.SubItems.Add(thread.Name);
StackFrame location = null;
if (thread.Process.IsPaused) {
location = thread.MostRecentStackFrameWithLoadedSymbols;
if (location == null) {
location = thread.MostRecentStackFrame;
}
}
if (location != null) {
item.SubItems.Add(location.MethodInfo.Name);
} else {

4
src/AddIns/Debugger/Debugger.Core/Eval.cs

@ -135,7 +135,7 @@ namespace Debugger @@ -135,7 +135,7 @@ namespace Debugger
foreach(Thread t in appDomain.Process.Threads) {
if (t.CorThread.GetAppDomain().GetID() == appDomain.ID &&
!t.Suspended &&
!t.IsMostRecentStackFrameNative &&
!t.IsInNativeCode &&
t.IsAtSafePoint)
{
thread = t;
@ -146,7 +146,7 @@ namespace Debugger @@ -146,7 +146,7 @@ namespace Debugger
if (thread == null)
throw new GetValueException("Can not evaluate because no thread is selected");
if (thread.IsMostRecentStackFrameNative)
if (thread.IsInNativeCode)
throw new GetValueException("Can not evaluate because native frame is on top of stack");
if (!thread.IsAtSafePoint)
throw new GetValueException("Can not evaluate because thread is not at a safe point");

12
src/AddIns/Debugger/Debugger.Core/MetaData/DebugMethodInfo.cs

@ -264,7 +264,7 @@ namespace Debugger.MetaData @@ -264,7 +264,7 @@ namespace Debugger.MetaData
if (this.SymMethod == null) return true;
}
if (opt.StepOverDebuggerAttributes) {
if (this.HasDebuggerAttribute) return true;
if (this.IsNonUserCode) return true;
}
if (opt.StepOverAllProperties) {
if (this.IsPropertyAccessor) return true;
@ -396,13 +396,13 @@ namespace Debugger.MetaData @@ -396,13 +396,13 @@ namespace Debugger.MetaData
}
}
bool? hasDebuggerAttribute;
bool? isNonUserCode;
bool HasDebuggerAttribute {
public bool IsNonUserCode {
get {
if (hasDebuggerAttribute.HasValue) return hasDebuggerAttribute.Value;
if (isNonUserCode.HasValue) return isNonUserCode.Value;
hasDebuggerAttribute =
isNonUserCode =
// Look on the method
DebugType.IsDefined(
this,
@ -419,7 +419,7 @@ namespace Debugger.MetaData @@ -419,7 +419,7 @@ namespace Debugger.MetaData
typeof(System.Diagnostics.DebuggerNonUserCodeAttribute),
typeof(System.Diagnostics.DebuggerHiddenAttribute));
return hasDebuggerAttribute.Value;
return isNonUserCode.Value;
}
}

10
src/AddIns/Debugger/Debugger.Core/Process.cs

@ -525,7 +525,15 @@ namespace Debugger @@ -525,7 +525,15 @@ namespace Debugger
{
SelectSomeThread();
if (this.SelectedThread != null) {
this.SelectedThread.SelectedStackFrame = this.SelectedThread.MostRecentStackFrameWithLoadedSymbols;
this.SelectedThread.SelectedStackFrame = null;
foreach (StackFrame stackFrame in this.SelectedThread.Callstack) {
if (stackFrame.HasSymbols) {
if (this.Options.StepOverDebuggerAttributes && stackFrame.MethodInfo.IsNonUserCode)
continue;
this.SelectedThread.SelectedStackFrame = stackFrame;
break;
}
}
}
}

22
src/AddIns/Debugger/Debugger.Core/SourcecodeSegment.cs

@ -311,6 +311,28 @@ namespace Debugger @@ -311,6 +311,28 @@ namespace Debugger
segment.ilStart = ilStart;
segment.ilEnd = ilEnd;
segment.stepRanges = stepRanges.ToArray();
// VB.NET sometimes produces temporary files which it then deletes
// (eg 17d14f5c-a337-4978-8281-53493378c1071.vb)
string filename = Path.GetFileName(segment.filename);
if (filename.Length == 40 && filename.EndsWith(".vb")) {
bool guidName = true;
foreach(char c in filename.Substring(0, filename.Length - 3)) {
if (('0' <= c && c <= '9') ||
('a' <= c && c <= 'f') ||
('A' <= c && c <= 'F') ||
(c == '-'))
{
guidName = true;
} else {
guidName = false;
break;
}
}
if (guidName)
return null;
}
return segment;
}
}

39
src/AddIns/Debugger/Debugger.Core/Thread.cs

@ -255,23 +255,24 @@ namespace Debugger @@ -255,23 +255,24 @@ namespace Debugger
/// <summary> Gets the whole callstack of the Thread. </summary>
/// <remarks> If the thread is in invalid state returns empty array </remarks>
[Debugger.Tests.Ignore]
public StackFrame[] GetCallstack()
{
return new List<StackFrame>(CallstackEnum).ToArray();
return new List<StackFrame>(Callstack).ToArray();
}
/// <summary> Get given number of frames from the callstack </summary>
public StackFrame[] GetCallstack(int maxFrames)
{
List<StackFrame> frames = new List<StackFrame>();
foreach(StackFrame frame in CallstackEnum) {
foreach(StackFrame frame in Callstack) {
frames.Add(frame);
if (frames.Count == maxFrames) break;
}
return frames.ToArray();
}
IEnumerable<StackFrame> CallstackEnum {
public IEnumerable<StackFrame> Callstack {
get {
process.AssertPaused();
@ -358,48 +359,20 @@ namespace Debugger @@ -358,48 +359,20 @@ namespace Debugger
}
}
#region Convenience methods
public StackFrame MostRecentStackFrameWithLoadedSymbols {
get {
foreach (StackFrame stackFrame in CallstackEnum) {
if (stackFrame.HasSymbols) {
return stackFrame;
}
}
return null;
}
}
/// <summary>
/// Returns the most recent stack frame (the one that is currently executing).
/// Returns null if callstack is empty.
/// </summary>
public StackFrame MostRecentStackFrame {
get {
foreach(StackFrame stackFrame in CallstackEnum) {
foreach(StackFrame stackFrame in Callstack) {
return stackFrame;
}
return null;
}
}
/// <summary>
/// Returns the first stack frame that was called on thread
/// </summary>
public StackFrame OldestStackFrame {
get {
StackFrame first = null;
foreach(StackFrame stackFrame in CallstackEnum) {
first = stackFrame;
}
return first;
}
}
#endregion
public bool IsMostRecentStackFrameNative {
public bool IsInNativeCode {
get {
process.AssertPaused();
if (this.IsInValidState) {

12
src/AddIns/Debugger/Debugger.Tests/Tests/ControlFlow_MainThreadExit.cs

@ -66,28 +66,24 @@ namespace Debugger.Tests { @@ -66,28 +66,24 @@ namespace Debugger.Tests {
Selected="Thread Name = Suspended = False">
<Item>
<Thread
Callstack="{static void Debugger.Tests.ControlFlow_MainThreadExit.Main()}"
CurrentExceptionType="0"
GetCallstack="{static void Debugger.Tests.ControlFlow_MainThreadExit.Main()}"
IsAtSafePoint="True"
IsInValidState="True"
MostRecentStackFrame="static void Debugger.Tests.ControlFlow_MainThreadExit.Main()"
MostRecentStackFrameWithLoadedSymbols="static void Debugger.Tests.ControlFlow_MainThreadExit.Main()"
Name=""
OldestStackFrame="static void Debugger.Tests.ControlFlow_MainThreadExit.Main()"
Priority="Normal"
RuntimeValue="{System.Threading.Thread}"
SelectedStackFrame="static void Debugger.Tests.ControlFlow_MainThreadExit.Main()" />
</Item>
<Item>
<Thread
Callstack="{static System.Boolean System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext), System.Boolean System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean exitContext), System.Boolean System.Threading.WaitHandle.WaitOne(), static void Debugger.Tests.ControlFlow_MainThreadExit.WaitForALongTime(), static void System.Threading.ThreadHelper.ThreadStart_Context(Object state), static void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx), static void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state), void System.Threading.ThreadHelper.ThreadStart()}"
CurrentExceptionType="0"
GetCallstack="{static System.Boolean System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext), System.Boolean System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean exitContext), System.Boolean System.Threading.WaitHandle.WaitOne(), static void Debugger.Tests.ControlFlow_MainThreadExit.WaitForALongTime(), static void System.Threading.ThreadHelper.ThreadStart_Context(Object state), static void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx), static void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state), void System.Threading.ThreadHelper.ThreadStart()}"
IsAtSafePoint="True"
IsInValidState="True"
MostRecentStackFrame="static System.Boolean System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)"
MostRecentStackFrameWithLoadedSymbols="static void Debugger.Tests.ControlFlow_MainThreadExit.WaitForALongTime()"
Name="Worker thread"
OldestStackFrame="void System.Threading.ThreadHelper.ThreadStart()"
Priority="Normal"
RuntimeValue="{System.Threading.Thread}" />
</Item>
@ -105,14 +101,12 @@ namespace Debugger.Tests { @@ -105,14 +101,12 @@ namespace Debugger.Tests {
</Item>
<Item>
<Thread
Callstack="{static System.Boolean System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext), System.Boolean System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean exitContext), System.Boolean System.Threading.WaitHandle.WaitOne(), static void Debugger.Tests.ControlFlow_MainThreadExit.WaitForALongTime(), static void System.Threading.ThreadHelper.ThreadStart_Context(Object state), static void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx), static void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state), void System.Threading.ThreadHelper.ThreadStart()}"
CurrentExceptionType="0"
GetCallstack="{static System.Boolean System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext), System.Boolean System.Threading.WaitHandle.WaitOne(Int32 millisecondsTimeout, Boolean exitContext), System.Boolean System.Threading.WaitHandle.WaitOne(), static void Debugger.Tests.ControlFlow_MainThreadExit.WaitForALongTime(), static void System.Threading.ThreadHelper.ThreadStart_Context(Object state), static void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx), static void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state), void System.Threading.ThreadHelper.ThreadStart()}"
IsAtSafePoint="True"
IsInValidState="True"
MostRecentStackFrame="static System.Boolean System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)"
MostRecentStackFrameWithLoadedSymbols="static void Debugger.Tests.ControlFlow_MainThreadExit.WaitForALongTime()"
Name="Worker thread"
OldestStackFrame="void System.Threading.ThreadHelper.ThreadStart()"
Priority="Normal"
RuntimeValue="{System.Threading.Thread}"
SelectedStackFrame="static void Debugger.Tests.ControlFlow_MainThreadExit.WaitForALongTime()" />

14
src/AddIns/Debugger/Debugger.Tests/Tests/Thread_Tests.cs

@ -56,13 +56,12 @@ namespace Debugger.Tests { @@ -56,13 +56,12 @@ namespace Debugger.Tests {
<ModuleLoaded>mscorlib.dll (No symbols)</ModuleLoaded>
<ThreadStartedEvent>
<Thread
Callstack="{void System.AppDomain.SetupDomain(Boolean allowRedirects, String path, String configFile)}"
CurrentExceptionType="0"
GetCallstack="{void System.AppDomain.SetupDomain(Boolean allowRedirects, String path, String configFile)}"
IsAtSafePoint="True"
IsInValidState="True"
MostRecentStackFrame="void System.AppDomain.SetupDomain(Boolean allowRedirects, String path, String configFile)"
Name=""
OldestStackFrame="void System.AppDomain.SetupDomain(Boolean allowRedirects, String path, String configFile)"
Priority="Normal"
RuntimeValue="null" />
</ThreadStartedEvent>
@ -70,14 +69,12 @@ namespace Debugger.Tests { @@ -70,14 +69,12 @@ namespace Debugger.Tests {
<DebuggingPaused>Break Thread_Tests.cs:17,4-17,40</DebuggingPaused>
<Thread>
<Thread
Callstack="{static void Debugger.Tests.Thread_Tests.Main()}"
CurrentExceptionType="0"
GetCallstack="{static void Debugger.Tests.Thread_Tests.Main()}"
IsAtSafePoint="True"
IsInValidState="True"
MostRecentStackFrame="static void Debugger.Tests.Thread_Tests.Main()"
MostRecentStackFrameWithLoadedSymbols="static void Debugger.Tests.Thread_Tests.Main()"
Name=""
OldestStackFrame="static void Debugger.Tests.Thread_Tests.Main()"
Priority="AboveNormal"
RuntimeValue="{System.Threading.Thread}"
SelectedStackFrame="static void Debugger.Tests.Thread_Tests.Main()" />
@ -85,27 +82,24 @@ namespace Debugger.Tests { @@ -85,27 +82,24 @@ namespace Debugger.Tests {
<DebuggingPaused>Break Thread_Tests.cs:19,4-19,40</DebuggingPaused>
<Thread>
<Thread
Callstack="{static void Debugger.Tests.Thread_Tests.Main()}"
CurrentExceptionType="0"
GetCallstack="{static void Debugger.Tests.Thread_Tests.Main()}"
IsAtSafePoint="True"
IsInValidState="True"
MostRecentStackFrame="static void Debugger.Tests.Thread_Tests.Main()"
MostRecentStackFrameWithLoadedSymbols="static void Debugger.Tests.Thread_Tests.Main()"
Name="ThreadName"
OldestStackFrame="static void Debugger.Tests.Thread_Tests.Main()"
Priority="AboveNormal"
RuntimeValue="{System.Threading.Thread}"
SelectedStackFrame="static void Debugger.Tests.Thread_Tests.Main()" />
</Thread>
<ThreadStartedEvent>
<Thread
Callstack="{void System.Threading.ReaderWriterLock.Finalize()}"
CurrentExceptionType="0"
GetCallstack="{void System.Threading.ReaderWriterLock.Finalize()}"
IsAtSafePoint="True"
IsInValidState="True"
MostRecentStackFrame="void System.Threading.ReaderWriterLock.Finalize()"
Name=""
OldestStackFrame="void System.Threading.ReaderWriterLock.Finalize()"
Priority="Normal"
RuntimeValue="null" />
</ThreadStartedEvent>

Loading…
Cancel
Save