mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Correctly identify the start of a line when changing the address
This commit is contained in:
parent
a928c62ad1
commit
63e2f34beb
5 changed files with 29 additions and 6 deletions
|
@ -28,6 +28,10 @@
|
|||
std::map<u32,DisassemblyEntry*> DisassemblyManager::entries;
|
||||
DebugInterface* DisassemblyManager::cpu;
|
||||
|
||||
bool isInInterval(u32 start, u32 size, u32 value)
|
||||
{
|
||||
return start <= value && value < start+size;
|
||||
}
|
||||
|
||||
void parseDisasm(const char* disasm, char* opcode, char* arguments, bool insertSymbols)
|
||||
{
|
||||
|
@ -170,6 +174,21 @@ DisassemblyLineInfo DisassemblyManager::getLine(u32 address, bool insertSymbols)
|
|||
return result;
|
||||
}
|
||||
|
||||
u32 DisassemblyManager::getStartAddress(u32 address)
|
||||
{
|
||||
auto it = findDisassemblyEntry(entries,address,false);
|
||||
if (it == entries.end())
|
||||
{
|
||||
analyze(address,1);
|
||||
it = findDisassemblyEntry(entries,address,false);
|
||||
if (it == entries.end())
|
||||
return address;
|
||||
}
|
||||
|
||||
DisassemblyEntry* entry = it->second;
|
||||
int line = entry->getLineNum(address,true);
|
||||
return entry->getLineAddress(line);
|
||||
}
|
||||
|
||||
u32 DisassemblyManager::getNthPreviousAddress(u32 address, int n)
|
||||
{
|
||||
|
@ -510,7 +529,7 @@ bool DisassemblyMacro::disassemble(u32 address, DisassemblyLineInfo& dest)
|
|||
case MACRO_LI:
|
||||
case MACRO_MEMORYIMM:
|
||||
dest.name = name;
|
||||
sprintf(buffer,"%s,%08X",DisassemblyManager::getCpu()->GetRegName(0,rt),immediate);
|
||||
sprintf(buffer,"%s,0x%08X",DisassemblyManager::getCpu()->GetRegName(0,rt),immediate);
|
||||
dest.params = buffer;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -143,4 +143,6 @@ private:
|
|||
DisassemblyEntry* getEntry(u32 address);
|
||||
static std::map<u32,DisassemblyEntry*> entries;
|
||||
static DebugInterface* cpu;
|
||||
};
|
||||
};
|
||||
|
||||
bool isInInterval(u32 start, u32 size, u32 value);
|
|
@ -503,7 +503,7 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
|
|||
COLORREF backgroundColor = whiteBackground ? 0xFFFFFF : debugger->getColor(address);
|
||||
COLORREF textColor = 0x000000;
|
||||
|
||||
if (address == debugger->getPC())
|
||||
if (isInInterval(address,line.totalSize,debugger->getPC()))
|
||||
{
|
||||
backgroundColor = scaleColor(backgroundColor,1.05f);
|
||||
}
|
||||
|
@ -545,8 +545,8 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
|
|||
char addressText[64];
|
||||
getDisasmAddressText(address,addressText,true);
|
||||
TextOutA(hdc,pixelPositions.addressStart,rowY1+2,addressText,(int)strlen(addressText));
|
||||
|
||||
if (address == debugger->getPC())
|
||||
|
||||
if (isInInterval(address,line.totalSize,debugger->getPC()))
|
||||
{
|
||||
TextOut(hdc,pixelPositions.opcodeStart-8,rowY1,L"■",1);
|
||||
}
|
||||
|
|
|
@ -133,6 +133,7 @@ public:
|
|||
u32 getWindowEnd() { return windowStart+visibleRows*instructionSize; };
|
||||
void gotoAddr(unsigned int addr)
|
||||
{
|
||||
addr = manager.getStartAddress(addr);
|
||||
u32 windowEnd = windowStart+visibleRows*instructionSize;
|
||||
u32 newAddress = addr&(~(instructionSize-1));
|
||||
|
||||
|
@ -175,6 +176,7 @@ public:
|
|||
|
||||
void setCurAddress(u32 newAddress, bool extend = false)
|
||||
{
|
||||
newAddress = manager.getStartAddress(newAddress);
|
||||
u32 after = manager.getNthNextAddress(newAddress,1);
|
||||
curAddress = newAddress;
|
||||
selectRangeStart = extend ? std::min(selectRangeStart, newAddress) : newAddress;
|
||||
|
|
|
@ -100,7 +100,7 @@ INT_PTR CALLBACK DumpMemoryWindow::dlgFunc(HWND hwnd, UINT iMsg, WPARAM wParam,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
bool isInInterval(u32 start, u32 end, u32 value)
|
||||
static bool isInInterval(u32 start, u32 end, u32 value)
|
||||
{
|
||||
return start <= value && value < end;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue