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