Skip to content

Commit a311902

Browse files
committed
Store the control_socket_path internally without the platform specific prefix, but do report the full path to logs.
1 parent 40cf998 commit a311902

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/base/ctrl_socket.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,13 +475,16 @@ void xdebug_control_socket_teardown(void)
475475
#elif WIN32
476476
void xdebug_control_socket_setup(void)
477477
{
478+
char *name = NULL;
479+
478480
XG_BASE(control_socket_last_trigger) = xdebug_get_nanotime();
479481

480-
XG_BASE(control_socket_path) = xdebug_sprintf("\\\\.\\pipe\\xdebug-ctrl." ZEND_ULONG_FMT, xdebug_get_pid());
482+
XG_BASE(control_socket_path) = xdebug_sprintf("xdebug-ctrl." ZEND_ULONG_FMT, xdebug_get_pid());
483+
name = xdebug_sprintf("\\\\.\\pipe\\%s", XG_BASE(control_socket_path));
481484

482485
/* Part 1 – create Named Pipe */
483486
XG_BASE(control_socket_h) = CreateNamedPipeA(
484-
XG_BASE(control_socket_path),
487+
name,
485488
PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_INSTANCE,
486489
PIPE_TYPE_BYTE | PIPE_NOWAIT | PIPE_REJECT_REMOTE_CLIENTS,
487490
1,
@@ -491,6 +494,8 @@ void xdebug_control_socket_setup(void)
491494
NULL
492495
);
493496

497+
xdfree(name);
498+
494499
if (XG_BASE(control_socket_h) == INVALID_HANDLE_VALUE) {
495500
errno = WSAGetLastError();
496501
xdebug_log_ex(XLOG_CHAN_CONFIG, XLOG_WARN, "CTRL-SOCKET", "Can't create control Named Pipe (0x%x)", errno);
@@ -499,7 +504,7 @@ void xdebug_control_socket_setup(void)
499504
return;
500505
}
501506

502-
xdebug_log_ex(XLOG_CHAN_CONFIG, XLOG_INFO, "CTRL-OK", "Control socket set up successfully: '%s'", XG_BASE(control_socket_path));
507+
xdebug_log_ex(XLOG_CHAN_CONFIG, XLOG_INFO, "CTRL-OK", "Control socket set up successfully: '\\\\.\\pipe\\%s'", XG_BASE(control_socket_path));
503508
}
504509

505510
void xdebug_control_socket_teardown(void)

tests/debugger/bug02261-002-win.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ echo file_get_contents( $xdebugLogFileName );
2424
?>
2525
--EXPECTF--
2626
<?xml version="1.0" encoding="iso-8859-1"?>
27-
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file://bug01949.inc" language="PHP" xdebug:language_version="" protocol_version="1.0" appid="" xdebug:ctrl_socket="%sxdebug-ctrl.%s"><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 by Derick Rethans]]></copyright></init>
27+
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file://bug01949.inc" language="PHP" xdebug:language_version="" protocol_version="1.0" appid="" xdebug:ctrl_socket="xdebug-ctrl.%s"><engine version=""><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2099 by Derick Rethans]]></copyright></init>
2828

2929
-> detach -i 1
3030
<?xml version="1.0" encoding="iso-8859-1"?>

0 commit comments

Comments
 (0)