Merge branch 'gdbstub' into wii-network

Conflicts:
	Source/Core/Core/Src/ConfigManager.cpp
This commit is contained in:
Matthew Parlane
2013-01-08 21:21:05 +13:00
12 changed files with 1066 additions and 10 deletions
+6
View File
@@ -222,6 +222,12 @@ if(FASTLOG)
add_definitions(-DDEBUGFAST)
endif()
option(GDBSTUB "Enable gdb stub for remote debugging." OFF)
if(GDBSTUB)
add_definitions(-DUSE_GDBSTUB)
endif(GDBSTUB)
# For now GLES and EGL are tied to each other.
# Enabling GLES also disables the OpenGL plugin.
option(USE_GLES "Enables GLES, disables OGL" OFF)
+1
View File
@@ -44,6 +44,7 @@ enum LOG_TYPE {
DVDINTERFACE,
DYNA_REC,
EXPANSIONINTERFACE,
GDB_STUB,
POWERPC,
GPFIFO,
OSHLE,
+1
View File
@@ -57,6 +57,7 @@ LogManager::LogManager()
m_Log[LogTypes::DVDINTERFACE] = new LogContainer("DVD", "DVDInterface");
m_Log[LogTypes::GPFIFO] = new LogContainer("GP", "GPFifo");
m_Log[LogTypes::EXPANSIONINTERFACE] = new LogContainer("EXI", "ExpansionInt");
m_Log[LogTypes::GDB_STUB] = new LogContainer("GDB_STUB", "GDB Stub");
m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
m_Log[LogTypes::POWERPC] = new LogContainer("PowerPC", "IBM CPU");
m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE");
+4
View File
@@ -224,5 +224,9 @@ if(OPROFILE_FOUND)
set(LIBS ${LIBS} opagent bfd)
endif(OPROFILE_FOUND)
if(GDBSTUB)
set(SRCS ${SRCS} Src/PowerPC/GDBStub.cpp)
endif(GDBSTUB)
add_library(core STATIC ${SRCS})
target_link_libraries(core ${LIBS})
+7 -1
View File
@@ -158,7 +158,10 @@ void SConfig::SaveSettings()
ini.Set("General", "NANDRoot", m_NANDPath);
ini.Set("General", "WirelessMac", m_WirelessMac);
ini.Set("General", "HollywoodID", m_HollywoodID);
#ifdef USE_GDBSTUB
ini.Set("General", "GDBPort", m_LocalCoreStartupParameter.iGDBPort);
#endif
// Interface
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
@@ -271,6 +274,9 @@ void SConfig::LoadSettings()
{
ini.Get("General", "LastFilename", &m_LastFilename);
ini.Get("General", "ShowLag", &m_ShowLag, false);
#ifdef USE_GDBSTUB
ini.Get("General", "GDBPort", &(m_LocalCoreStartupParameter.iGDBPort), -1);
#endif
m_ISOFolder.clear();
int numGCMPaths;
+22 -3
View File
@@ -55,6 +55,9 @@
#include "PowerPC/PowerPC.h"
#include "PowerPC/JitCommon/JitBase.h"
#ifdef USE_GDBSTUB
#include "PowerPC/GDBStub.h"
#endif
#include "DSPEmulator.h"
#include "ConfigManager.h"
@@ -322,6 +325,16 @@ void CpuThread()
g_bStarted = true;
#ifdef USE_GDBSTUB
if(_CoreParameter.iGDBPort > 0)
{
gdb_init(_CoreParameter.iGDBPort);
// break at next instruction (the first instruction)
gdb_break();
}
#endif
// Enter CPU run loop. When we leave it - we are done.
CCPU::Run();
@@ -447,7 +460,7 @@ void EmuThread()
cpuThreadFunc = FifoPlayerThread;
else
cpuThreadFunc = CpuThread;
// ENTER THE VIDEO THREAD LOOP
if (_CoreParameter.bCPUThread)
{
@@ -487,11 +500,17 @@ void EmuThread()
// Wait for g_cpu_thread to exit
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping CPU-GPU thread ...").c_str());
#ifdef USE_GDBSTUB
INFO_LOG(CONSOLE, "%s", StopMessage(true, "Stopping GDB ...").c_str());
gdb_deinit();
INFO_LOG(CONSOLE, "%s", StopMessage(true, "GDB stopped.").c_str());
#endif
g_cpu_thread.join();
INFO_LOG(CONSOLE, "%s", StopMessage(true, "CPU thread stopped.").c_str());
VolumeHandler::EjectVolume();
FileMon::Close();
+3
View File
@@ -68,6 +68,9 @@ SCoreStartupParameter::SCoreStartupParameter()
void SCoreStartupParameter::LoadDefaults()
{
bEnableDebugging = false;
#ifdef USE_GDBSTUB
iGDBPort = -1;
#endif
iCPUCore = 1;
bCPUThread = false;
bSkipIdle = false;
+3
View File
@@ -71,6 +71,9 @@ struct SCoreStartupParameter
// Settings
bool bEnableDebugging;
#ifdef USE_GDBSTUB
int iGDBPort;
#endif
bool bAutomaticStart;
bool bBootToPause;
+4 -4
View File
@@ -31,7 +31,7 @@
namespace
{
static Common::Event m_StepEvent;
static Common::Event *m_SyncEvent;
static Common::Event *m_SyncEvent = NULL;
static std::mutex m_csCpuOccupied;
}
@@ -42,13 +42,13 @@ void CCPU::Init(int cpu_core)
cpu_core = Movie::GetCPUMode();
}
PowerPC::Init(cpu_core);
m_SyncEvent = 0;
m_SyncEvent = NULL;
}
void CCPU::Shutdown()
{
PowerPC::Shutdown();
m_SyncEvent = 0;
m_SyncEvent = NULL;
}
void CCPU::Run()
@@ -84,7 +84,7 @@ reswitch:
//4: update disasm dialog
if (m_SyncEvent) {
m_SyncEvent->Set();
m_SyncEvent = 0;
m_SyncEvent = NULL;
}
Host_UpdateDisasmDialog();
break;
File diff suppressed because it is too large Load Diff
+59
View File
@@ -0,0 +1,59 @@
// Copyright (C) 2010 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
// Originally written by Sven Peter <sven@fail0verflow.com> for anergistic.
#ifndef GDB_H__
#define GDB_H__
#include <signal.h>
#include "Common.h"
#include "Thread.h"
#include "PowerPC.h"
#include "../HW/CPU.h"
#include "../HW/Memmap.h"
#ifdef _WIN32
#define SIGTRAP 5
#define SIGTERM 15
#define MSG_WAITALL 8
#endif
typedef enum {
GDB_BP_TYPE_NONE = 0,
GDB_BP_TYPE_X,
GDB_BP_TYPE_R,
GDB_BP_TYPE_W,
GDB_BP_TYPE_A
} gdb_bp_type;
void gdb_init(u32 port);
void gdb_deinit();
bool gdb_active();
void gdb_break();
void gdb_handle_exception();
int gdb_signal(u32 signal);
int gdb_bp_x(u32 addr);
int gdb_bp_r(u32 addr);
int gdb_bp_w(u32 addr);
int gdb_bp_a(u32 addr);
bool gdb_add_bp(u32 type, u32 addr, u32 len);
#endif
@@ -27,6 +27,10 @@
#include "../../IPC_HLE/WII_IPC_HLE.h"
#include "Atomic.h"
#ifdef USE_GDBSTUB
#include "../GDBStub.h"
#endif
namespace {
u32 last_pc;
@@ -99,7 +103,17 @@ void Trace( UGeckoInstruction &instCode )
int Interpreter::SingleStepInner(void)
{
static UGeckoInstruction instCode;
#ifdef USE_GDBSTUB
if (gdb_active() && gdb_bp_x(PC)) {
Host_UpdateDisasmDialog();
gdb_signal(SIGTRAP);
gdb_handle_exception();
}
#endif
NPC = PC + sizeof(UGeckoInstruction);
instCode.hex = Memory::Read_Opcode(PC);
@@ -218,7 +232,8 @@ void Interpreter::Run()
if (PCVec.size() > ShowSteps)
PCVec.erase(PCVec.begin());
#endif
//2: check for breakpoint
if (PowerPC::breakpoints.IsAddressBreakPoint(PC))
{