Skip to content

Commit

Permalink
Debugger: Consistently handle invalid addresses.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Apr 24, 2018
1 parent 6ed8636 commit 07811ec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
29 changes: 14 additions & 15 deletions Core/Debugger/DisassemblyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,29 +244,28 @@ void DisassemblyManager::getLine(u32 address, bool insertSymbols, DisassemblyLin
{
analyze(address);
it = findDisassemblyEntry(entries,address,false);
}

if (it == entries.end())
{
if (address % 4)
dest.totalSize = ((address+3) & ~3)-address;
else
dest.totalSize = 4;
dest.name = "ERROR";
dest.params = "Disassembly failure";
if (it != entries.end()) {
DisassemblyEntry *entry = it->second;
if (entry->disassemble(address, dest, insertSymbols))
return;
}
}

DisassemblyEntry* entry = it->second;
if (entry->disassemble(address,dest,insertSymbols))
return;

dest.type = DISTYPE_OTHER;
memset(&dest.info, 0, sizeof(dest.info));
dest.info.opcodeAddress = address;
if (address % 4)
dest.totalSize = ((address+3) & ~3)-address;
else
dest.totalSize = 4;
dest.name = "ERROR";
dest.params = "Disassembly failure";
if (Memory::IsValidRange(address, 4)) {
dest.name = "ERROR";
dest.params = "Disassembly failure";
} else {
dest.name = "-";
dest.params = "";
}
}

u32 DisassemblyManager::getStartAddress(u32 address)
Expand Down
1 change: 1 addition & 0 deletions Core/MIPS/MIPSAnalyst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,7 @@ namespace MIPSAnalyst {
memset(&info, 0, sizeof(info));

if (!Memory::IsValidAddress(address)) {
info.opcodeAddress = address;
return info;
}

Expand Down

0 comments on commit 07811ec

Please sign in to comment.