summaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2016-01-07 12:30:17 -0800
committerMike McLaughlin <mikem@microsoft.com>2016-01-07 12:30:17 -0800
commite7467226a0c552cea5c431233e2a117253d6d22c (patch)
treef9c8216eccd4622fc7e10b7db82cf40de65fa71a /src/debug
parentd8e21852f1b5be330243154c9da45fcd51d59cc0 (diff)
downloadcoreclr-e7467226a0c552cea5c431233e2a117253d6d22c.tar.gz
coreclr-e7467226a0c552cea5c431233e2a117253d6d22c.tar.bz2
coreclr-e7467226a0c552cea5c431233e2a117253d6d22c.zip
Fixed issue #5109. Console stops echoing typed keys after running a coreclr program.
The DbgTransportSession/TwoWayPipe code was closing handle 0 (stdout) because the DbgTransportSession class wasn't being zero init'ed via a memset. The TwoWayPipe code initialized the pipe handles to -1. The fix is to reinitialized the TwoWayPipe by calling the constructor. Even though it is overkill also checked for 0 in the Disconnect code that closes the pipes.
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/debug-pal/unix/twowaypipe.cpp4
-rw-r--r--src/debug/shared/dbgtransportsession.cpp5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/debug/debug-pal/unix/twowaypipe.cpp b/src/debug/debug-pal/unix/twowaypipe.cpp
index 18881616f2..41da7ff2a3 100644
--- a/src/debug/debug-pal/unix/twowaypipe.cpp
+++ b/src/debug/debug-pal/unix/twowaypipe.cpp
@@ -178,13 +178,13 @@ int TwoWayPipe::Write(const void *data, DWORD dataSize)
bool TwoWayPipe::Disconnect()
{
- if (m_outboundPipe != INVALID_PIPE)
+ if (m_outboundPipe != INVALID_PIPE && m_outboundPipe != 0)
{
close(m_outboundPipe);
m_outboundPipe = INVALID_PIPE;
}
- if (m_inboundPipe != INVALID_PIPE)
+ if (m_inboundPipe != INVALID_PIPE && m_inboundPipe != 0)
{
close(m_inboundPipe);
m_inboundPipe = INVALID_PIPE;
diff --git a/src/debug/shared/dbgtransportsession.cpp b/src/debug/shared/dbgtransportsession.cpp
index 2b17f6d6d8..01f4acbc66 100644
--- a/src/debug/shared/dbgtransportsession.cpp
+++ b/src/debug/shared/dbgtransportsession.cpp
@@ -57,6 +57,11 @@ HRESULT DbgTransportSession::Init(DebuggerIPCControlBlock *pDCB, AppDomainEnumer
// cleanup necessary.
memset(this, 0, sizeof(*this));
+ // Because of the above memset the embeded classes/structs need to be reinitialized especially
+ // the two way pipe; it expects the in/out handles to be -1 instead of 0.
+ m_pipe = TwoWayPipe();
+ m_sStateLock = DbgTransportLock();
+
// Initialize all per-session state variables.
InitSessionState();