gdbstub: added new GDB stub debugger (#5456)

* gdbstub: added new GDB stub debugger

This debugger can be used to connect to an external debugger that
communicates using the GDB Remote Serial Protocol, such as GDB itself
or many other GDB frontends.

Currently i386 (ct486), arm7 (gba), and ppc (pmac6100) are supported.

* gdbstub: enable GDB stub debugger in mac and windows builds
This commit is contained in:
Ramiro Polla 2019-08-11 18:21:16 +02:00 committed by R. Belmont
parent 69c90113ae
commit fb5a3dcfaa
8 changed files with 1153 additions and 0 deletions

View File

@ -68,6 +68,7 @@ function osdmodulesbuild()
MAME_DIR .. "src/osd/modules/debugger/none.cpp",
MAME_DIR .. "src/osd/modules/debugger/debugwin.cpp",
MAME_DIR .. "src/osd/modules/debugger/debugimgui.cpp",
MAME_DIR .. "src/osd/modules/debugger/debuggdbstub.cpp",
MAME_DIR .. "src/osd/modules/font/font_sdl.cpp",
MAME_DIR .. "src/osd/modules/font/font_windows.cpp",
MAME_DIR .. "src/osd/modules/font/font_dwrite.cpp",

View File

@ -656,6 +656,8 @@ void arm7_cpu_device::device_start()
state_add( ARM7_R13, "R13", m_r[13]).formatstr("%08X");
state_add( ARM7_R14, "R14", m_r[14]).formatstr("%08X");
state_add( ARM7_R15, "R15", m_r[15]).formatstr("%08X");
/* Current Status Program Register */
state_add( ARM7_CPSR, "CPSR", m_r[eCPSR]).formatstr("%08X");
/* FIRQ Mode Shadowed Registers */
state_add( ARM7_FR8, "FR8", m_r[eR8_FIQ] ).formatstr("%08X");
state_add( ARM7_FR9, "FR9", m_r[eR9_FIQ] ).formatstr("%08X");

View File

@ -1299,6 +1299,8 @@ device_debug::device_debug(device_t &device)
, m_pc_history_index(0)
, m_bplist(nullptr)
, m_rplist(nullptr)
, m_triggered_breakpoint(nullptr)
, m_triggered_watchpoint(nullptr)
, m_trace(nullptr)
, m_hotspot_threshhold(0)
, m_track_pc_set()
@ -2551,7 +2553,10 @@ void device_debug::breakpoint_check(offs_t pc)
// print a notification, unless the action made us go again
if (debugcpu.is_stopped())
{
m_device.machine().debugger().console().printf("Stopped at breakpoint %X\n", bp->m_index);
m_triggered_breakpoint = bp;
}
break;
}
@ -3071,6 +3076,7 @@ void device_debug::watchpoint::triggered(read_or_write type, offs_t address, u64
pc);
debug.console().printf("%s\n", buffer);
m_debugInterface->compute_debug_flags();
m_debugInterface->set_triggered_watchpoint(this);
}
debug.cpu().set_within_instruction(false);

View File

@ -223,6 +223,7 @@ public:
void breakpoint_clear_all();
bool breakpoint_enable(int index, bool enable = true);
void breakpoint_enable_all(bool enable = true);
breakpoint *triggered_breakpoint(void) { breakpoint *ret = m_triggered_breakpoint; m_triggered_breakpoint = nullptr; return ret; }
// watchpoints
int watchpoint_space_count() const { return m_wplist.size(); }
@ -232,6 +233,8 @@ public:
void watchpoint_clear_all();
bool watchpoint_enable(int index, bool enable = true);
void watchpoint_enable_all(bool enable = true);
void set_triggered_watchpoint(watchpoint *wp) { m_triggered_watchpoint = wp; }
watchpoint *triggered_watchpoint(void) { watchpoint *ret = m_triggered_watchpoint; m_triggered_watchpoint = nullptr; return ret; }
// registerpoints
registerpoint *registerpoint_first() const { return m_rplist; }
@ -341,6 +344,9 @@ private:
std::vector<std::vector<std::unique_ptr<watchpoint>>> m_wplist; // watchpoint lists for each address space
registerpoint * m_rplist; // list of registerpoints
breakpoint * m_triggered_breakpoint; // latest breakpoint that was triggered
watchpoint * m_triggered_watchpoint; // latest watchpoint that was triggered
// tracing
class tracer
{

View File

@ -64,6 +64,7 @@ public:
int index() const { return m_index; }
void *dataptr() const { return entry_baseptr(); }
u64 datamask() const { return m_datamask; }
u8 datasize() const { return m_datasize; }
const char *symbol() const { return m_symbol.c_str(); }
bool visible() const { return ((m_flags & DSF_NOSHOW) == 0); }
bool writeable() const { return ((m_flags & DSF_READONLY) == 0); }

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,7 @@ const options_entry osd_options::s_option_entries[] =
{ nullptr, nullptr, OPTION_HEADER, "OSD DEBUGGING OPTIONS" },
{ OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used: " },
{ OSDOPTION_DEBUGGER_PORT, "23946", OPTION_INTEGER, "port to use for gdbstub debugger" },
{ OSDOPTION_DEBUGGER_FONT ";dfont", OSDOPTVAL_AUTO, OPTION_STRING, "font to use for debugger views" },
{ OSDOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "0", OPTION_FLOAT, "font size to use for debugger views" },
{ OSDOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" },
@ -235,6 +236,7 @@ void osd_common_t::register_options()
REGISTER_MODULE(m_mod_man, DEBUG_WINDOWS);
REGISTER_MODULE(m_mod_man, DEBUG_QT);
REGISTER_MODULE(m_mod_man, DEBUG_IMGUI);
REGISTER_MODULE(m_mod_man, DEBUG_GDBSTUB);
REGISTER_MODULE(m_mod_man, DEBUG_NONE);
#endif

View File

@ -37,6 +37,7 @@
#define OSDCOMMAND_LIST_NETWORK_ADAPTERS "listnetwork"
#define OSDOPTION_DEBUGGER "debugger"
#define OSDOPTION_DEBUGGER_PORT "debugger_port"
#define OSDOPTION_DEBUGGER_FONT "debugger_font"
#define OSDOPTION_DEBUGGER_FONT_SIZE "debugger_font_size"
#define OSDOPTION_WATCHDOG "watchdog"
@ -106,6 +107,7 @@ public:
// debugging options
const char *debugger() const { return value(OSDOPTION_DEBUGGER); }
int debugger_port() const { return int_value(OSDOPTION_DEBUGGER_PORT); }
const char *debugger_font() const { return value(OSDOPTION_DEBUGGER_FONT); }
float debugger_font_size() const { return float_value(OSDOPTION_DEBUGGER_FONT_SIZE); }
int watchdog() const { return int_value(OSDOPTION_WATCHDOG); }