Пример #1
0
void CDebugger::ActivateView(unsigned int nView)
{
	if(m_nCurrentView == nView) return;

	if(m_nCurrentView != -1)
	{
		SaveBytesPerLine();
		SaveViewLayout();
		GetCurrentView()->Hide();
	}

	m_findCallersRequestConnection.disconnect();

	m_nCurrentView = nView;
	LoadViewLayout();
	LoadBytesPerLine();
	UpdateTitle();

	{
		auto biosDebugInfoProvider = GetCurrentView()->GetBiosDebugInfoProvider();
		m_pFunctionsView->SetContext(GetCurrentView()->GetContext(), biosDebugInfoProvider);
		m_threadsView->SetContext(GetCurrentView()->GetContext(), biosDebugInfoProvider);
	}

	if(GetDisassemblyWindow()->IsVisible())
	{
		GetDisassemblyWindow()->SetFocus();
	}

	m_findCallersRequestConnection = GetCurrentView()->GetDisassemblyWindow()->GetDisAsm()->FindCallersRequested.connect(
		[&] (uint32 address) { OnFindCallersRequested(address); });
}
Пример #2
0
void CDebugger::StepCPU()
{
	if(m_virtualMachine.GetStatus() == CVirtualMachine::RUNNING)
	{
		MessageBeep(-1);
		return;
	}
	
	if(::GetParent(GetFocus()) != GetDisassemblyWindow()->m_hWnd)
	{
		GetDisassemblyWindow()->SetFocus();
	}

	GetCurrentView()->Step();
}
Пример #3
0
void CDebugger::LoadViewLayout()
{
	UnserializeWindowGeometry(GetDisassemblyWindow(), \
		"debugger.disasm.posx", \
		"debugger.disasm.posy", \
		"debugger.disasm.sizex", \
		"debugger.disasm.sizey", \
		"debugger.disasm.visible");

	UnserializeWindowGeometry(GetRegisterViewWindow(), \
		"debugger.regview.posx", \
		"debugger.regview.posy", \
		"debugger.regview.sizex", \
		"debugger.regview.sizey", \
		"debugger.regview.visible");

	UnserializeWindowGeometry(GetMemoryViewWindow(), \
		"debugger.memoryview.posx", \
		"debugger.memoryview.posy", \
		"debugger.memoryview.sizex", \
		"debugger.memoryview.sizey", \
		"debugger.memoryview.visible");

	UnserializeWindowGeometry(GetCallStackWindow(), \
		"debugger.callstack.posx", \
		"debugger.callstack.posy", \
		"debugger.callstack.sizex", \
		"debugger.callstack.sizey", \
		"debugger.callstack.visible");
}
Пример #4
0
void CDebugger::OnExecutableChangeMsg()
{
	m_pELFView->SetELF(m_virtualMachine.m_ee->m_os->GetELF());
//	m_pFunctionsView->SetELF(m_virtualMachine.m_os->GetELF());

	LoadDebugTags();

	GetDisassemblyWindow()->Refresh();
	m_pFunctionsView->Refresh();
}
Пример #5
0
void CDebugger::Layout1600()
{
	auto disassemblyWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(0, 0, 1094, 725));
	auto registerViewWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(1094, 0, 506, 725));
	auto memoryViewWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(0, 725, 1094, 407));
	auto callStackWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(1094, 725, 506, 407));

	GetDisassemblyWindow()->SetSizePosition(disassemblyWindowRect);
	GetDisassemblyWindow()->Show(SW_SHOW);

	GetRegisterViewWindow()->SetSizePosition(registerViewWindowRect);
	GetRegisterViewWindow()->Show(SW_SHOW);

	GetMemoryViewWindow()->SetSizePosition(memoryViewWindowRect);
	GetMemoryViewWindow()->Show(SW_SHOW);

	GetCallStackWindow()->SetSizePosition(callStackWindowRect);
	GetCallStackWindow()->Show(SW_SHOW);
}
Пример #6
0
void CDebugger::Layout1280()
{
	auto disassemblyWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(0, 0, 900, 540));
	auto registerViewWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(900, 0, 380, 784));
	auto memoryViewWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(0, 540, 900, 416));
	auto callStackWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(900, 784, 380, 172));

	GetDisassemblyWindow()->SetSizePosition(disassemblyWindowRect);
	GetDisassemblyWindow()->Show(SW_SHOW);

	GetRegisterViewWindow()->SetSizePosition(registerViewWindowRect);
	GetRegisterViewWindow()->Show(SW_SHOW);

	GetMemoryViewWindow()->SetSizePosition(memoryViewWindowRect);
	GetMemoryViewWindow()->Show(SW_SHOW);

	GetCallStackWindow()->SetSizePosition(callStackWindowRect);
	GetCallStackWindow()->Show(SW_SHOW);
}
Пример #7
0
void CDebugger::Layout1024()
{
	auto disassemblyWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(0, 0, 700, 435));
	auto registerViewWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(700, 0, 324, 572));
	auto memoryViewWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(0, 435, 700, 265));
	auto callStackWindowRect = Framework::Win32::PointsToPixels(Framework::Win32::MakeRectPositionSize(700, 572, 324, 128));

	GetDisassemblyWindow()->SetSizePosition(disassemblyWindowRect);
	GetDisassemblyWindow()->Show(SW_SHOW);

	GetRegisterViewWindow()->SetSizePosition(registerViewWindowRect);
	GetRegisterViewWindow()->Show(SW_SHOW);

	GetMemoryViewWindow()->SetSizePosition(memoryViewWindowRect);
	GetMemoryViewWindow()->Show(SW_SHOW);

	GetCallStackWindow()->SetSizePosition(callStackWindowRect);
	GetCallStackWindow()->Show(SW_SHOW);
}
Пример #8
0
void CDebugger::ActivateView(unsigned int nView)
{
	if(m_nCurrentView == nView) return;

	if(m_nCurrentView != -1)
	{
		SaveViewLayout();
		GetCurrentView()->Hide();
	}

	m_nCurrentView = nView;
	LoadViewLayout();
	UpdateTitle();
	{
		auto biosDebugInfoProvider = GetCurrentView()->GetBiosDebugInfoProvider();
		m_pFunctionsView->SetContext(GetCurrentView()->GetContext(), biosDebugInfoProvider);
		m_threadsView->SetContext(GetCurrentView()->GetContext(), biosDebugInfoProvider);
	}

	if(GetDisassemblyWindow()->IsVisible())
	{
		GetDisassemblyWindow()->SetFocus();
	}
}
Пример #9
0
void CDebugger::OnFindCallersAddressDblClick(uint32 address)
{
	auto disAsm = GetDisassemblyWindow()->GetDisAsm();
	disAsm->SetCenterAtAddress(address);
	disAsm->SetSelectedAddress(address);
}
Пример #10
0
void CDebugger::OnFunctionsViewFunctionsStateChange()
{
	GetDisassemblyWindow()->Refresh();
}
Пример #11
0
void CDebugger::OnFunctionsViewFunctionDblClick(uint32 address)
{
	GetDisassemblyWindow()->GetDisAsm()->SetAddress(address);
}
Пример #12
0
long CDebugger::OnCommand(unsigned short nID, unsigned short nMsg, HWND hFrom)
{
	switch(nID)
	{
	case ID_VM_STEP:
		StepCPU();
		break;
	case ID_VM_RESUME:
		Resume();
		break;
	case ID_VM_DUMPINTCHANDLERS:
		m_virtualMachine.DumpEEIntcHandlers();
		break;
	case ID_VM_DUMPDMACHANDLERS:
		m_virtualMachine.DumpEEDmacHandlers();
		break;
	case ID_VM_ASMJAL:
		AssembleJAL();
		break;
	case ID_VM_REANALYZE_EE:
		ReanalyzeEe();
		break;
	case ID_VM_FINDEEFUNCTIONS:
		FindEeFunctions();
		break;
	case ID_VM_FINDVALUE:
		FindValue();
		break;
	case ID_VIEW_MEMORY:
		GetMemoryViewWindow()->Show(SW_SHOW);
		GetMemoryViewWindow()->SetFocus();
		return FALSE;
		break;
	case ID_VIEW_CALLSTACK:
		GetCallStackWindow()->Show(SW_SHOW);
		GetCallStackWindow()->SetFocus();
		return FALSE;
		break;
	case ID_VIEW_FUNCTIONS:
		m_pFunctionsView->Show(SW_SHOW);
		m_pFunctionsView->SetFocus();
		return FALSE;
		break;
	case ID_VIEW_ELF:
		m_pELFView->Show(SW_SHOW);
		m_pELFView->SetFocus();
		return FALSE;
		break;
	case ID_VIEW_THREADS:
		m_threadsView->Show(SW_SHOW);
		m_threadsView->SetFocus();
		return FALSE;
		break;
	case ID_VIEW_DISASSEMBLY:
		GetDisassemblyWindow()->Show(SW_SHOW);
		GetDisassemblyWindow()->SetFocus();
		return FALSE;
		break;
	case ID_VIEW_EEVIEW:
		ActivateView(DEBUGVIEW_EE);
		break;
	case ID_VIEW_VU0VIEW:
		ActivateView(DEBUGVIEW_VU0);
		break;
	case ID_VIEW_VU1VIEW:
		ActivateView(DEBUGVIEW_VU1);
		break;
	case ID_VIEW_IOPVIEW:
		ActivateView(DEBUGVIEW_IOP);
		break;
	case ID_WINDOW_CASCAD:
		m_pMDIClient->Cascade();
		return FALSE;
		break;
	case ID_WINDOW_TILEHORIZONTAL:
		m_pMDIClient->TileHorizontal();
		return FALSE;
		break;
	case ID_WINDOW_TILEVERTICAL:
		m_pMDIClient->TileVertical();
		return FALSE;
		break;
	case ID_WINDOW_LAYOUT1024:
		Layout1024();
		return FALSE;
		break;
	case ID_WINDOW_LAYOUT1280:
		Layout1280();
		return FALSE;
		break;
	case ID_WINDOW_LAYOUT1600:
		Layout1600();
		return FALSE;
		break;
	}
	return TRUE;
}
Пример #13
0
CDebugger::CDebugger(CPS2VM& virtualMachine)
: m_virtualMachine(virtualMachine)
{
	RegisterPreferences();

	if(!DoesWindowClassExist(CLSNAME))
	{
		WNDCLASSEX wc;
		memset(&wc, 0, sizeof(WNDCLASSEX));
		wc.cbSize			= sizeof(WNDCLASSEX);
		wc.hCursor			= LoadCursor(NULL, IDC_ARROW);
		wc.hbrBackground	= (HBRUSH)GetStockObject(GRAY_BRUSH); 
		wc.hInstance		= GetModuleHandle(NULL);
		wc.lpszClassName	= CLSNAME;
		wc.lpfnWndProc		= CWindow::WndProc;
		RegisterClassEx(&wc);
	}
	
	Create(NULL, CLSNAME, _T(""), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, Framework::Win32::CRect(0, 0, 640, 480), NULL, NULL);
	SetClassPtr();

	SetMenu(LoadMenu(GetModuleHandle(NULL), MAKEINTRESOURCE(IDR_DEBUGGER)));

	CreateClient(NULL);

	//Show(SW_MAXIMIZE);

	//ELF View Initialization
	m_pELFView = new CELFView(m_pMDIClient->m_hWnd);
	m_pELFView->Show(SW_HIDE);

	//Functions View Initialization
	m_pFunctionsView = new CFunctionsView(m_pMDIClient->m_hWnd);
	m_pFunctionsView->Show(SW_HIDE);
	m_pFunctionsView->OnFunctionDblClick.connect(boost::bind(&CDebugger::OnFunctionsViewFunctionDblClick, this, _1));
	m_pFunctionsView->OnFunctionsStateChange.connect(boost::bind(&CDebugger::OnFunctionsViewFunctionsStateChange, this));

	//Threads View Initialization
	m_threadsView = new CThreadsViewWnd(m_pMDIClient->m_hWnd, m_virtualMachine);
	m_threadsView->Show(SW_HIDE);
	m_threadsView->OnGotoAddress.connect(boost::bind(&CDebugger::OnThreadsViewAddressDblClick, this, _1));

	//Find Callers View Initialization
	m_findCallersView = new CFindCallersViewWnd(m_pMDIClient->m_hWnd);
	m_findCallersView->Show(SW_HIDE);
	m_findCallersView->AddressSelected.connect([&] (uint32 address) { OnFindCallersAddressDblClick(address); });

	//Debug Views Initialization
	m_nCurrentView = -1;

	memset(m_pView, 0, sizeof(m_pView));
	m_pView[DEBUGVIEW_EE]	= new CDebugView(m_pMDIClient->m_hWnd, m_virtualMachine, &m_virtualMachine.m_ee->m_EE, 
		std::bind(&CPS2VM::StepEe, &m_virtualMachine), m_virtualMachine.m_ee->m_os, "EmotionEngine");
	m_pView[DEBUGVIEW_VU0]	= new CDebugView(m_pMDIClient->m_hWnd, m_virtualMachine, &m_virtualMachine.m_ee->m_VU0, 
		std::bind(&CPS2VM::StepVu0, &m_virtualMachine), nullptr, "Vector Unit 0", CDisAsmWnd::DISASM_VU);
	m_pView[DEBUGVIEW_VU1]	= new CDebugView(m_pMDIClient->m_hWnd, m_virtualMachine, &m_virtualMachine.m_ee->m_VU1, 
		std::bind(&CPS2VM::StepVu1, &m_virtualMachine), nullptr, "Vector Unit 1", CDisAsmWnd::DISASM_VU);
	m_pView[DEBUGVIEW_IOP]  = new CDebugView(m_pMDIClient->m_hWnd, m_virtualMachine, &m_virtualMachine.m_iop->m_cpu, 
		std::bind(&CPS2VM::StepIop, &m_virtualMachine), m_virtualMachine.m_iopOs.get(), "IO Processor");

	m_virtualMachine.m_ee->m_os->OnExecutableChange.connect(boost::bind(&CDebugger::OnExecutableChange, this));
	m_virtualMachine.m_ee->m_os->OnExecutableUnloading.connect(boost::bind(&CDebugger::OnExecutableUnloading, this));

	ActivateView(DEBUGVIEW_EE);
	LoadSettings();

	if(GetDisassemblyWindow()->IsVisible())
	{
		GetDisassemblyWindow()->SetFocus();
	}

	CreateAccelerators();
}
Пример #14
0
void CDebugger::OnThreadsViewAddressDblClick(uint32 nAddress)
{
	GetDisassemblyWindow()->SetCenterAtAddress(nAddress);
	GetDisassemblyWindow()->SetSelectedAddress(nAddress);
}