Skip to content

Commit 77d4cc3

Browse files
committed
Cleaned up the mess from #12610:
* Command line options need to be documented. * Don't assume C strings returned as option values remain valid indefinitely. * Fixed wording for option description.
1 parent 5395cbc commit 77d4cc3

File tree

4 files changed

+27
-10
lines changed

4 files changed

+27
-10
lines changed

docs/source/commandline/commandline-all.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3677,8 +3677,9 @@ Debugging Options
36773677
Acts as a remote debugging server for the GNU debugger (GDB). Only a
36783678
small subset of the CPUs emulated by MAME are supported. Use the
36793679
:ref:`debugger_port <mame-commandline-debuggerport>` option to set the
3680-
listening port on the loopback interface. Supported on all platforms
3681-
with TCP socket support.
3680+
listening port and the
3681+
:ref:`debugger_host <mame-commandline-debuggerhost>` option to set the
3682+
address to bind to. Supported on all platforms with TCP socket support.
36823683
36833684
Example:
36843685
.. code-block:: bash
@@ -3732,11 +3733,26 @@ Debugging Options
37323733
37333734
mame ibm_5150 -watchdog 30
37343735
3736+
.. _mame-commandline-debuggerhost:
3737+
3738+
**-debugger_host** *<address>*
3739+
3740+
Set the IP address to listen on to accept GDB connections when using the
3741+
GDB stub debugger module (see the
3742+
:ref:`debugger <mame-commandline-debugger>` option).
3743+
3744+
The default is ``localhost``.
3745+
3746+
Example:
3747+
.. code-block:: bash
3748+
3749+
mame rfjet -debug -debugger gdbstub -debugger_host 0.0.0.0
3750+
37353751
.. _mame-commandline-debuggerport:
37363752
37373753
**-debugger_port** *<port>*
37383754
3739-
Set the TCP port number to listen on for GDB connections when using the GDB
3755+
Set the TCP port number to accept GDB connections on when using the GDB
37403756
stub debugger module (see the :ref:`debugger <mame-commandline-debugger>`
37413757
option).
37423758

docs/source/commandline/commandline-index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ Core Debugging Options
298298
| :ref:`debugscript <mame-commandline-debugscript>`
299299
| :ref:`[no]update_in_pause <mame-commandline-updateinpause>`
300300
| :ref:`watchdog <mame-commandline-watchdog>`
301+
| :ref:`debugger_host <mame-commandline-debuggerhost>`
301302
| :ref:`debugger_port <mame-commandline-debuggerport>`
302303
| :ref:`debugger_font <mame-commandline-debuggerfont>`
303304
| :ref:`debugger_font_size <mame-commandline-debuggerfontsize>`

src/osd/modules/debugger/debuggdbstub.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,8 @@ static const std::map<std::string, const gdb_register_map &> gdb_register_maps =
496496
class debug_gdbstub : public osd_module, public debug_module
497497
{
498498
public:
499-
debug_gdbstub()
500-
: osd_module(OSD_DEBUG_PROVIDER, "gdbstub"), debug_module(),
499+
debug_gdbstub() :
500+
osd_module(OSD_DEBUG_PROVIDER, "gdbstub"), debug_module(),
501501
m_readbuf_state(PACKET_START),
502502
m_machine(nullptr),
503503
m_maincpu(nullptr),
@@ -506,7 +506,7 @@ class debug_gdbstub : public osd_module, public debug_module
506506
m_address_space(nullptr),
507507
m_debugger_cpu(nullptr),
508508
m_debugger_console(nullptr),
509-
m_debugger_host(nullptr),
509+
m_debugger_host(),
510510
m_debugger_port(0),
511511
m_socket(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE),
512512
m_is_be(false),
@@ -601,7 +601,7 @@ class debug_gdbstub : public osd_module, public debug_module
601601
address_space *m_address_space;
602602
debugger_cpu *m_debugger_cpu;
603603
debugger_console *m_debugger_console;
604-
const char *m_debugger_host;
604+
std::string m_debugger_host;
605605
int m_debugger_port;
606606
emu_file m_socket;
607607
bool m_is_be;
@@ -795,8 +795,8 @@ void debug_gdbstub::wait_for_debugger(device_t &device, bool firststop)
795795
std::string socket_name = string_format("socket.%s:%d", m_debugger_host, m_debugger_port);
796796
std::error_condition const filerr = m_socket.open(socket_name);
797797
if ( filerr )
798-
fatalerror("gdbstub: failed to start listening on host %s port %d\n", m_debugger_host, m_debugger_port);
799-
osd_printf_info("gdbstub: listening on host %s port %d\n", m_debugger_host, m_debugger_port);
798+
fatalerror("gdbstub: failed to start listening on address %s port %d\n", m_debugger_host, m_debugger_port);
799+
osd_printf_info("gdbstub: listening on address %s port %d\n", m_debugger_host, m_debugger_port);
800800

801801
m_initialized = true;
802802
}

src/osd/modules/lib/osdobj_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const options_entry osd_options::s_option_entries[] =
5858

5959
{ nullptr, nullptr, core_options::option_type::HEADER, "OSD DEBUGGING OPTIONS" },
6060
{ OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, core_options::option_type::STRING, "debugger used: " },
61-
{ OSDOPTION_DEBUGGER_HOST, "localhost", core_options::option_type::STRING, "host to use for gdbstub debugger" },
61+
{ OSDOPTION_DEBUGGER_HOST, "localhost", core_options::option_type::STRING, "address to bind to for gdbstub debugger" },
6262
{ OSDOPTION_DEBUGGER_PORT, "23946", core_options::option_type::INTEGER, "port to use for gdbstub debugger" },
6363
{ OSDOPTION_DEBUGGER_FONT ";dfont", OSDOPTVAL_AUTO, core_options::option_type::STRING, "font to use for debugger views" },
6464
{ OSDOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "0", core_options::option_type::FLOAT, "font size to use for debugger views" },

0 commit comments

Comments
 (0)