mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Implement better UIB breakpoints
This commit is contained in:
@@ -73,6 +73,16 @@ namespace Microsoft.Iris.Markup
|
||||
OpCode opCode = (OpCode)reader.ReadByte();
|
||||
Debug.Data.InterpreterEntry entry = new(opCode);
|
||||
|
||||
// Fetch line and column numbers from the table
|
||||
if (debugging && context.LoadResult.LineNumberTable.TryLookup(reader.CurrentOffset, out int line, out int column))
|
||||
{
|
||||
// Check if a breakpoint has been set at this location
|
||||
bool shouldBreak = Application.DebugSettings.Breakpoints
|
||||
.Any(b => b.Line == line && b.Column == column && b.Uri.Equals(loadResult.Uri, StringComparison.OrdinalIgnoreCase));
|
||||
if (shouldBreak)
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
|
||||
switch (opCode)
|
||||
{
|
||||
case OpCode.ConstructObject:
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Microsoft.Iris.Markup
|
||||
uint currentOffset = _loadResult.ObjectSection.CurrentOffset;
|
||||
if (currentOffset > 0U)
|
||||
--currentOffset;
|
||||
_loadResult.LineNumberTable.Lookup(currentOffset, out line, out column);
|
||||
_loadResult.LineNumberTable.TryLookup(currentOffset, out line, out column);
|
||||
}
|
||||
|
||||
public IMarkupTypeBase Instance => _instance;
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Microsoft.Iris.Markup
|
||||
_lookupTable = null;
|
||||
}
|
||||
|
||||
public void Lookup(uint offset, out int line, out int column)
|
||||
public bool TryLookup(uint offset, out int line, out int column)
|
||||
{
|
||||
int length = _runtimeList.Length;
|
||||
int index = 0;
|
||||
@@ -52,11 +52,13 @@ namespace Microsoft.Iris.Markup
|
||||
{
|
||||
line = UnpackLine(_runtimeList[index]);
|
||||
column = UnpackColumn(_runtimeList[index]);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
line = -1;
|
||||
column = -1;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,10 +71,10 @@ namespace Microsoft.Iris.Markup
|
||||
|
||||
private static ulong Pack(uint offset, int line, int column) => (ulong)(offset | (long)line << 22 | (long)column << 43);
|
||||
|
||||
private static uint UnpackOffset(ulong value) => (uint)(value & 4194303UL);
|
||||
private static uint UnpackOffset(ulong value) => (uint)(value & 0x3F_FFFFUL);
|
||||
|
||||
private static int UnpackLine(ulong value) => (int)((value & 8796088827904UL) >> 22);
|
||||
private static int UnpackLine(ulong value) => (int)((value & 0x7FF_FFC0_0000UL) >> 22);
|
||||
|
||||
private static int UnpackColumn(ulong value) => (int)((value & 18446735277616529408UL) >> 43);
|
||||
private static int UnpackColumn(ulong value) => (int)((value & 0xFFFF_F800_0000_0000UL) >> 43);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user