mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Debugger: Copy Address will now copy addresses for the whole selection
This commit is contained in:
parent
964aa313a5
commit
f55782558c
@ -906,10 +906,8 @@ void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
|
||||
redraw();
|
||||
}
|
||||
|
||||
void CtrlDisAsmView::copyInstructions(u32 startAddr, u32 endAddr, bool withDisasm)
|
||||
{
|
||||
if (withDisasm == false)
|
||||
{
|
||||
void CtrlDisAsmView::CopyInstructions(u32 startAddr, u32 endAddr, CopyInstructionsMode mode) {
|
||||
if (mode != CopyInstructionsMode::DISASM) {
|
||||
int instructionSize = debugger->getInstructionSize(0);
|
||||
int count = (endAddr - startAddr) / instructionSize;
|
||||
int space = count * 32;
|
||||
@ -918,7 +916,8 @@ void CtrlDisAsmView::copyInstructions(u32 startAddr, u32 endAddr, bool withDisas
|
||||
char *p = temp, *end = temp + space;
|
||||
for (u32 pos = startAddr; pos < endAddr && p < end; pos += instructionSize)
|
||||
{
|
||||
p += snprintf(p, end - p, "%08X", debugger->readMemory(pos));
|
||||
u32 data = mode == CopyInstructionsMode::OPCODES ? debugger->readMemory(pos) : pos;
|
||||
p += snprintf(p, end - p, "%08X", data);
|
||||
|
||||
// Don't leave a trailing newline.
|
||||
if (pos + instructionSize < endAddr && p < end)
|
||||
@ -926,8 +925,7 @@ void CtrlDisAsmView::copyInstructions(u32 startAddr, u32 endAddr, bool withDisas
|
||||
}
|
||||
W32Util::CopyTextToClipboard(wnd, temp);
|
||||
delete [] temp;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
std::string disassembly = disassembleRange(startAddr,endAddr-startAddr);
|
||||
W32Util::CopyTextToClipboard(wnd, disassembly.c_str());
|
||||
}
|
||||
@ -956,14 +954,13 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
|
||||
assembleOpcode(curAddress,"");
|
||||
break;
|
||||
case ID_DISASM_COPYINSTRUCTIONDISASM:
|
||||
copyInstructions(selectRangeStart, selectRangeEnd, true);
|
||||
CopyInstructions(selectRangeStart, selectRangeEnd, CopyInstructionsMode::DISASM);
|
||||
break;
|
||||
case ID_DISASM_COPYADDRESS:
|
||||
{
|
||||
char temp[16];
|
||||
sprintf(temp,"%08X",curAddress);
|
||||
W32Util::CopyTextToClipboard(wnd, temp);
|
||||
}
|
||||
CopyInstructions(selectRangeStart, selectRangeEnd, CopyInstructionsMode::ADDRESSES);
|
||||
break;
|
||||
case ID_DISASM_COPYINSTRUCTIONHEX:
|
||||
CopyInstructions(selectRangeStart, selectRangeEnd, CopyInstructionsMode::OPCODES);
|
||||
break;
|
||||
case ID_DISASM_SETPCTOHERE:
|
||||
debugger->setPC(curAddress);
|
||||
@ -972,9 +969,6 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
|
||||
case ID_DISASM_FOLLOWBRANCH:
|
||||
followBranch();
|
||||
break;
|
||||
case ID_DISASM_COPYINSTRUCTIONHEX:
|
||||
copyInstructions(selectRangeStart, selectRangeEnd, false);
|
||||
break;
|
||||
case ID_DISASM_RUNTOHERE:
|
||||
{
|
||||
SendMessage(GetParent(wnd), WM_COMMAND, ID_DEBUG_RUNTOLINE, 0);
|
||||
|
@ -64,6 +64,12 @@ class CtrlDisAsmView
|
||||
bool dontRedraw;
|
||||
bool keyTaken;
|
||||
|
||||
enum class CopyInstructionsMode {
|
||||
OPCODES,
|
||||
DISASM,
|
||||
ADDRESSES,
|
||||
};
|
||||
|
||||
void assembleOpcode(u32 address, std::string defaultText);
|
||||
std::string disassembleRange(u32 start, u32 size);
|
||||
void disassembleToFile();
|
||||
@ -73,7 +79,7 @@ class CtrlDisAsmView
|
||||
bool getDisasmAddressText(u32 address, char* dest, bool abbreviateLabels, bool showData);
|
||||
void updateStatusBarText();
|
||||
void drawBranchLine(HDC hdc, std::map<u32, int> &addressPositions, const BranchLine &line);
|
||||
void copyInstructions(u32 startAddr, u32 endAddr, bool withDisasm);
|
||||
void CopyInstructions(u32 startAddr, u32 endAddr, CopyInstructionsMode mode);
|
||||
std::set<std::string> getSelectedLineArguments();
|
||||
void drawArguments(HDC hdc, const DisassemblyLineInfo &line, int x, int y, int textColor, const std::set<std::string> ¤tArguments);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user