[Lldb-commits] [PATCH] fix lldb-mi hang on OSX
dawn at burble.org
dawn at burble.org
Wed Nov 26 08:55:22 PST 2014
On Wed, Nov 26, 2014 at 11:34:31AM +0000, Abid, Hafiz wrote:
> +1 on changing _MSC_VER to _WIN32 unless the former is really required.
> I do a Windows build with mingw tools and had to do this change locally.
> I will perhaps can upstream those changes as I have the environment to test
> them.
Again, the existing code used _MSC_VER. You'd have to ask the authors why.
I certainly have no reason to use _MSC_VER over _Win32. My patch is about
fixing the hang on OSX.
If you grep for _MSC_VER in lldb-mi, you'll see 43 uses of it. That should be
fixed in a separate commit. It was easy enough to create so I've attached a
patch for that, but someone else should verify it builds on Windows, and which
ever patch is committed second (the _MSC_VER patch or the OSX hang fix) will
need a little work because they will conflict.
Please commit the fix for the OSX hang, then address the _MSC_VER issue?
Thanks,
-Dawn
-------------- next part --------------
Index: Driver.cpp
===================================================================
--- Driver.cpp (revision 222776)
+++ Driver.cpp (working copy)
@@ -12,7 +12,7 @@
#if MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
-#ifndef _MSC_VER
+#ifndef _Win32
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -19,14 +19,14 @@
#include <limits.h>
#include <fcntl.h>
#include <string>
-#endif // _MSC_VER
+#endif // _Win32
#include "Platform.h" // CODETAG_IOR_SIGNALS
#include "Driver.h"
-#ifdef _MSC_VER
+#ifdef _Win32
#include <lldb\Host\windows\getopt\GetOptInc.h>
-#endif // _MSC_VER
+#endif // _Win32
#include <lldb/API/SBBreakpoint.h>
#include <lldb/API/SBCommandInterpreter.h>
#include <lldb/API/SBCommandReturnObject.h>
Index: MICmnLogMediumFile.cpp
===================================================================
--- MICmnLogMediumFile.cpp (revision 222776)
+++ MICmnLogMediumFile.cpp (working copy)
@@ -22,13 +22,13 @@
// In-house headers:
#include "MICmnLogMediumFile.h"
#include "MICmnResources.h"
-#if defined(_MSC_VER)
+#if defined(_Win32)
#include "MIUtilSystemWindows.h"
#elif defined(__FreeBSD__) || defined(__linux__)
#include "MIUtilSystemLinux.h"
#elif defined(__APPLE__)
#include "MIUtilSystemOsx.h"
-#endif // defined( _MSC_VER )
+#endif // defined( _Win32 )
//++ ------------------------------------------------------------------------------------
// Details: CMICmnLogMediumFile constructor.
@@ -236,11 +236,11 @@
// signifies that this file is 'hidden' and not normally visible. A quick fix
// is to remove the path component all together. Linux also normally uses '/'
// as directory separators, again leading to the problem of the hidden log.
-#if defined(_MSC_VER)
+#if defined(_Win32)
m_fileNamePath = CMIUtilString::Format("%s\\%s", strPath.c_str(), m_constMediumFileName.c_str());
#else
m_fileNamePath = CMIUtilString::Format("%s", m_constMediumFileName.c_str());
-#endif // defined ( _MSC_VER )
+#endif // defined ( _Win32 )
return MIstatus::success;
}
Index: MICmnStreamStderr.cpp
===================================================================
--- MICmnStreamStderr.cpp (revision 222776)
+++ MICmnStreamStderr.cpp (working copy)
@@ -66,13 +66,13 @@
bool bOk = MIstatus::success;
-#ifdef _MSC_VER
+#ifdef _Win32
// Debugging / I/O issues with client.
// This is only required on Windows if you do not use ::flush(stderr). MI uses
// ::flush(stderr)
// It trys to ensure the process attached to the stderr steam gets ALL the data.
//::setbuf( stderr, NULL );
-#endif // _MSC_VER
+#endif // _Win32
m_bInitialized = bOk;
Index: MICmnStreamStdin.cpp
===================================================================
--- MICmnStreamStdin.cpp (revision 222776)
+++ MICmnStreamStdin.cpp (working copy)
@@ -27,12 +27,12 @@
#include "MICmnThreadMgrStd.h"
#include "MIUtilSingletonHelper.h"
#include "MIDriver.h"
-#if defined(_MSC_VER)
+#if defined(_Win32)
#include "MIUtilSystemWindows.h"
#include "MICmnStreamStdinWindows.h"
#else
#include "MICmnStreamStdinLinux.h"
-#endif // defined( _MSC_VER )
+#endif // defined( _Win32 )
//++ ------------------------------------------------------------------------------------
// Details: CMICmnStreamStdin constructor.
@@ -87,13 +87,13 @@
MI::ModuleInit<CMICmnLog>(IDS_MI_INIT_ERR_LOG, bOk, errMsg);
MI::ModuleInit<CMICmnResources>(IDS_MI_INIT_ERR_RESOURCES, bOk, errMsg);
MI::ModuleInit<CMICmnThreadMgrStd>(IDS_MI_INIT_ERR_THREADMGR, bOk, errMsg);
-#ifdef _MSC_VER
+#ifdef _Win32
MI::ModuleInit<CMICmnStreamStdinWindows>(IDS_MI_INIT_ERR_OS_STDIN_HANDLER, bOk, errMsg);
bOk = bOk && SetOSStdinHandler(CMICmnStreamStdinWindows::Instance());
#else
MI::ModuleInit<CMICmnStreamStdinLinux>(IDS_MI_INIT_ERR_OS_STDIN_HANDLER, bOk, errMsg);
bOk = bOk && SetOSStdinHandler(CMICmnStreamStdinLinux::Instance());
-#endif // ( _MSC_VER )
+#endif // ( _Win32 )
// The OS specific stdin stream handler must be set before *this class initialises
if (bOk && m_pStdinReadHandler == nullptr)
@@ -149,11 +149,11 @@
m_bKeyCtrlCHit = false;
// Note shutdown order is important here
-#ifndef _MSC_VER
+#ifndef _Win32
MI::ModuleShutdown<CMICmnStreamStdinLinux>(IDS_MI_SHTDWN_ERR_OS_STDIN_HANDLER, bOk, errMsg);
#else
MI::ModuleShutdown<CMICmnStreamStdinWindows>(IDS_MI_SHTDWN_ERR_OS_STDIN_HANDLER, bOk, errMsg);
-#endif // ( _MSC_VER )
+#endif // ( _Win32 )
MI::ModuleShutdown<CMICmnThreadMgrStd>(IDS_MI_SHTDWN_ERR_THREADMGR, bOk, errMsg);
MI::ModuleShutdown<CMICmnResources>(IDE_MI_SHTDWN_ERR_RESOURCES, bOk, errMsg);
MI::ModuleShutdown<CMICmnLog>(IDS_MI_SHTDWN_ERR_LOG, bOk, errMsg);
Index: MICmnStreamStdinLinux.cpp
===================================================================
--- MICmnStreamStdinLinux.cpp (revision 222776)
+++ MICmnStreamStdinLinux.cpp (working copy)
@@ -20,10 +20,10 @@
//--
// Third Party Headers:
-#if !defined(_MSC_VER)
+#if !defined(_Win32)
#include <sys/select.h>
#include <termios.h>
-#endif // !defined( _MSC_VER )
+#endif // !defined( _Win32 )
#include <string.h> // For std::strerror()
// In-house headers:
Index: MICmnStreamStdinWindows.cpp
===================================================================
--- MICmnStreamStdinWindows.cpp (revision 222776)
+++ MICmnStreamStdinWindows.cpp (working copy)
@@ -20,12 +20,12 @@
//--
// Third Party Headers:
-#if defined(_MSC_VER)
+#if defined(_Win32)
#include <stdio.h>
#include <Windows.h>
#include <io.h>
#include <conio.h>
-#endif // defined( _MSC_VER )
+#endif // defined( _Win32 )
#include <string.h>
// In-house headers:
@@ -100,9 +100,9 @@
// Clear error indicators for std input
::clearerr(stdin);
-#if defined(_MSC_VER)
+#if defined(_Win32)
m_bRunningInConsoleWin = ::_isatty(::fileno(stdin));
-#endif // #if defined( _MSC_VER )
+#endif // #if defined( _Win32 )
}
m_bInitialized = bOk;
@@ -190,7 +190,7 @@
bool
CMICmnStreamStdinWindows::InputAvailableConsoleWin(bool &vwbAvail)
{
-#if defined(_MSC_VER)
+#if defined(_Win32)
if (m_nBytesToBeRead == 0)
{
// Get a windows handle to std input stream
@@ -203,7 +203,7 @@
// Return state of whether bytes are waiting or not
vwbAvail = (nBytesWaiting > 0);
}
-#endif // #if defined( _MSC_VER )
+#endif // #if defined( _Win32 )
return MIstatus::success;
}
@@ -219,7 +219,7 @@
bool
CMICmnStreamStdinWindows::InputAvailableApplication(bool &vwbAvail)
{
-#if defined(_MSC_VER)
+#if defined(_Win32)
if (m_nBytesToBeRead == 0)
{
// Get a windows handle to std input stream
@@ -242,7 +242,7 @@
// Return state of whether bytes are waiting or not
vwbAvail = (nBytesWaiting > 0);
}
-#endif // #if defined( _MSC_VER )
+#endif // #if defined( _Win32 )
return MIstatus::success;
}
Index: MICmnStreamStdout.cpp
===================================================================
--- MICmnStreamStdout.cpp (revision 222776)
+++ MICmnStreamStdout.cpp (working copy)
@@ -66,13 +66,13 @@
bool bOk = MIstatus::success;
-#ifdef _MSC_VER
+#ifdef _Win32
// Debugging / I/O issues with client.
// This is only required on Windows if you do not use ::flush(stdout). MI uses
// ::flush(stdout)
// It trys to ensure the process attached to the stdout steam gets ALL the data.
//::setbuf( stdout, NULL );
-#endif // _MSC_VER
+#endif // _Win32
m_bInitialized = bOk;
Index: MIDriverMain.cpp
===================================================================
--- MIDriverMain.cpp (revision 222776)
+++ MIDriverMain.cpp (working copy)
@@ -43,9 +43,9 @@
// Copyright: None.
//--
-#if defined(_MSC_VER)
+#if defined(_Win32)
#define _INC_SIGNAL // Stop window's signal.h being included - CODETAG_IOR_SIGNALS
-#endif // _MSC_VER
+#endif // _Win32
// Third party headers:
#include <stdio.h>
@@ -64,9 +64,9 @@
#if MICONFIG_COMPILE_MIDRIVER_VERSION
-#if defined(_MSC_VER)
+#if defined(_Win32)
#pragma warning(once : 4530) // Warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
-#endif // _MSC_VER
+#endif // _Win32
// ToDo: Reevaluate if this function needs to be implemented like the UNIX equivalent
// CODETAG_IOR_SIGNALS
Index: MIUtilFileStd.cpp
===================================================================
--- MIUtilFileStd.cpp (revision 222776)
+++ MIUtilFileStd.cpp (working copy)
@@ -39,11 +39,11 @@
CMIUtilFileStd::CMIUtilFileStd(void)
: m_fileNamePath(CMIUtilString())
, m_pFileHandle(nullptr)
-#if defined(_MSC_VER)
+#if defined(_Win32)
, m_constCharNewLine("\r\n")
#else
, m_constCharNewLine("\n")
-#endif // #if defined( _MSC_VER )
+#endif // #if defined( _Win32 )
, m_bFileError(false)
{
}
@@ -89,13 +89,13 @@
if (m_pFileHandle != nullptr)
return MIstatus::success;
-#if !defined(_MSC_VER)
+#if !defined(_Win32)
// Open with 'write' and 'binary' mode
m_pFileHandle = ::fopen(vFileNamePath.c_str(), "wb");
#else
// Open a file with exclusive write and shared read permissions
m_pFileHandle = ::_fsopen(vFileNamePath.c_str(), "wb", _SH_DENYWR);
-#endif // !defined( _MSC_VER )
+#endif // !defined( _Win32 )
if (m_pFileHandle == nullptr)
{
@@ -291,9 +291,9 @@
MIchar
CMIUtilFileStd::GetSlash(void)
{
-#if !defined(_MSC_VER)
+#if !defined(_Win32)
return '/';
#else
return '\\';
-#endif // !defined( _MSC_VER )
+#endif // !defined( _Win32 )
}
Index: MIUtilSystemWindows.cpp
===================================================================
--- MIUtilSystemWindows.cpp (revision 222776)
+++ MIUtilSystemWindows.cpp (working copy)
@@ -19,7 +19,7 @@
// Copyright: None.
//--
-#if defined(_MSC_VER)
+#if defined(_Win32)
// Third party headers
#include <memory> // std::unique_ptr
@@ -150,4 +150,4 @@
return GetExecutablesPath(vrwFileNamePath);
}
-#endif // #if defined( _MSC_VER )
+#endif // #if defined( _Win32 )
Index: MIUtilSystemWindows.h
===================================================================
--- MIUtilSystemWindows.h (revision 222776)
+++ MIUtilSystemWindows.h (working copy)
@@ -20,7 +20,7 @@
//--
#pragma once
-#if defined(_MSC_VER)
+#if defined(_Win32)
// In-house headers:
#include "MIUtilString.h"
@@ -53,4 +53,4 @@
typedef CMIUtilSystemWindows CMIUtilSystem;
-#endif // #if defined( _MSC_VER )
+#endif // #if defined( _Win32 )
Index: MIUtilThreadBaseStd.h
===================================================================
--- MIUtilThreadBaseStd.h (revision 222776)
+++ MIUtilThreadBaseStd.h (working copy)
@@ -25,9 +25,9 @@
#pragma once
// Third party headers:
-#ifdef _MSC_VER
+#ifdef _Win32
#include <eh.h>
-#endif // _MSC_VER
+#endif // _Win32
#include <thread>
#include <mutex>
Index: Platform.cpp
===================================================================
--- Platform.cpp (revision 222776)
+++ Platform.cpp (working copy)
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
// this file is only relevant for Visual C++
-#if defined(_MSC_VER)
+#if defined(_Win32)
#include <process.h>
#include <assert.h>
Index: Platform.h
===================================================================
--- Platform.h (revision 222776)
+++ Platform.h (working copy)
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#pragma once
-#if defined(_MSC_VER)
+#if defined(_Win32)
// this will stop signal.h being included
#define _INC_SIGNAL
More information about the lldb-commits
mailing list