Browse Source

Fixed breakpoints for whitespace lines

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3236 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
99bb0a198e
  1. 2
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs
  2. 4
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/SourcecodeSegment.cs
  3. 3
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Primitive.cs
  4. 8
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs
  5. 76
      src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Breakpoint.cs

2
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs

@ -76,7 +76,7 @@ namespace Debugger.AddIn.TreeModel
if (DebuggingOptions.Instance.ShowValuesInHexadecimal && val.Type.IsInteger) { if (DebuggingOptions.Instance.ShowValuesInHexadecimal && val.Type.IsInteger) {
this.Text = String.Format("0x{0:X}", val.PrimitiveValue); this.Text = String.Format("0x{0:X}", val.PrimitiveValue);
} else if (val.Type.IsPointer) { } else if (val.Type.IsPointer) {
this.Text = String.Format("0x{0:X}", val.PrimitiveValue); this.Text = String.Format("0x{0:X}", val.PointerAddress);
} else { } else {
this.Text = val.AsString; this.Text = val.AsString;
} }

4
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/SourcecodeSegment.cs

@ -147,8 +147,8 @@ namespace Debugger
ISymUnmanagedMethod symMethod; ISymUnmanagedMethod symMethod;
try { try {
//uint validLine = symDoc.FindClosestLine((uint)StartLine); uint validLine = symDoc.FindClosestLine((uint)line);
symMethod = symReader.GetMethodFromDocumentPosition(symDoc, (uint)line, (uint)column); symMethod = symReader.GetMethodFromDocumentPosition(symDoc, (uint)validLine, (uint)column);
} catch { } catch {
return null; //Not found return null; //Not found
} }

3
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.Primitive.cs

@ -35,9 +35,6 @@ namespace Debugger
/// </summary> /// </summary>
public object PrimitiveValue { public object PrimitiveValue {
get { get {
if (this.Type.IsPointer) {
return this.CorValue.CastTo<ICorDebugReferenceValue>().Address;
}
if (!this.Type.IsPrimitive) throw new DebuggerException("Value is not a primitive type"); if (!this.Type.IsPrimitive) throw new DebuggerException("Value is not a primitive type");
if (this.Type.IsString) { if (this.Type.IsString) {
if (this.IsNull) return null; if (this.IsNull) return null;

8
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Values/Value.cs

@ -143,6 +143,14 @@ namespace Debugger
} }
} }
[Tests.Ignore]
public ulong PointerAddress {
get {
if (!this.Type.IsPointer) throw new DebuggerException("Not a pointer");
return this.CorValue.CastTo<ICorDebugReferenceValue>().Value;
}
}
/// <summary> Dereferences a pointer type </summary> /// <summary> Dereferences a pointer type </summary>
/// <returns> Returns null for a null pointer </returns> /// <returns> Returns null for a null pointer </returns>
public Value Dereference() public Value Dereference()

76
src/AddIns/Misc/Debugger/Debugger.Tests/Project/Src/TestPrograms/Breakpoint.cs

@ -16,6 +16,8 @@ namespace Debugger.Tests.TestPrograms
System.Diagnostics.Debugger.Break(); System.Diagnostics.Debugger.Break();
System.Diagnostics.Debug.WriteLine("Main 1"); System.Diagnostics.Debug.WriteLine("Main 1");
System.Diagnostics.Debug.WriteLine("Main 2"); // Breakpoint System.Diagnostics.Debug.WriteLine("Main 2"); // Breakpoint
// Breakpoint
System.Diagnostics.Debug.WriteLine("Main 3");
System.Diagnostics.Debugger.Break(); System.Diagnostics.Debugger.Break();
} }
} }
@ -30,17 +32,23 @@ namespace Debugger.Tests {
[NUnit.Framework.Test] [NUnit.Framework.Test]
public void Breakpoint() public void Breakpoint()
{ {
Breakpoint breakpoint = debugger.AddBreakpoint(@"Breakpoint.cs", 18); Breakpoint breakpoint1 = debugger.AddBreakpoint(@"Breakpoint.cs", 18);
Breakpoint breakpoint2 = debugger.AddBreakpoint(@"Breakpoint.cs", 19);
StartTest("Breakpoint.cs"); StartTest("Breakpoint.cs");
Assert.IsTrue(breakpoint.IsSet); Assert.IsTrue(breakpoint1.IsSet);
ObjectDump(breakpoint); Assert.IsTrue(breakpoint2.IsSet);
ObjectDump("Breakpoint1", breakpoint1);
ObjectDump("Breakpoint2", breakpoint2);
process.Continue();
process.Continue(); process.Continue();
process.Continue(); process.Continue();
process.AsyncContinue(); process.AsyncContinue();
process.WaitForExit(); process.WaitForExit();
ObjectDump(breakpoint); ObjectDump("Breakpoint1", breakpoint1);
ObjectDump("Breakpoint2", breakpoint2);
EndTest(); EndTest();
} }
@ -58,29 +66,55 @@ namespace Debugger.Tests {
<ModuleLoaded>Breakpoint.exe (Has symbols)</ModuleLoaded> <ModuleLoaded>Breakpoint.exe (Has symbols)</ModuleLoaded>
<ModuleLoaded>System.dll (No symbols)</ModuleLoaded> <ModuleLoaded>System.dll (No symbols)</ModuleLoaded>
<DebuggingPaused>Break Breakpoint.cs:16,4-16,40</DebuggingPaused> <DebuggingPaused>Break Breakpoint.cs:16,4-16,40</DebuggingPaused>
<Breakpoint <Breakpoint1>
CheckSum="null" <Breakpoint
Column="0" CheckSum="null"
Enabled="True" Column="0"
FileName="Breakpoint.cs" Enabled="True"
IsSet="True" FileName="Breakpoint.cs"
Line="18" IsSet="True"
OriginalLocation="Breakpoint.cs:18,4-18,49" /> Line="18"
OriginalLocation="Breakpoint.cs:18,4-18,49" />
</Breakpoint1>
<Breakpoint2>
<Breakpoint
CheckSum="null"
Column="0"
Enabled="True"
FileName="Breakpoint.cs"
IsSet="True"
Line="19"
OriginalLocation="Breakpoint.cs:20,4-20,49" />
</Breakpoint2>
<ModuleLoaded>System.Configuration.dll (No symbols)</ModuleLoaded> <ModuleLoaded>System.Configuration.dll (No symbols)</ModuleLoaded>
<ModuleLoaded>System.Xml.dll (No symbols)</ModuleLoaded> <ModuleLoaded>System.Xml.dll (No symbols)</ModuleLoaded>
<LogMessage>Main 1\r\n</LogMessage> <LogMessage>Main 1\r\n</LogMessage>
<DebuggingPaused>Breakpoint Breakpoint.cs:18,4-18,49</DebuggingPaused> <DebuggingPaused>Breakpoint Breakpoint.cs:18,4-18,49</DebuggingPaused>
<LogMessage>Main 2\r\n</LogMessage> <LogMessage>Main 2\r\n</LogMessage>
<DebuggingPaused>Break Breakpoint.cs:19,4-19,40</DebuggingPaused> <DebuggingPaused>Breakpoint Breakpoint.cs:20,4-20,49</DebuggingPaused>
<LogMessage>Main 3\r\n</LogMessage>
<DebuggingPaused>Break Breakpoint.cs:21,4-21,40</DebuggingPaused>
<ProcessExited /> <ProcessExited />
<Breakpoint <Breakpoint1>
CheckSum="null" <Breakpoint
Column="0" CheckSum="null"
Enabled="True" Column="0"
FileName="Breakpoint.cs" Enabled="True"
IsSet="False" FileName="Breakpoint.cs"
Line="18" IsSet="False"
OriginalLocation="Breakpoint.cs:18,4-18,49" /> Line="18"
OriginalLocation="Breakpoint.cs:18,4-18,49" />
</Breakpoint1>
<Breakpoint2>
<Breakpoint
CheckSum="null"
Column="0"
Enabled="True"
FileName="Breakpoint.cs"
IsSet="False"
Line="19"
OriginalLocation="Breakpoint.cs:20,4-20,49" />
</Breakpoint2>
</Test> </Test>
</DebuggerTests> </DebuggerTests>
#endif // EXPECTED_OUTPUT #endif // EXPECTED_OUTPUT

Loading…
Cancel
Save