Skip to content

Commit

Permalink
Merge pull request #1420 from intel-rganesh/Disassembly-Fail-GPU-Star…
Browse files Browse the repository at this point in the history
…tAdd-Offset

MIEngine: Fix Disassembly fail on GPU if startAddress is offset
  • Loading branch information
WardenGnaw authored Oct 23, 2023
2 parents 7a02ace + 398582e commit dad92af
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/MIDebugEngine/Engine.Impl/Disassembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,21 @@ private void DeleteRangeFromCache(DisassemblyBlock block)
// this is inefficient so we try and grab everything in one gulp
internal static async Task<DisasmInstruction[]> Disassemble(DebuggedProcess process, ulong startAddr, ulong endAddr)
{
string cmd = "-data-disassemble -s " + EngineUtils.AsAddr(startAddr, process.Is64BitArch) + " -e " + EngineUtils.AsAddr(endAddr, process.Is64BitArch) + " -- 2";
Results results = await process.CmdAsync(cmd, ResultClass.None);
string cmd;
string startAddrStr;
string endAddrStr;
int i = 0;
Results results;
do
{
startAddrStr = EngineUtils.AsAddr(startAddr, process.Is64BitArch);
endAddrStr = EngineUtils.AsAddr(endAddr, process.Is64BitArch);
cmd = "-data-disassemble -s " + startAddrStr + " -e " + endAddrStr + " -- 2";
results = await process.CmdAsync(cmd, ResultClass.None);
--startAddr;
++i;
} while (results.ResultClass != ResultClass.done && i < process.MaxInstructionSize);

if (results.ResultClass != ResultClass.done)
{
return null;
Expand Down

0 comments on commit dad92af

Please sign in to comment.