diff options
28 files changed, 207 insertions, 171 deletions
diff --git a/lldb/cmake/LLDBDependencies.cmake b/lldb/cmake/LLDBDependencies.cmake index ac554eb004d..4c74c3d14bd 100644 --- a/lldb/cmake/LLDBDependencies.cmake +++ b/lldb/cmake/LLDBDependencies.cmake @@ -173,6 +173,9 @@ if ( NOT LLDB_DISABLE_PYTHON ) set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp) set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1) + if (CLANG_CL) + set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES COMPILE_FLAGS -Wno-unused-function) + endif() if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") set_property(SOURCE ${LLDB_WRAP_PYTHON} diff --git a/lldb/include/lldb/API/SBCommunication.h b/lldb/include/lldb/API/SBCommunication.h index fa60e6339a1..c4b2709de8a 100644 --- a/lldb/include/lldb/API/SBCommunication.h +++ b/lldb/include/lldb/API/SBCommunication.h @@ -18,7 +18,8 @@ namespace lldb { class LLDB_API SBCommunication { public: - enum { + FLAGS_ANONYMOUS_ENUM() + { eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost. eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available. eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients. diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h index 815a6ebae07..b73c83af075 100644 --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -26,7 +26,7 @@ public: //------------------------------------------------------------------ /// Broadcaster event bits definitions. //------------------------------------------------------------------ - enum + FLAGS_ANONYMOUS_ENUM() { eBroadcastBitStateChanged = (1 << 0), eBroadcastBitInterrupt = (1 << 1), diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h index 001aa3c9d84..4567f86ef35 100644 --- a/lldb/include/lldb/API/SBValue.h +++ b/lldb/include/lldb/API/SBValue.h @@ -21,8 +21,6 @@ namespace lldb { class LLDB_API SBValue { -friend class ValueLocker; - public: SBValue (); diff --git a/lldb/include/lldb/Core/Communication.h b/lldb/include/lldb/Core/Communication.h index a5b6b2b0d4d..7924ed293d3 100644 --- a/lldb/include/lldb/Core/Communication.h +++ b/lldb/include/lldb/Core/Communication.h @@ -85,15 +85,16 @@ namespace lldb_private { class Communication : public Broadcaster { public: - enum { - eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost. - eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available. - eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients. - eBroadcastBitReadThreadShouldExit = (1 << 3), ///< Sent by clients that need to cancel the read thread. - eBroadcastBitPacketAvailable = (1 << 4), ///< Sent when data received makes a complete packet. - eBroadcastBitNoMorePendingInput = (1 << 5), ///< Sent by the read thread to indicate all pending input has been processed. - kLoUserBroadcastBit = (1 << 16),///< Subclasses can used bits 31:16 for any needed events. - kHiUserBroadcastBit = (1 << 31), + FLAGS_ANONYMOUS_ENUM() + { + eBroadcastBitDisconnected = (1u << 0), ///< Sent when the communications connection is lost. + eBroadcastBitReadThreadGotBytes = (1u << 1), ///< Sent by the read thread when bytes become available. + eBroadcastBitReadThreadDidExit = (1u << 2), ///< Sent by the read thread when it exits to inform clients. + eBroadcastBitReadThreadShouldExit = (1u << 3), ///< Sent by clients that need to cancel the read thread. + eBroadcastBitPacketAvailable = (1u << 4), ///< Sent when data received makes a complete packet. + eBroadcastBitNoMorePendingInput = (1u << 5), ///< Sent by the read thread to indicate all pending input has been processed. + kLoUserBroadcastBit = (1u << 16),///< Subclasses can used bits 31:16 for any needed events. + kHiUserBroadcastBit = (1u << 31), eAllEventBits = 0xffffffff }; diff --git a/lldb/include/lldb/Host/windows/ConnectionGenericFileWindows.h b/lldb/include/lldb/Host/windows/ConnectionGenericFileWindows.h index 3a255cfd753..bfe9b2e0c7b 100644 --- a/lldb/include/lldb/Host/windows/ConnectionGenericFileWindows.h +++ b/lldb/include/lldb/Host/windows/ConnectionGenericFileWindows.h @@ -26,19 +26,19 @@ class ConnectionGenericFile : public lldb_private::Connection ConnectionGenericFile(lldb::file_t file, bool owns_file); - virtual ~ConnectionGenericFile(); + ~ConnectionGenericFile() override; - virtual bool IsConnected() const; + bool IsConnected() const override; - virtual lldb::ConnectionStatus Connect(const char *s, Error *error_ptr); + lldb::ConnectionStatus Connect(const char *s, Error *error_ptr) override; - virtual lldb::ConnectionStatus Disconnect(Error *error_ptr); + lldb::ConnectionStatus Disconnect(Error *error_ptr) override; - virtual size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr); + size_t Read(void *dst, size_t dst_len, uint32_t timeout_usec, lldb::ConnectionStatus &status, Error *error_ptr) override; - virtual size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr); + size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr) override; - virtual std::string GetURI(); + std::string GetURI() override; bool InterruptRead() override; diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h index 31d3a614f00..3e8aa21adb4 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h @@ -125,7 +125,7 @@ public: const char* setting, const lldb::TargetSP& target_sp); - friend class IOHandlerPythonInterpreter; + friend class ::IOHandlerPythonInterpreter; ScriptInterpreterPython (CommandInterpreter &interpreter); diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 51bd3dd82c9..64cd3c0e8f4 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -71,7 +71,12 @@ public: eEncodingIsSyntheticUID } EncodingDataType; - typedef enum ResolveStateTag + // We must force the underlying type of the enum to be unsigned here. Not all compilers + // behave the same with regards to the default underlying type of an enum, but because + // this enum is used in an enum bitfield and integer comparisons are done with the value + // we need to guarantee that it's always unsigned so that, for example, eResolveStateFull + // doesn't compare less than eResolveStateUnresolved when used in a 2-bit bitfield. + typedef enum ResolveStateTag : unsigned { eResolveStateUnresolved = 0, eResolveStateForward = 1, diff --git a/lldb/include/lldb/Target/SectionLoadHistory.h b/lldb/include/lldb/Target/SectionLoadHistory.h index 50dcfd3cc87..ddf46a1861c 100644 --- a/lldb/include/lldb/Target/SectionLoadHistory.h +++ b/lldb/include/lldb/Target/SectionLoadHistory.h @@ -23,7 +23,7 @@ namespace lldb_private { class SectionLoadHistory { public: - enum { + enum : unsigned { // Pass eStopIDNow to any function that takes a stop ID to get // the current value. eStopIDNow = UINT32_MAX diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index e0716177998..ed01bcf65d0 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -10,12 +10,34 @@ #ifndef LLDB_lldb_enumerations_h_ #define LLDB_lldb_enumerations_h_ +#ifndef SWIG +// With MSVC, the default type of an enum is always signed, even if one of the +// enumerator values is too large to fit into a signed integer but would +// otherwise fit into an unsigned integer. As a result of this, all of LLDB's +// flag-style enumerations that specify something like eValueFoo = 1u << 31 +// result in negative values. This usually just results in a benign warning, +// but in a few places we actually do comparisons on the enum values, which +// would cause a real bug. Furthermore, there's no way to silence only this +// warning, as it's part of -Wmicrosoft which also catches a whole slew of +// other useful issues. +// +// To make matters worse, early versions of SWIG don't recognize the syntax +// of specifying the underlying type of an enum (and Python doesn't care anyway) +// so we need a way to specify the underlying type when the enum is being used +// from C++ code, but just use a regular enum when swig is pre-processing. +#define FLAGS_ENUM(Name) enum Name : unsigned +#define FLAGS_ANONYMOUS_ENUM() enum : unsigned +#else +#define FLAGS_ENUM(Name) enum Name +#define FLAGS_ANONYMOUS_ENUM() enum +#endif + namespace lldb { //---------------------------------------------------------------------- // Process and Thread States //---------------------------------------------------------------------- - typedef enum StateType + enum StateType { eStateInvalid = 0, eStateUnloaded, ///< Process is object is valid, but not currently loaded @@ -31,12 +53,12 @@ namespace lldb { eStateSuspended ///< Process or thread is in a suspended state as far ///< as the debugger is concerned while other processes ///< or threads get the chance to run. - } StateType; + }; //---------------------------------------------------------------------- // Launch Flags //---------------------------------------------------------------------- - typedef enum LaunchFlags + FLAGS_ENUM(LaunchFlags) { eLaunchFlagNone = 0u, eLaunchFlagExec = (1u << 0), ///< Exec when launching and turn the calling process into a new process @@ -53,44 +75,45 @@ namespace lldb { ///< if it loses connection with lldb. eLaunchFlagShellExpandArguments = (1u << 10), ///< Perform shell-style argument expansion eLaunchFlagCloseTTYOnExit = (1u << 11), ///< Close the open TTY on exit - } LaunchFlags; + }; //---------------------------------------------------------------------- // Thread Run Modes //---------------------------------------------------------------------- - typedef enum RunMode { + enum RunMode + { eOnlyThisThread, eAllThreads, eOnlyDuringStepping - } RunMode; + }; //---------------------------------------------------------------------- // Byte ordering definitions //---------------------------------------------------------------------- - typedef enum ByteOrder + enum ByteOrder { eByteOrderInvalid = 0, eByteOrderBig = 1, eByteOrderPDP = 2, eByteOrderLittle = 4 - } ByteOrder; + }; //---------------------------------------------------------------------- // Register encoding definitions //---------------------------------------------------------------------- - typedef enum Encoding + enum Encoding { eEncodingInvalid = 0, eEncodingUint, // unsigned integer eEncodingSint, // signed integer eEncodingIEEE754, // float eEncodingVector // vector registers - } Encoding; + }; //---------------------------------------------------------------------- // Display format definitions //---------------------------------------------------------------------- - typedef enum Format + enum Format { eFormatDefault = 0, eFormatInvalid = 0, @@ -133,29 +156,29 @@ namespace lldb { eFormatInstruction, // Disassemble an opcode eFormatVoid, // Do not print this kNumFormats - } Format; + }; //---------------------------------------------------------------------- // Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls //---------------------------------------------------------------------- - typedef enum DescriptionLevel + enum DescriptionLevel { eDescriptionLevelBrief = 0, eDescriptionLevelFull, eDescriptionLevelVerbose, eDescriptionLevelInitial, kNumDescriptionLevels - } DescriptionLevel; + }; //---------------------------------------------------------------------- // Script interpreter types //---------------------------------------------------------------------- - typedef enum ScriptLanguage + enum ScriptLanguage { eScriptLanguageNone, eScriptLanguagePython, eScriptLanguageDefault = eScriptLanguagePython - } ScriptLanguage; + }; //---------------------------------------------------------------------- // Register numbering types @@ -163,7 +186,7 @@ namespace lldb { // any of these to the lldb internal register numbering scheme // (eRegisterKindLLDB). //---------------------------------------------------------------------- - typedef enum RegisterKind + enum RegisterKind { eRegisterKindGCC = 0, // the register numbers seen in eh_frame eRegisterKindDWARF, // the register numbers seen DWARF @@ -171,12 +194,12 @@ namespace lldb { eRegisterKindGDB, // the register numbers gdb uses (matches stabs numbers) eRegisterKindLLDB, // lldb's internal register numbers kNumRegisterKinds - } RegisterKind; + }; //---------------------------------------------------------------------- // Thread stop reasons //---------------------------------------------------------------------- - typedef enum StopReason + enum StopReason { eStopReasonInvalid = 0, eStopReasonNone, @@ -189,12 +212,12 @@ namespace lldb { eStopReasonPlanComplete, eStopReasonThreadExiting, eStopReasonInstrumentation - } StopReason; + }; //---------------------------------------------------------------------- // Command Return Status Types //---------------------------------------------------------------------- - typedef enum ReturnStatus + enum ReturnStatus { eReturnStatusInvalid, eReturnStatusSuccessFinishNoResult, @@ -204,13 +227,13 @@ namespace lldb { eReturnStatusStarted, eReturnStatusFailed, eReturnStatusQuit - } ReturnStatus; + }; //---------------------------------------------------------------------- // The results of expression evaluation: //---------------------------------------------------------------------- - typedef enum ExpressionResults + enum ExpressionResults { eExpressionCompleted = 0, eExpressionSetupError, @@ -221,12 +244,12 @@ namespace lldb { eExpressionTimedOut, eExpressionResultUnavailable, eExpressionStoppedForDebug - } ExpressionResults; + }; //---------------------------------------------------------------------- // Connection Status Types //---------------------------------------------------------------------- - typedef enum ConnectionStatus + enum ConnectionStatus { eConnectionStatusSuccess, // Success eConnectionStatusEndOfFile, // End-of-file encountered @@ -235,9 +258,9 @@ namespace lldb { eConnectionStatusNoConnection, // No connection eConnectionStatusLostConnection, // Lost connection while connected to a valid connection eConnectionStatusInterrupted // Interrupted read - } ConnectionStatus; + }; - typedef enum ErrorType + enum ErrorType { eErrorTypeInvalid, eErrorTypeGeneric, ///< Generic errors that can be any value. @@ -245,10 +268,10 @@ namespace lldb { eErrorTypePOSIX, ///< POSIX error codes. eErrorTypeExpression, ///< These are from the ExpressionResults enum. eErrorTypeWin32 ///< Standard Win32 error codes. - } ErrorType; + }; - typedef enum ValueType + enum ValueType { eValueTypeInvalid = 0, eValueTypeVariableGlobal = 1, // globals variable @@ -258,20 +281,20 @@ namespace lldb { eValueTypeRegister = 5, // stack frame register value eValueTypeRegisterSet = 6, // A collection of stack frame register values eValueTypeConstResult = 7 // constant result variables - } ValueType; + }; //---------------------------------------------------------------------- // Token size/granularities for Input Readers //---------------------------------------------------------------------- - typedef enum InputReaderGranularity + enum InputReaderGranularity { eInputReaderGranularityInvalid = 0, eInputReaderGranularityByte, eInputReaderGranularityWord, eInputReaderGranularityLine, eInputReaderGranularityAll - } InputReaderGranularity; + }; //------------------------------------------------------------------ /// These mask bits allow a common interface for queries that can @@ -283,7 +306,7 @@ namespace lldb { /// in this class, and requests that that item be resolved, or /// indicates that the member did get resolved. //------------------------------------------------------------------ - typedef enum SymbolContextItem + FLAGS_ENUM(SymbolContextItem) { eSymbolContextTarget = (1u << 0), ///< Set when \a target is requested from a query, or was located in query results eSymbolContextModule = (1u << 1), ///< Set when \a module is requested from a query, or was located in query results @@ -297,16 +320,16 @@ namespace lldb { ///< eSymbolContextVariable is potentially expensive to lookup so it isn't included in ///< eSymbolContextEverything which stops it from being used during frame PC lookups and ///< many other potential address to symbol context lookups. - } SymbolContextItem; + }; - typedef enum Permissions + FLAGS_ENUM(Permissions) { ePermissionsWritable = (1u << 0), ePermissionsReadable = (1u << 1), ePermissionsExecutable = (1u << 2) - } Permissions; + }; - typedef enum InputReaderAction + enum InputReaderAction { eInputReaderActivate, // reader is newly pushed onto the reader stack eInputReaderAsynchronousOutputWritten, // an async output event occurred; the reader may want to do something @@ -316,9 +339,9 @@ namespace lldb { eInputReaderInterrupt, // reader received an interrupt signal (probably from a control-c) eInputReaderEndOfFile, // reader received an EOF char (probably from a control-d) eInputReaderDone // reader was just popped off the stack and is done - } InputReaderAction; + }; - typedef enum BreakpointEventType + FLAGS_ENUM(BreakpointEventType) { eBreakpointEventTypeInvalidType = (1u << 0), eBreakpointEventTypeAdded = (1u << 1), @@ -332,9 +355,9 @@ namespace lldb { eBreakpointEventTypeConditionChanged = (1u << 9), eBreakpointEventTypeIgnoreChanged = (1u << 10), eBreakpointEventTypeThreadChanged = (1u << 11) - } BreakpointEventType; + }; - typedef enum WatchpointEventType + FLAGS_ENUM(WatchpointEventType) { eWatchpointEventTypeInvalidType = (1u << 0), eWatchpointEventTypeAdded = (1u << 1), @@ -346,7 +369,7 @@ namespace lldb { eWatchpointEventTypeIgnoreChanged = (1u << 10), eWatchpointEventTypeThreadChanged = (1u << 11), eWatchpointEventTypeTypeChanged = (1u << 12) - } WatchpointEventType; + }; //---------------------------------------------------------------------- @@ -357,7 +380,7 @@ namespace lldb { /// The enum -> string code is in LanguageRuntime.cpp, don't change this /// table without updating that code as well. //---------------------------------------------------------------------- - typedef enum LanguageType + enum LanguageType { eLanguageTypeUnknown = 0x0000, ///< Unknown or invalid language value. eLanguageTypeC89 = 0x0001, ///< ISO C:1989. @@ -398,30 +421,31 @@ namespace lldb { eLanguageTypeFortran03 = 0x0022, ///< ISO Fortran 2003. eLanguageTypeFortran08 = 0x0023, ///< ISO Fortran 2008. eNumLanguageTypes - } LanguageType; + }; - typedef enum InstrumentationRuntimeType { + enum InstrumentationRuntimeType + { eInstrumentationRuntimeTypeAddressSanitizer = 0x0000, eNumInstrumentationRuntimeTypes - } InstrumentationRuntimeType; + }; - typedef enum DynamicValueType + enum DynamicValueType { eNoDynamicValues = 0, eDynamicCanRunTarget = 1, eDynamicDontRunTarget = 2 - } DynamicValueType; + }; - typedef enum AccessType + enum AccessType { eAccessNone, eAccessPublic, eAccessPrivate, eAccessProtected, eAccessPackage - } AccessType; + }; - typedef enum CommandArgumentType + enum CommandArgumentType { eArgTypeAddress = 0, eArgTypeAddressOrExpression, @@ -506,12 +530,12 @@ namespace lldb { eArgTypeWatchpointIDRange, eArgTypeWatchType, eArgTypeLastArg // Always keep this entry as the last entry in this enumeration!! - } CommandArgumentType; + }; //---------------------------------------------------------------------- // Symbol types //---------------------------------------------------------------------- - typedef enum SymbolType + enum SymbolType { eSymbolTypeAny = 0, eSymbolTypeInvalid = 0, @@ -543,9 +567,9 @@ namespace lldb { eSymbolTypeObjCMetaClass, eSymbolTypeObjCIVar, eSymbolTypeReExported - } SymbolType; + }; - typedef enum SectionType + enum SectionType { eSectionTypeInvalid, eSectionTypeCode, @@ -584,17 +608,16 @@ namespace lldb { eSectionTypeEHFrame, eSectionTypeCompactUnwind, // compact unwind section in Mach-O, __TEXT,__unwind_info eSectionTypeOther - - } SectionType; + }; - typedef enum EmulateInstructionOptions + FLAGS_ENUM(EmulateInstructionOptions) { eEmulateInstructionOptionNone = (0u), eEmulateInstructionOptionAutoAdvancePC = (1u << 0), eEmulateInstructionOptionIgnoreConditions = (1u << 1) - } EmulateInstructionOptions; + }; - typedef enum FunctionNameType + FLAGS_ENUM(FunctionNameType) { eFunctionNameTypeNone = 0u, eFunctionNameTypeAuto = (1u << 1), // Automatically figure out which FunctionNameType @@ -609,13 +632,13 @@ namespace lldb { eFunctionNameTypeMethod = (1u << 4), // Find function by method name (C++) with no namespace or arguments eFunctionNameTypeSelector = (1u << 5), // Find function by selector name (ObjC) names eFunctionNameTypeAny = eFunctionNameTypeAuto // DEPRECATED: use eFunctionNameTypeAuto - } FunctionNameType; + }; //---------------------------------------------------------------------- // Basic types enumeration for the public API SBType::GetBasicType() //---------------------------------------------------------------------- - typedef enum BasicType + enum BasicType { eBasicTypeInvalid = 0, eBasicTypeVoid = 1, @@ -650,9 +673,9 @@ namespace lldb { eBasicTypeObjCSel, eBasicTypeNullPtr, eBasicTypeOther - } BasicType; + }; - typedef enum TypeClass + FLAGS_ENUM(TypeClass) { eTypeClassInvalid = (0u), eTypeClassArray = (1u << 0), @@ -677,9 +700,9 @@ namespace lldb { eTypeClassOther = (1u << 31), // Define a mask that can be used for any type when finding types eTypeClassAny = (0xffffffffu) - } TypeClass; + }; - typedef enum TemplateArgumentKind + enum TemplateArgumentKind { eTemplateArgumentKindNull = 0, eTemplateArgumentKindType, @@ -690,13 +713,13 @@ namespace lldb { eTemplateArgumentKindExpression, eTemplateArgumentKindPack - } TemplateArgumentKind; + }; //---------------------------------------------------------------------- // Options that can be set for a formatter to alter its behavior // Not all of these are applicable to all formatter types //---------------------------------------------------------------------- - typedef enum TypeOptions + FLAGS_ENUM(TypeOptions) { eTypeOptionNone = (0u), eTypeOptionCascade = (1u << 0), @@ -706,7 +729,7 @@ namespace lldb { eTypeOptionHideValue = (1u << 4), eTypeOptionShowOneLiner = (1u << 5), eTypeOptionHideNames = (1u << 6) - } TypeOptions; + }; //---------------------------------------------------------------------- // This is the return value for frame comparisons. If you are comparing frame A to frame B @@ -719,7 +742,7 @@ namespace lldb { // 5) If the two frames are on different threads or processes the comparision is Invalid // 6) If for some reason we can't figure out what went on, we return Unknown. //---------------------------------------------------------------------- - typedef enum FrameComparison + enum FrameComparison { eFrameCompareInvalid, eFrameCompareUnknown, @@ -727,7 +750,7 @@ namespace lldb { eFrameCompareSameParent, eFrameCompareYounger, eFrameCompareOlder - } FrameComparison; + }; //---------------------------------------------------------------------- // Address Class @@ -739,7 +762,7 @@ namespace lldb { // might contain PC relative data and the object file might be able to // tell us that an address in code is data. //---------------------------------------------------------------------- - typedef enum AddressClass + enum AddressClass { eAddressClassInvalid, eAddressClassUnknown, @@ -748,7 +771,7 @@ namespace lldb { eAddressClassData, eAddressClassDebug, eAddressClassRuntime - } AddressClass; + }; //---------------------------------------------------------------------- // File Permissions @@ -757,7 +780,7 @@ namespace lldb { // used with functions that set 'mode_t' to certain values for // permissions. //---------------------------------------------------------------------- - typedef enum FilePermissions + FLAGS_ENUM(FilePermissions) { eFilePermissionsUserRead = (1u << 8), eFilePermissionsUserWrite = (1u << 7), @@ -790,7 +813,7 @@ namespace lldb { eFilePermissionsEveryoneRWX = (eFilePermissionsEveryoneR | eFilePermissionsEveryoneW | eFilePermissionsEveryoneX ), eFilePermissionsFileDefault = eFilePermissionsUserRW, eFilePermissionsDirectoryDefault = eFilePermissionsUserRWX, - } FilePermissions; + }; //---------------------------------------------------------------------- // Queue work item types @@ -798,24 +821,24 @@ namespace lldb { // The different types of work that can be enqueued on a libdispatch // aka Grand Central Dispatch (GCD) queue. //---------------------------------------------------------------------- - typedef enum QueueItemKind + enum QueueItemKind { eQueueItemKindUnknown = 0, eQueueItemKindFunction, eQueueItemKindBlock - } QueueItemKind; + }; //---------------------------------------------------------------------- // Queue type // libdispatch aka Grand Central Dispatch (GCD) queues can be either serial // (executing on one thread) or concurrent (executing on multiple threads). //---------------------------------------------------------------------- - typedef enum QueueKind + enum QueueKind { eQueueKindUnknown = 0, eQueueKindSerial, eQueueKindConcurrent - } QueueKind; + }; //---------------------------------------------------------------------- // Expression Evaluation Stages @@ -823,13 +846,13 @@ namespace lldb { // expression evaluation callback, so that you can interrupt expression // evaluation at the various points in its lifecycle. //---------------------------------------------------------------------- - typedef enum ExpressionEvaluationPhase + enum ExpressionEvaluationPhase { eExpressionEvaluationParse = 0, eExpressionEvaluationIRGen, eExpressionEvaluationExecution, eExpressionEvaluationComplete - } ExpressionEvaluationPhase; + }; //---------------------------------------------------------------------- @@ -837,13 +860,13 @@ namespace lldb { // Indicates what types of events cause the watchpoint to fire. // Used by Native*Protocol-related classes. //---------------------------------------------------------------------- - typedef enum WatchpointKind + FLAGS_ENUM(WatchpointKind) { eWatchpointKindRead = (1u << 0), eWatchpointKindWrite = (1u << 1) - } WatchpointKind; + }; - typedef enum GdbSignal + enum GdbSignal { eGdbSignalBadAccess = 0x91, eGdbSignalBadInstruction = 0x92, @@ -851,14 +874,14 @@ namespace lldb { eGdbSignalEmulation = 0x94, eGdbSignalSoftware = 0x95, eGdbSignalBreakpoint = 0x96 - } GdbRemoteSignal; + }; //---------------------------------------------------------------------- // Used with SBHost::GetPath (lldb::PathType) to find files that are // related to LLDB on the current host machine. Most files are relative // to LLDB or are in known locations. //---------------------------------------------------------------------- - typedef enum PathType + enum PathType { ePathTypeLLDBShlibDir, // The directory where the lldb.so (unix) or LLDB mach-o file in LLDB.framework (MacOSX) exists ePathTypeSupportExecutableDir, // Find LLDB support executable directory (debugserver, etc) @@ -869,35 +892,37 @@ namespace lldb { ePathTypeLLDBTempSystemDir, // The LLDB temp directory for this system that will be cleaned up on exit ePathTypeGlobalLLDBTempSystemDir, // The LLDB temp directory for this system, NOT cleaned up on a process exit. ePathTypeClangDir // Find path to Clang builtin headers - } PathType; + }; //---------------------------------------------------------------------- // Kind of member function // Used by the type system //---------------------------------------------------------------------- - typedef enum MemberFunctionKind + enum MemberFunctionKind { eMemberFunctionKindUnknown = 0, // Not sure what the type of this is eMemberFunctionKindConstructor, // A function used to create instances eMemberFunctionKindDestructor, // A function used to tear down existing instances eMemberFunctionKindInstanceMethod, // A function that applies to a specific instance eMemberFunctionKindStaticMethod // A function that applies to a type rather than any instance - } MemberFunctionKind; + }; //---------------------------------------------------------------------- // String matching algorithm used by SBTarget //---------------------------------------------------------------------- - typedef enum MatchType { + enum MatchType + { eMatchTypeNormal, eMatchTypeRegex, eMatchTypeStartsWith - } MatchType; + }; //---------------------------------------------------------------------- // Bitmask that describes details about a type //---------------------------------------------------------------------- - typedef enum TypeFlags { + FLAGS_ENUM(TypeFlags) + { eTypeHasChildren = (1u << 0), eTypeHasValue = (1u << 1), eTypeIsArray = (1u << 2), @@ -920,17 +945,17 @@ namespace lldb { eTypeIsFloat = (1u << 19), eTypeIsComplex = (1u << 20), eTypeIsSigned = (1u << 21) - } TypeFlags; + }; //---------------------------------------------------------------------- // Whether a summary should cap how much data it returns to users or not //---------------------------------------------------------------------- - typedef enum TypeSummaryCapping { + enum TypeSummaryCapping + { eTypeSummaryCapped = true, eTypeSummaryUncapped = false - } TypeSummaryCapping; + }; } // namespace lldb - #endif // LLDB_lldb_enumerations_h_ diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index 946f3dd6fef..bfec946456c 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -811,7 +811,6 @@ File::Write (const void *buf, size_t &num_bytes, off_t &offset) if (!error.Fail()) SeekFromStart(cur); - ssize_t bytes_written = after - cur; offset = after; #endif } diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index 3bcd934aced..ff1ca7d10a2 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -704,7 +704,7 @@ int Socket::SetOption(int level, int option_name, int option_value) uint16_t Socket::GetLocalPortNumber(const NativeSocket& socket) { // We bound to port zero, so we need to figure out which port we actually bound to - if (socket >= 0) + if (socket != kInvalidSocketValue) { SocketAddress sock_addr; socklen_t sock_addr_len = sock_addr.GetMaxLength (); @@ -723,7 +723,7 @@ uint16_t Socket::GetLocalPortNumber() const std::string Socket::GetLocalIPAddress () const { // We bound to port zero, so we need to figure out which port we actually bound to - if (m_socket >= 0) + if (m_socket != kInvalidSocketValue) { SocketAddress sock_addr; socklen_t sock_addr_len = sock_addr.GetMaxLength (); @@ -735,7 +735,7 @@ std::string Socket::GetLocalIPAddress () const uint16_t Socket::GetRemotePortNumber () const { - if (m_socket >= 0) + if (m_socket != kInvalidSocketValue) { SocketAddress sock_addr; socklen_t sock_addr_len = sock_addr.GetMaxLength (); @@ -748,7 +748,7 @@ uint16_t Socket::GetRemotePortNumber () const std::string Socket::GetRemoteIPAddress () const { // We bound to port zero, so we need to figure out which port we actually bound to - if (m_socket >= 0) + if (m_socket != kInvalidSocketValue) { SocketAddress sock_addr; socklen_t sock_addr_len = sock_addr.GetMaxLength (); diff --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp index ca46eb0f744..9f3abb75e91 100644 --- a/lldb/source/Host/common/Terminal.cpp +++ b/lldb/source/Host/common/Terminal.cpp @@ -180,20 +180,18 @@ TerminalState::Save (int fd, bool save_process_group) bool TerminalState::Restore () const { +#ifndef LLDB_DISABLE_POSIX if (IsValid()) { const int fd = m_tty.GetFileDescriptor(); -#ifndef LLDB_DISABLE_POSIX if (TFlagsIsValid()) fcntl (fd, F_SETFL, m_tflags); -#endif #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED if (TTYStateIsValid()) tcsetattr (fd, TCSANOW, m_termios_ap.get()); #endif // #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED -#ifndef LLDB_DISABLE_POSIX if (ProcessGroupIsValid()) { // Save the original signal handler. @@ -204,9 +202,9 @@ TerminalState::Restore () const // Restore the original signal handler. signal (SIGTTOU, saved_sigttou_callback); } -#endif return true; } +#endif return false; } diff --git a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp index bbf315019aa..e2b23d0a0f5 100644 --- a/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp +++ b/lldb/source/Host/windows/ConnectionGenericFileWindows.cpp @@ -208,9 +208,9 @@ ConnectionGenericFile::Read(void *dst, size_t dst_len, uint32_t timeout_usec, ll TimeValue time_value; time_value.OffsetWithMicroSeconds(timeout_usec); DWORD milliseconds = time_value.milliseconds(); - result = ::WaitForMultipleObjects(llvm::array_lengthof(m_event_handles), m_event_handles, FALSE, milliseconds); + DWORD wait_result = ::WaitForMultipleObjects(llvm::array_lengthof(m_event_handles), m_event_handles, FALSE, milliseconds); // All of the events are manual reset events, so make sure we reset them to non-signalled. - switch (result) + switch (wait_result) { case WAIT_OBJECT_0 + kBytesAvailableEvent: break; diff --git a/lldb/source/Host/windows/EditLineWin.cpp b/lldb/source/Host/windows/EditLineWin.cpp index 6bd7e161cd0..8b5c2f2501b 100644 --- a/lldb/source/Host/windows/EditLineWin.cpp +++ b/lldb/source/Host/windows/EditLineWin.cpp @@ -194,7 +194,7 @@ el_gets (EditLine *el, int *length) { // print the prompt if we have one if ( _prompt != NULL ) - printf( _prompt ); + printf("%s", _prompt); // create a buffer for the user input char *buffer = new char[ MAX_PATH ]; // try to get user input string @@ -247,10 +247,10 @@ el_set (EditLine *el, int code, ...) // get the function pointer from the arg list void *func_vp = (void*)va_arg(vl, el_prompt_func); - char escape = (char)va_arg(vl, int); + va_arg(vl, int); // call to get the prompt as a string el_prompt_func func_fp = (el_prompt_func)func_vp; - const char *newPrompt = func_fp(el); + _prompt = func_fp(el); } break; diff --git a/lldb/source/Host/windows/HostProcessWindows.cpp b/lldb/source/Host/windows/HostProcessWindows.cpp index d8e407c667a..0f81c18d34a 100644 --- a/lldb/source/Host/windows/HostProcessWindows.cpp +++ b/lldb/source/Host/windows/HostProcessWindows.cpp @@ -120,7 +120,7 @@ HostProcessWindows::MonitorThread(void *thread_arg) MonitorInfo *info = static_cast<MonitorInfo *>(thread_arg); if (info) { - DWORD wait_result = ::WaitForSingleObject(info->process_handle, INFINITE); + ::WaitForSingleObject(info->process_handle, INFINITE); ::GetExitCodeProcess(info->process_handle, &exit_code); info->callback(info->baton, ::GetProcessId(info->process_handle), true, 0, exit_code); ::CloseHandle(info->process_handle); diff --git a/lldb/source/Host/windows/ThisThread.cpp b/lldb/source/Host/windows/ThisThread.cpp index 9c37d7c57e7..bcd5b8d1c1d 100644 --- a/lldb/source/Host/windows/ThisThread.cpp +++ b/lldb/source/Host/windows/ThisThread.cpp @@ -18,6 +18,8 @@ using namespace lldb; using namespace lldb_private; +#if defined(_MSC_VER) && !defined(__clang__) + namespace { static const DWORD MS_VC_EXCEPTION = 0x406D1388; @@ -33,19 +35,23 @@ struct THREADNAME_INFO #pragma pack(pop) } +#endif + void ThisThread::SetName(llvm::StringRef name) { // Other compilers don't yet support SEH, so we can only set the thread if compiling with MSVC. // TODO(zturner): Once clang-cl supports SEH, relax this conditional. -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__clang__) THREADNAME_INFO info; info.dwType = 0x1000; info.szName = name.data(); info.dwThreadId = ::GetCurrentThreadId(); info.dwFlags = 0; - __try { ::RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR *)&info); } + __try { + ::RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR *)&info); + } __except(EXCEPTION_EXECUTE_HANDLER) {} #endif } diff --git a/lldb/source/Host/windows/getopt/GetOptInc.cpp b/lldb/source/Host/windows/getopt/GetOptInc.cpp index 612fc9f8147..1101c621c90 100644 --- a/lldb/source/Host/windows/getopt/GetOptInc.cpp +++ b/lldb/source/Host/windows/getopt/GetOptInc.cpp @@ -5,6 +5,11 @@ #include <stdlib.h> #include <string.h> +#if defined(__clang__) && defined(_MSC_VER) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wwritable-strings" +#endif + int opterr = 1; /* if error message should be printed */ int optind = 1; /* index into parent argv vector */ int optopt = '?'; /* character checked for validity */ @@ -37,14 +42,6 @@ static char *place = EMSG; /* option letter processing */ static int nonopt_start = -1; /* first non option argument (for permute) */ static int nonopt_end = -1; /* first option after non options (for permute) */ -/* Error messages */ -static const char recargchar[] = "option requires an argument -- %c"; -static const char recargstring[] = "option requires an argument -- %s"; -static const char ambig[] = "ambiguous option -- %.*s"; -static const char noarg[] = "option doesn't take an argument -- %.*s"; -static const char illoptchar[] = "unknown option -- %c"; -static const char illoptstring[] = "unknown option -- %s"; - /* * Compute the greatest common divisor of a and b. */ @@ -467,3 +464,7 @@ const struct option *long_options, int *idx) return (getopt_internal(nargc, nargv, options, long_options, idx, FLAG_PERMUTE | FLAG_LONGONLY)); } + +#if defined(__clang__) && defined(_MSC_VER) +#pragma clang diagnostic pop +#endif
\ No newline at end of file diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index 5de3e9da781..c3883b81a19 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -1027,18 +1027,15 @@ CommandObject::AddIDsArgumentData(CommandArgumentEntry &arg, CommandArgumentType const char * CommandObject::GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type) { - if (arg_type >=0 && arg_type < eArgTypeLastArg) - return g_arguments_data[arg_type].arg_name; - return nullptr; - + assert(arg_type < eArgTypeLastArg && "Invalid argument type passed to GetArgumentTypeAsCString"); + return g_arguments_data[arg_type].arg_name; } const char * CommandObject::GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type) { - if (arg_type >=0 && arg_type < eArgTypeLastArg) - return g_arguments_data[arg_type].help_text; - return nullptr; + assert(arg_type < eArgTypeLastArg && "Invalid argument type passed to GetArgumentDescriptionAsCString"); + return g_arguments_data[arg_type].help_text; } Target * diff --git a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp index 72074d31a7d..489c289e330 100644 --- a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp +++ b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp @@ -269,7 +269,7 @@ ABISysV_hexagon::PrepareTrivialCall ( Thread &thread, #if HEX_ABI_DEBUG // print the original stack pointer - printf( "sp : %04lx \n", sp ); + printf( "sp : %04" PRIx64 " \n", sp ); #endif // make sure number of parameters matches prototype @@ -337,7 +337,7 @@ ABISysV_hexagon::PrepareTrivialCall ( Thread &thread, uint32_t data = 0; lldb::addr_t addr = sp + i * 4; proc->ReadMemory( addr, (void*)&data, sizeof( data ), error ); - printf( "\n0x%04lx 0x%08x ", addr, data ); + printf( "\n0x%04" PRIx64 " 0x%08x ", addr, data ); if ( i == 0 ) printf( "<<-- sp" ); } printf( "\n" ); diff --git a/lldb/source/Plugins/Process/Windows/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/DebuggerThread.cpp index 7021f785221..df75bf72206 100644 --- a/lldb/source/Plugins/Process/Windows/DebuggerThread.cpp +++ b/lldb/source/Plugins/Process/Windows/DebuggerThread.cpp @@ -79,7 +79,6 @@ DebuggerThread::DebuggerThreadRoutine(const ProcessLaunchInfo &launch_info) // Grab a shared_ptr reference to this so that we know it won't get deleted until after the // thread routine has exited. std::shared_ptr<DebuggerThread> this_ref(shared_from_this()); - Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); Error error; ProcessLauncherWindows launcher; diff --git a/lldb/source/Plugins/Process/Windows/LocalDebugDelegate.h b/lldb/source/Plugins/Process/Windows/LocalDebugDelegate.h index 11fa1a82904..8aade4d3e74 100644 --- a/lldb/source/Plugins/Process/Windows/LocalDebugDelegate.h +++ b/lldb/source/Plugins/Process/Windows/LocalDebugDelegate.h @@ -40,7 +40,7 @@ namespace lldb_private class LocalDebugDelegate : public IDebugDelegate { public: - explicit LocalDebugDelegate::LocalDebugDelegate(lldb::ProcessSP process); + explicit LocalDebugDelegate(lldb::ProcessSP process); virtual void OnExitProcess(uint32_t exit_code) override; virtual void OnDebuggerConnected(lldb::addr_t image_base) override; diff --git a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp index 7770b1470f3..f7cef048dca 100644 --- a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp @@ -56,8 +56,8 @@ class ProcessWindowsData { public: ProcessWindowsData(const ProcessLaunchInfo &launch_info) - : m_initial_stop_event(nullptr) - , m_launch_info(launch_info) + : m_launch_info(launch_info) + , m_initial_stop_event(nullptr) , m_initial_stop_received(false) { m_initial_stop_event = ::CreateEvent(nullptr, TRUE, FALSE, nullptr); @@ -335,7 +335,6 @@ ProcessWindows::RefreshStateAfterStop() BreakpointSiteSP site(GetBreakpointSiteList().FindByAddress(pc - 1)); if (site && site->ValidForThisThread(stop_thread.get())) { - lldb::break_id_t break_id = LLDB_INVALID_BREAK_ID; stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(*stop_thread, site->GetID()); register_context->SetPC(pc - 1); } @@ -394,7 +393,6 @@ void ProcessWindows::DidLaunch() { llvm::sys::ScopedLock lock(m_mutex); - StateType state = GetPrivateState(); // The initial stop won't broadcast the state change event, so account for that here. if (m_session_data && GetPrivateState() == eStateStopped && m_session_data->m_launch_info.GetFlags().Test(eLaunchFlagStopAtEntry)) @@ -558,7 +556,6 @@ ProcessWindows::OnDebugException(bool first_chance, const ExceptionRecord &recor } ExceptionResult result = ExceptionResult::SendToApplication; - lldb::StateType state = GetPrivateState(); switch (record.GetExceptionCode()) { case EXCEPTION_BREAKPOINT: diff --git a/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp b/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp index b57f33f0dd5..6cc60ee04a3 100644 --- a/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/TargetThreadWindows.cpp @@ -38,7 +38,7 @@ TargetThreadWindows::~TargetThreadWindows() void TargetThreadWindows::RefreshStateAfterStop() { - DWORD old_suspend_count = ::SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle()); + ::SuspendThread(m_host_thread.GetNativeThread().GetSystemHandle()); GetRegisterContext()->InvalidateIfNeeded(false); } diff --git a/lldb/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp b/lldb/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp index 46f76b66792..9051e9244b7 100644 --- a/lldb/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp +++ b/lldb/source/Plugins/Process/Windows/x86/RegisterContextWindows_x86.cpp @@ -93,8 +93,8 @@ RegisterSet g_register_sets[] = { //------------------------------------------------------------------ RegisterContextWindows_x86::RegisterContextWindows_x86(Thread &thread, uint32_t concrete_frame_idx) : RegisterContext(thread, concrete_frame_idx) - , m_context_stale(true) , m_context() + , m_context_stale(true) { } diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp index ae99f30a7c1..17a4a992e50 100644 --- a/lldb/source/Symbol/CompactUnwindInfo.cpp +++ b/lldb/source/Symbol/CompactUnwindInfo.cpp @@ -35,13 +35,15 @@ namespace lldb_private { // Constants from <mach-o/compact_unwind_encoding.h> - enum { + FLAGS_ANONYMOUS_ENUM() + { UNWIND_IS_NOT_FUNCTION_START = 0x80000000, UNWIND_HAS_LSDA = 0x40000000, UNWIND_PERSONALITY_MASK = 0x30000000, }; - enum { + FLAGS_ANONYMOUS_ENUM() + { UNWIND_X86_MODE_MASK = 0x0F000000, UNWIND_X86_MODE_EBP_FRAME = 0x01000000, UNWIND_X86_MODE_STACK_IMMD = 0x02000000, @@ -59,7 +61,8 @@ namespace lldb_private { UNWIND_X86_DWARF_SECTION_OFFSET = 0x00FFFFFF, }; - enum { + enum + { UNWIND_X86_REG_NONE = 0, UNWIND_X86_REG_EBX = 1, UNWIND_X86_REG_ECX = 2, @@ -68,7 +71,9 @@ namespace lldb_private { UNWIND_X86_REG_ESI = 5, UNWIND_X86_REG_EBP = 6, }; - enum { + + FLAGS_ANONYMOUS_ENUM() + { UNWIND_X86_64_MODE_MASK = 0x0F000000, UNWIND_X86_64_MODE_RBP_FRAME = 0x01000000, UNWIND_X86_64_MODE_STACK_IMMD = 0x02000000, @@ -86,7 +91,8 @@ namespace lldb_private { UNWIND_X86_64_DWARF_SECTION_OFFSET = 0x00FFFFFF, }; - enum { + enum + { UNWIND_X86_64_REG_NONE = 0, UNWIND_X86_64_REG_RBX = 1, UNWIND_X86_64_REG_R12 = 2, diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 0803ea14ba0..abf214b2bde 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -5091,7 +5091,6 @@ public: if (OpenPipes()) { const int read_fd = m_read_file.GetDescriptor(); - const int pipe_read_fd = m_pipe.GetReadFileDescriptor(); TerminalState terminal_state; terminal_state.Save (read_fd, false); Terminal terminal(read_fd); @@ -5099,6 +5098,7 @@ public: terminal.SetEcho(false); // FD_ZERO, FD_SET are not supported on windows #ifndef _WIN32 + const int pipe_read_fd = m_pipe.GetReadFileDescriptor(); while (!GetIsDone()) { fd_set read_fdset; diff --git a/lldb/source/Utility/PseudoTerminal.cpp b/lldb/source/Utility/PseudoTerminal.cpp index e728d4ab2a9..302c265783a 100644 --- a/lldb/source/Utility/PseudoTerminal.cpp +++ b/lldb/source/Utility/PseudoTerminal.cpp @@ -7,6 +7,7 @@ // //===----------------------------------------------------------------------===// +#include "lldb/Host/Config.h" #include "lldb/Utility/PseudoTerminal.h" #include <errno.h> @@ -237,12 +238,10 @@ PseudoTerminal::Fork (char *error_str, size_t error_len) { if (error_str) error_str[0] = '\0'; - pid_t pid = LLDB_INVALID_PROCESS_ID; +#if !defined(LLDB_DISABLE_POSIX) int flags = O_RDWR; -#if !defined(_MSC_VER) flags |= O_CLOEXEC; -#endif if (OpenFirstAvailableMaster (flags, error_str, error_len)) { // Successfully opened our master pseudo terminal @@ -300,6 +299,7 @@ PseudoTerminal::Fork (char *error_str, size_t error_len) // Do nothing and let the pid get returned! } } +#endif return pid; } |