Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIEngine: Fix Disassembly fail on GPU if startAddress is offset #1420

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading