Merge pull request #4486 from unknownbrackets/debugger

Use a shortcut for copying instructions, enable G3D log always
This commit is contained in:
Henrik Rydgård 2013-11-09 11:08:12 -08:00
commit 70a239ba47
7 changed files with 38 additions and 37 deletions

View File

@ -43,8 +43,6 @@ struct CoreParameter {
std::string errorString;
bool startPaused;
bool disableG3Dlog;
bool enableDebugging; // enables breakpoints and other time-consuming debugger features
bool printfEmuLog; // writes "emulator:" logging to stdout
std::string *collectEmuLog;
bool headLess; // Try to avoid messageboxes etc

View File

@ -178,10 +178,6 @@ void CPU_Init() {
Audio_Init();
}
if (coreParameter.disableG3Dlog) {
LogManager::GetInstance()->SetEnable(LogTypes::G3D, false);
}
CoreTiming::Init();
// Init all the HLE modules

View File

@ -75,7 +75,6 @@ void EmuScreen::bootGame(const std::string &filename) {
coreParam.fileToStart = fileToStart;
coreParam.mountIso = "";
coreParam.startPaused = false;
coreParam.enableDebugging = false;
coreParam.printfEmuLog = false;
coreParam.headLess = false;

View File

@ -810,11 +810,13 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
{
switch (tolower(wParam & 0xFFFF))
{
case 'f':
case 's':
search(false);
break;
case 'c':
search(true);
case VK_INSERT:
copyInstructions(selectRangeStart, selectRangeEnd, true);
break;
case 'x':
disassembleToFile();
@ -884,6 +886,9 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
case VK_SPACE:
debugger->toggleBreakpoint(curAddress);
break;
case VK_F3:
search(true);
break;
default:
keyTaken = false;
return;
@ -981,6 +986,35 @@ void CtrlDisAsmView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
redraw();
}
void CtrlDisAsmView::copyInstructions(u32 startAddr, u32 endAddr, bool withDisasm)
{
int count = (endAddr - startAddr) / instructionSize;
char opcode[64], arguments[256];
int space = count * (withDisasm ? 256 : 32);
char *temp = new char[space];
char *p = temp, *end = temp + space;
for (u32 pos = startAddr; pos < endAddr; pos += instructionSize)
{
if (withDisasm)
{
const char *dizz = debugger->disasm(pos, instructionSize);
parseDisasm(dizz, opcode, arguments);
p += snprintf(p, end - p, "%s\t%s", opcode, arguments);
}
else
p += snprintf(p, end - p, "%08X", debugger->readMemory(pos));
// Don't leave a trailing newline.
if (pos + instructionSize < endAddr)
p += snprintf(p, end - p, "\r\n");
}
W32Util::CopyTextToClipboard(wnd, temp);
delete [] temp;
}
void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
{
if (button == 1)
@ -1010,22 +1044,7 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
assembleOpcode(curAddress,"");
break;
case ID_DISASM_COPYINSTRUCTIONDISASM:
{
int space = 256 * (selectRangeEnd - selectRangeStart) / instructionSize;
char opcode[64], arguments[256];
char *temp = new char[space];
char *p = temp, *end = temp + space;
for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize)
{
const char *dizz = debugger->disasm(pos, instructionSize);
parseDisasm(dizz, opcode, arguments);
p += snprintf(p, end - p, "%s\t%s\r\n", opcode, arguments);
}
W32Util::CopyTextToClipboard(wnd, temp);
delete [] temp;
}
copyInstructions(selectRangeStart, selectRangeEnd, true);
break;
case ID_DISASM_COPYADDRESS:
{
@ -1042,17 +1061,7 @@ void CtrlDisAsmView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
followBranch();
break;
case ID_DISASM_COPYINSTRUCTIONHEX:
{
int space = 24 * (selectRangeEnd - selectRangeStart) / instructionSize;
char *temp = new char[space];
char *p = temp, *end = temp + space;
for (u32 pos = selectRangeStart; pos < selectRangeEnd; pos += instructionSize)
p += snprintf(p, end - p, "%08X\r\n", debugger->readMemory(pos));
W32Util::CopyTextToClipboard(wnd, temp);
delete [] temp;
}
copyInstructions(selectRangeStart, selectRangeEnd, false);
break;
case ID_DISASM_RUNTOHERE:
{

View File

@ -98,6 +98,7 @@ class CtrlDisAsmView
void parseDisasm(const char* disasm, char* opcode, char* arguments);
void updateStatusBarText();
void drawBranchLine(HDC hdc, BranchLine& line);
void copyInstructions(u32 startAddr, u32 endAddr, bool withDisasm);
public:
CtrlDisAsmView(HWND _wnd);
~CtrlDisAsmView();

View File

@ -69,7 +69,6 @@ void RunTests()
coreParam.enableSound = g_Config.bEnableSound;
coreParam.mountIso = "";
coreParam.startPaused = false;
coreParam.enableDebugging = false;
coreParam.printfEmuLog = false;
coreParam.headLess = true;
coreParam.renderWidth = 480;

View File

@ -301,7 +301,6 @@ int main(int argc, const char* argv[])
coreParameter.enableSound = false;
coreParameter.mountIso = mountIso ? mountIso : "";
coreParameter.startPaused = false;
coreParameter.enableDebugging = false;
coreParameter.printfEmuLog = !autoCompare;
coreParameter.headLess = true;
coreParameter.renderWidth = 480;