GDBStub: remove the cmake option and the ifdefs

This commit is contained in:
aldelaro5 2021-10-01 09:56:26 -04:00
parent 657bb00c01
commit 94a0f416eb
10 changed files with 13 additions and 60 deletions

View File

@ -59,7 +59,6 @@ option(ENCODE_FRAMEDUMPS "Encode framedumps in AVI format" ON)
option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF) option(ENABLE_GPROF "Enable gprof profiling (must be using Debug build)" OFF)
option(FASTLOG "Enable all logs" OFF) option(FASTLOG "Enable all logs" OFF)
option(GDBSTUB "Enable gdb stub for remote debugging." ON)
option(OPROFILING "Enable profiling" OFF) option(OPROFILING "Enable profiling" OFF)
# TODO: Add DSPSpy # TODO: Add DSPSpy
@ -389,10 +388,6 @@ if(FASTLOG)
add_definitions(-DDEBUGFAST) add_definitions(-DDEBUGFAST)
endif() endif()
if(GDBSTUB)
add_definitions(-DUSE_GDBSTUB)
endif()
if(ENABLE_VTUNE) if(ENABLE_VTUNE)
set(VTUNE_DIR "/opt/intel/vtune_amplifier") set(VTUNE_DIR "/opt/intel/vtune_amplifier")
add_definitions(-DUSE_VTUNE) add_definitions(-DUSE_VTUNE)

View File

@ -452,6 +452,8 @@ add_library(core
PowerPC/JitCommon/JitCache.h PowerPC/JitCommon/JitCache.h
PowerPC/JitInterface.cpp PowerPC/JitInterface.cpp
PowerPC/JitInterface.h PowerPC/JitInterface.h
PowerPC/GDBStub.cpp
PowerPC/GDBStub.h
PowerPC/MMU.cpp PowerPC/MMU.cpp
PowerPC/MMU.h PowerPC/MMU.h
PowerPC/PowerPC.cpp PowerPC/PowerPC.cpp
@ -698,13 +700,6 @@ if(TARGET Hidapi::Hidapi)
target_compile_definitions(core PRIVATE -DHAVE_HIDAPI=1) target_compile_definitions(core PRIVATE -DHAVE_HIDAPI=1)
endif() endif()
if(GDBSTUB)
target_sources(core PRIVATE
PowerPC/GDBStub.cpp
PowerPC/GDBStub.h
)
endif()
if(UNIX) if(UNIX)
target_sources(core PRIVATE target_sources(core PRIVATE
MemoryWatcher.cpp MemoryWatcher.cpp

View File

@ -132,12 +132,10 @@ void SConfig::SaveGeneralSettings(IniFile& ini)
general->Set("WirelessMac", m_WirelessMac); general->Set("WirelessMac", m_WirelessMac);
#ifdef USE_GDBSTUB
#ifndef _WIN32 #ifndef _WIN32
general->Set("GDBSocket", gdb_socket); general->Set("GDBSocket", gdb_socket);
#endif #endif
general->Set("GDBPort", iGDBPort); general->Set("GDBPort", iGDBPort);
#endif
} }
void SConfig::SaveInterfaceSettings(IniFile& ini) void SConfig::SaveInterfaceSettings(IniFile& ini)
@ -371,12 +369,10 @@ void SConfig::LoadGeneralSettings(IniFile& ini)
general->Get("ShowLag", &m_ShowLag, false); general->Get("ShowLag", &m_ShowLag, false);
general->Get("ShowFrameCount", &m_ShowFrameCount, false); general->Get("ShowFrameCount", &m_ShowFrameCount, false);
#ifdef USE_GDBSTUB
#ifndef _WIN32 #ifndef _WIN32
general->Get("GDBSocket", &gdb_socket, ""); general->Get("GDBSocket", &gdb_socket, "");
#endif #endif
general->Get("GDBPort", &(iGDBPort), -1); general->Get("GDBPort", &(iGDBPort), -1);
#endif
m_ISOFolder.clear(); m_ISOFolder.clear();
int numISOPaths; int numISOPaths;
@ -733,11 +729,9 @@ void SConfig::LoadDefaults()
bAutomaticStart = false; bAutomaticStart = false;
bBootToPause = false; bBootToPause = false;
#ifdef USE_GDBSTUB
iGDBPort = -1; iGDBPort = -1;
#ifndef _WIN32 #ifndef _WIN32
gdb_socket = ""; gdb_socket = "";
#endif
#endif #endif
cpu_core = PowerPC::DefaultCPUCore(); cpu_core = PowerPC::DefaultCPUCore();

View File

@ -79,11 +79,9 @@ struct SConfig
// Settings // Settings
bool bEnableDebugging = false; bool bEnableDebugging = false;
#ifdef USE_GDBSTUB
int iGDBPort; int iGDBPort;
#ifndef _WIN32 #ifndef _WIN32
std::string gdb_socket; std::string gdb_socket;
#endif
#endif #endif
bool bAutomaticStart = false; bool bAutomaticStart = false;
bool bBootToPause = false; bool bBootToPause = false;

View File

@ -62,15 +62,12 @@
#include "Core/NetPlayClient.h" #include "Core/NetPlayClient.h"
#include "Core/NetPlayProto.h" #include "Core/NetPlayProto.h"
#include "Core/PatchEngine.h" #include "Core/PatchEngine.h"
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "Core/State.h" #include "Core/State.h"
#include "Core/WiiRoot.h" #include "Core/WiiRoot.h"
#ifdef USE_GDBSTUB
#include "Core/PowerPC/GDBStub.h"
#endif
#ifdef USE_MEMORYWATCHER #ifdef USE_MEMORYWATCHER
#include "Core/MemoryWatcher.h" #include "Core/MemoryWatcher.h"
#endif #endif
@ -380,7 +377,6 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
{ {
CPUSetInitialExecutionState(); CPUSetInitialExecutionState();
} }
#endif
// Enter CPU run loop. When we leave it - we are done. // Enter CPU run loop. When we leave it - we are done.
CPU::Run(); CPU::Run();
@ -394,14 +390,12 @@ static void CpuThread(const std::optional<std::string>& savestate_path, bool del
if (_CoreParameter.bFastmem) if (_CoreParameter.bFastmem)
EMM::UninstallExceptionHandler(); EMM::UninstallExceptionHandler();
#ifdef USE_GDBSTUB
if (gdb_active()) if (gdb_active())
{ {
gdb_deinit(); gdb_deinit();
INFO_LOG_FMT(GDB_STUB, "Killed by CPU shutdown"); INFO_LOG_FMT(GDB_STUB, "Killed by CPU shutdown");
return; return;
} }
#endif
} }
static void FifoPlayerThread(const std::optional<std::string>& savestate_path, static void FifoPlayerThread(const std::optional<std::string>& savestate_path,
@ -662,11 +656,9 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
cpuThreadFunc(savestate_path, delete_savestate); cpuThreadFunc(savestate_path, delete_savestate);
} }
#ifdef USE_GDBSTUB
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "Stopping GDB ...")); INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "Stopping GDB ..."));
gdb_deinit(); gdb_deinit();
INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "GDB stopped.")); INFO_LOG_FMT(CONSOLE, "{}", StopMessage(true, "GDB stopped."));
#endif
} }
// Set or get the running state // Set or get the running state

View File

@ -12,13 +12,10 @@
#include "Common/Event.h" #include "Common/Event.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "VideoCommon/Fifo.h" #include "VideoCommon/Fifo.h"
#ifdef USE_GDBSTUB
#include "Core/PowerPC/GDBStub.h"
#endif
namespace CPU namespace CPU
{ {
// CPU Thread execution state. // CPU Thread execution state.
@ -135,7 +132,6 @@ void Run()
// Wait for step command. // Wait for step command.
s_state_cpu_cvar.wait(state_lock, [&state_lock] { s_state_cpu_cvar.wait(state_lock, [&state_lock] {
ExecutePendingJobs(state_lock); ExecutePendingJobs(state_lock);
#ifdef USE_GDBSTUB
state_lock.unlock(); state_lock.unlock();
if (gdb_active() && gdb_hasControl()) if (gdb_active() && gdb_hasControl())
{ {
@ -146,7 +142,6 @@ void Run()
s_state_cpu_step_instruction = true; s_state_cpu_step_instruction = true;
} }
state_lock.lock(); state_lock.lock();
#endif
return s_state_cpu_step_instruction || !IsStepping(); return s_state_cpu_step_instruction || !IsStepping();
}); });
if (!IsStepping()) if (!IsStepping())

View File

@ -8,10 +8,6 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#ifndef MSG_WAITALL
#define MSG_WAITALL (8)
#endif
typedef enum typedef enum
{ {
GDB_SIGTRAP = 5, GDB_SIGTRAP = 5,

View File

@ -20,15 +20,12 @@
#include "Core/HLE/HLE.h" #include "Core/HLE/HLE.h"
#include "Core/HW/CPU.h" #include "Core/HW/CPU.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/Interpreter/ExceptionUtils.h" #include "Core/PowerPC/Interpreter/ExceptionUtils.h"
#include "Core/PowerPC/MMU.h" #include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PPCTables.h" #include "Core/PowerPC/PPCTables.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#ifdef USE_GDBSTUB
#include "Core/PowerPC/GDBStub.h"
#endif
namespace namespace
{ {
u32 last_pc; u32 last_pc;
@ -296,9 +293,8 @@ void Interpreter::Run()
#endif #endif
INFO_LOG_FMT(POWERPC, "Hit Breakpoint - {:08x}", PC); INFO_LOG_FMT(POWERPC, "Hit Breakpoint - {:08x}", PC);
CPU::Break(); CPU::Break();
#ifdef USE_GDBSTUB if (gdb_active())
gdb_takeControl(); gdb_takeControl();
#endif
if (PowerPC::breakpoints.IsTempBreakPoint(PC)) if (PowerPC::breakpoints.IsTempBreakPoint(PC))
PowerPC::breakpoints.Remove(PC); PowerPC::breakpoints.Remove(PC);

View File

@ -19,15 +19,12 @@
#include "Core/HW/MMIO.h" #include "Core/HW/MMIO.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/HW/ProcessorInterface.h" #include "Core/HW/ProcessorInterface.h"
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
#ifdef USE_GDBSTUB
#include "Core/PowerPC/GDBStub.h"
#endif
namespace PowerPC namespace PowerPC
{ {
// EFB RE // EFB RE
@ -522,9 +519,8 @@ static void Memcheck(u32 address, u64 var, bool write, size_t size)
CPU::Break(); CPU::Break();
#ifdef USE_GDBSTUB if (gdb_active())
gdb_takeControl(); gdb_takeControl();
#endif
// Fake a DSI so that all the code that tests for it in order to skip // Fake a DSI so that all the code that tests for it in order to skip
// the rest of the instruction will apply. (This means that // the rest of the instruction will apply. (This means that

View File

@ -25,15 +25,12 @@
#include "Core/HW/SystemTimers.h" #include "Core/HW/SystemTimers.h"
#include "Core/Host.h" #include "Core/Host.h"
#include "Core/PowerPC/CPUCoreBase.h" #include "Core/PowerPC/CPUCoreBase.h"
#include "Core/PowerPC/GDBStub.h"
#include "Core/PowerPC/Interpreter/Interpreter.h" #include "Core/PowerPC/Interpreter/Interpreter.h"
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/MMU.h" #include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PPCSymbolDB.h" #include "Core/PowerPC/PPCSymbolDB.h"
#ifdef USE_GDBSTUB
#include "Core/PowerPC/GDBStub.h"
#endif
namespace PowerPC namespace PowerPC
{ {
// STATE_TO_SAVE // STATE_TO_SAVE
@ -617,9 +614,8 @@ void CheckBreakPoints()
if (PowerPC::breakpoints.IsBreakPointBreakOnHit(PC)) if (PowerPC::breakpoints.IsBreakPointBreakOnHit(PC))
{ {
CPU::Break(); CPU::Break();
#ifdef USE_GDBSTUB if (gdb_active())
gdb_takeControl(); gdb_takeControl();
#endif
} }
if (PowerPC::breakpoints.IsBreakPointLogOnHit(PC)) if (PowerPC::breakpoints.IsBreakPointLogOnHit(PC))
{ {