From 2f7a529b66ff3a3e0204fe155ca1e613f8dbc098 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Tue, 23 Nov 2021 15:09:16 -0800 Subject: [PATCH] Handle showing multi-source line code --- src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs b/src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs index d29515e15..3e774fd43 100644 --- a/src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs +++ b/src/MIDebugEngine/AD7.Impl/AD7Disassembly.cs @@ -213,11 +213,15 @@ public int Read(uint dwInstructions, enum_DISASSEMBLY_STREAM_FIELDS dwFields, ou if ((dwFields & enum_DISASSEMBLY_STREAM_FIELDS.DSF_POSITION) != 0 && currentLine != 0) { + // If we have a new line and the current line is greater than the previously seen source line. + // Try to grab the last seen source line + 1 and show a group of source code. + // Else, just show the single line. + uint startLine = isNewLine && currentLine > _dwLastSourceLine ? _dwLastSourceLine + 1 : currentLine; prgDisassembly[iOp].dwFields |= enum_DISASSEMBLY_STREAM_FIELDS.DSF_POSITION; prgDisassembly[iOp].posBeg = new TEXT_POSITION() { - dwLine = currentLine, + dwLine = startLine, dwColumn = 0 }; prgDisassembly[iOp].posEnd = new TEXT_POSITION()