diff options
37 files changed, 534 insertions, 371 deletions
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h index e632bb61036..0a32eee6448 100644 --- a/lldb/include/lldb/API/SBValue.h +++ b/lldb/include/lldb/API/SBValue.h @@ -44,6 +44,9 @@ public: const char * GetValue (const lldb::SBFrame &frame); + ValueType + GetValueType (); + bool GetValueDidChange (const lldb::SBFrame &frame); diff --git a/lldb/include/lldb/Core/Flags.h b/lldb/include/lldb/Core/Flags.h index 92452f3dfd0..e5702e45a6d 100644 --- a/lldb/include/lldb/Core/Flags.h +++ b/lldb/include/lldb/Core/Flags.h @@ -19,38 +19,45 @@ namespace lldb_private { //---------------------------------------------------------------------- /// @class Flags Flags.h "lldb/Core/Flags.h" -/// @brief A class to manage flag bits. +/// @brief A class to manage flags. /// -/// The Flags class does bits. +/// The Flags class managed flag bits and allows testing and +/// modification of individual or multiple flag bits. //---------------------------------------------------------------------- class Flags { public: //---------------------------------------------------------------------- - /// The value type for flag bits is a 32 bit unsigned integer type. + /// The value type for flags is a 32 bit unsigned integer type. //---------------------------------------------------------------------- typedef uint32_t ValueType; //---------------------------------------------------------------------- /// Construct with initial flag bit values. /// - /// Constructs this object with \a bits as the initial value for all - /// of the flag bits. + /// Constructs this object with \a mask as the initial value for all + /// of the flags. /// - /// @param[in] bits - /// The initial value for all flag bits. + /// @param[in] mask + /// The initial value for all flags. //---------------------------------------------------------------------- - Flags (ValueType bits = 0); + Flags (ValueType flags = 0) : + m_flags (flags) + { + } //---------------------------------------------------------------------- /// Copy constructor. /// - /// Construct and copy the flag bits from \a rhs. + /// Construct and copy the flags from \a rhs. /// /// @param[in] rhs /// A const Flags object reference to copy. //---------------------------------------------------------------------- - Flags (const Flags& rhs); + Flags (const Flags& rhs) : + m_flags(rhs.m_flags) + { + } //---------------------------------------------------------------------- /// Destructor. @@ -58,72 +65,150 @@ public: /// The destructor is virtual in case this class is subclassed. //---------------------------------------------------------------------- virtual - ~Flags (); + ~Flags () + { + } //---------------------------------------------------------------------- - /// Get accessor for all flag bits. + /// Get accessor for all flags. /// /// @return - /// Returns all of the flag bits as a Flags::ValueType. + /// Returns all of the flags as a Flags::ValueType. //---------------------------------------------------------------------- ValueType - GetAllFlagBits () const; + Get () const + { + return m_flags; + } + //---------------------------------------------------------------------- + /// Return the number of flags that can be represented in this + /// object. + /// + /// @return + /// The maximum number bits in this flag object. + //---------------------------------------------------------------------- size_t - GetBitSize() const; + GetBitSize() const + { + return sizeof (ValueType) * 8; + } //---------------------------------------------------------------------- - /// Set accessor for all flag bits. + /// Set accessor for all flags. /// - /// @param[in] bits - /// The bits with which to replace all of the current flag bits. + /// @param[in] flags + /// The bits with which to replace all of the current flags. //---------------------------------------------------------------------- void - SetAllFlagBits (ValueType bits); + Reset (ValueType flags) + { + m_flags = flags; + } //---------------------------------------------------------------------- - /// Clear one or more flag bits. + /// Clear one or more flags. /// - /// @param[in] bits - /// A bitfield containing one or more flag bits. + /// @param[in] mask + /// A bitfield containing one or more flags. /// /// @return - /// The new flag bits after clearing all bits from \a bits. + /// The new flags after clearing all bits from \a mask. //---------------------------------------------------------------------- ValueType - Clear (ValueType bits); + Clear (ValueType mask = ~(ValueType)0) + { + m_flags &= ~mask; + return m_flags; + } + //---------------------------------------------------------------------- - /// Set one or more flag bits. + /// Set one or more flags by logical OR'ing \a mask with the current + /// flags. /// - /// @param[in] bits - /// A bitfield containing one or more flag bits. + /// @param[in] mask + /// A bitfield containing one or more flags. /// /// @return - /// The new flag bits after setting all bits from \a bits. + /// The new flags after setting all bits from \a mask. //---------------------------------------------------------------------- ValueType - Set (ValueType bits); + Set (ValueType mask) + { + m_flags |= mask; + return m_flags; + } + //---------------------------------------------------------------------- - /// Test one or more flag bits. + /// Test if all bits in \a mask are 1 in the current flags /// /// @return - /// \b true if \b any flag bits in \a bits are set, \b false + /// \b true if all flags in \a mask are 1, \b false /// otherwise. //---------------------------------------------------------------------- bool - IsSet (ValueType bits) const; + AllSet (ValueType mask) const + { + return (m_flags & mask) == mask; + } //---------------------------------------------------------------------- - /// Test one or more flag bits. + /// Test one or more flags. /// /// @return - /// \b true if \b all flag bits in \a bits are clear, \b false + /// \b true if any flags in \a mask are 1, \b false /// otherwise. //---------------------------------------------------------------------- bool - IsClear (ValueType bits) const; + AnySet (ValueType mask) const + { + return (m_flags & mask) != 0; + } + + //---------------------------------------------------------------------- + /// Test a single flag bit. + /// + /// @return + /// \b true if \a bit is set, \b false otherwise. + //---------------------------------------------------------------------- + bool + Test (ValueType bit) const + { + return (m_flags & bit) != 0; + } + + //---------------------------------------------------------------------- + /// Test if all bits in \a mask are clear. + /// + /// @return + /// \b true if \b all flags in \a mask are clear, \b false + /// otherwise. + //---------------------------------------------------------------------- + bool + AllClear (ValueType mask) const + { + return (m_flags & mask) == 0; + } + + bool + AnyClear (ValueType mask) const + { + return (m_flags & mask) != mask; + } + + //---------------------------------------------------------------------- + /// Test a single flag bit to see if it is clear (zero). + /// + /// @return + /// \b true if \a bit is 0, \b false otherwise. + //---------------------------------------------------------------------- + bool + IsClear (ValueType bit) const + { + return (m_flags & bit) == 0; + } //---------------------------------------------------------------------- /// Get the number of zero bits in \a m_flags. @@ -132,7 +217,16 @@ public: /// The number of bits that are set to 0 in the current flags. //---------------------------------------------------------------------- size_t - ClearCount () const; + ClearCount () const + { + size_t count = 0; + for (ValueType shift = 0; shift < sizeof(ValueType)*8; ++shift) + { + if ((m_flags & (1u << shift)) == 0) + ++count; + } + return count; + } //---------------------------------------------------------------------- /// Get the number of one bits in \a m_flags. @@ -141,10 +235,19 @@ public: /// The number of bits that are set to 1 in the current flags. //---------------------------------------------------------------------- size_t - SetCount () const; + SetCount () const + { + size_t count = 0; + for (ValueType mask = m_flags; mask; mask >>= 1) + { + if (mask & 1u) + ++count; + } + return count; + } protected: - ValueType m_flags; ///< The flag bits. + ValueType m_flags; ///< The flags. }; } // namespace lldb_private diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index a26a332eeda..7267026b3da 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -300,6 +300,10 @@ protected: lldb::addr_t GetPointerValue (lldb::AddressType &address_type, bool scalar_is_load_address); + + lldb::addr_t + GetAddressOf (lldb::AddressType &address_type, + bool scalar_is_load_address); private: //------------------------------------------------------------------ // For ValueObject only diff --git a/lldb/include/lldb/Symbol/ClangASTContext.h b/lldb/include/lldb/Symbol/ClangASTContext.h index da8583d16be..4954dabdc4f 100644 --- a/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/lldb/include/lldb/Symbol/ClangASTContext.h @@ -326,7 +326,9 @@ public: // Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations static uint32_t - GetTypeInfoMask (lldb::clang_type_t clang_type); + GetTypeInfo (lldb::clang_type_t clang_type, + clang::ASTContext *ast_context, // The AST for clang_type (can be NULL) + lldb::clang_type_t *pointee_or_element_type); // (can be NULL) static uint32_t GetNumChildren (lldb::clang_type_t clang_type, @@ -564,6 +566,12 @@ public: static bool IsObjCClassType (lldb::clang_type_t clang_type); + static bool + IsCharType (lldb::clang_type_t clang_type); + + static size_t + GetArraySize (lldb::clang_type_t clang_type); + //static bool //ConvertFloatValueToString (clang::ASTContext *ast_context, // lldb::clang_type_t clang_type, diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index 8d6d4f32493..265e0dae6f7 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -127,7 +127,6 @@ 26D5B09E11B07550009A862E /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7910F1B85900F91463 /* Event.cpp */; }; 26D5B09F11B07550009A862E /* FileSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7A10F1B85900F91463 /* FileSpec.cpp */; }; 26D5B0A011B07550009A862E /* FileSpecList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */; }; - 26D5B0A111B07550009A862E /* Flags.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7C10F1B85900F91463 /* Flags.cpp */; }; 26D5B0A211B07550009A862E /* Language.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7D10F1B85900F91463 /* Language.cpp */; }; 26D5B0A311B07550009A862E /* Listener.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7E10F1B85900F91463 /* Listener.cpp */; }; 26D5B0A411B07550009A862E /* Log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26BC7E7F10F1B85900F91463 /* Log.cpp */; }; @@ -812,7 +811,6 @@ 26BC7E7910F1B85900F91463 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Event.cpp; path = source/Core/Event.cpp; sourceTree = "<group>"; }; 26BC7E7A10F1B85900F91463 /* FileSpec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileSpec.cpp; path = source/Core/FileSpec.cpp; sourceTree = "<group>"; }; 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileSpecList.cpp; path = source/Core/FileSpecList.cpp; sourceTree = "<group>"; }; - 26BC7E7C10F1B85900F91463 /* Flags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Flags.cpp; path = source/Core/Flags.cpp; sourceTree = "<group>"; }; 26BC7E7D10F1B85900F91463 /* Language.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Language.cpp; path = source/Core/Language.cpp; sourceTree = "<group>"; }; 26BC7E7E10F1B85900F91463 /* Listener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Listener.cpp; path = source/Core/Listener.cpp; sourceTree = "<group>"; }; 26BC7E7F10F1B85900F91463 /* Log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Log.cpp; path = source/Core/Log.cpp; sourceTree = "<group>"; }; @@ -1731,7 +1729,6 @@ 26BC7D6310F1B77400F91463 /* FileSpecList.h */, 26BC7E7B10F1B85900F91463 /* FileSpecList.cpp */, 26BC7D6410F1B77400F91463 /* Flags.h */, - 26BC7E7C10F1B85900F91463 /* Flags.cpp */, 9AA69DBB118A029E00D753A0 /* InputReader.h */, 9AA69DB5118A027A00D753A0 /* InputReader.cpp */, 26BC7D6510F1B77400F91463 /* IOStreamMacros.h */, @@ -2680,7 +2677,6 @@ 26D5B09E11B07550009A862E /* Event.cpp in Sources */, 26D5B09F11B07550009A862E /* FileSpec.cpp in Sources */, 26D5B0A011B07550009A862E /* FileSpecList.cpp in Sources */, - 26D5B0A111B07550009A862E /* Flags.cpp in Sources */, 26D5B0A211B07550009A862E /* Language.cpp in Sources */, 26D5B0A311B07550009A862E /* Listener.cpp in Sources */, 26D5B0A411B07550009A862E /* Log.cpp in Sources */, diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index 7f0cfc2c93d..ac818234389 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -138,6 +138,14 @@ SBValue::GetValue (const SBFrame &frame) return value_string; } +ValueType +SBValue::GetValueType () +{ + if (m_opaque_sp) + return m_opaque_sp->GetValueType(); + return eValueTypeInvalid; +} + const char * SBValue::GetObjectDescription (const SBFrame &frame) { diff --git a/lldb/source/Core/Flags.cpp b/lldb/source/Core/Flags.cpp deleted file mode 100644 index 13cbd85915b..00000000000 --- a/lldb/source/Core/Flags.cpp +++ /dev/null @@ -1,122 +0,0 @@ -//===-- Flags.cpp -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/Core/Flags.h" - -using namespace lldb_private; - -//---------------------------------------------------------------------- -// Default Constructor -//---------------------------------------------------------------------- -Flags::Flags (ValueType flags) : - m_flags(flags) -{ -} - -//---------------------------------------------------------------------- -// Copy Constructor -//---------------------------------------------------------------------- -Flags::Flags (const Flags& rhs) : - m_flags(rhs.m_flags) -{ -} - -//---------------------------------------------------------------------- -// Virtual destructor in case anyone inherits from this class. -//---------------------------------------------------------------------- -Flags::~Flags () -{ -} - -//---------------------------------------------------------------------- -// Get accessor for all of the current flag bits. -//---------------------------------------------------------------------- -Flags::ValueType -Flags::GetAllFlagBits () const -{ - return m_flags; -} - -size_t -Flags::GetBitSize() const -{ - return sizeof (ValueType) * 8; -} - -//---------------------------------------------------------------------- -// Set accessor for all of the current flag bits. -//---------------------------------------------------------------------- -void -Flags::SetAllFlagBits (ValueType flags) -{ - m_flags = flags; -} - -//---------------------------------------------------------------------- -// Clear one or more bits in our flag bits -//---------------------------------------------------------------------- -Flags::ValueType -Flags::Clear (ValueType bits) -{ - m_flags &= ~bits; - return m_flags; -} - -//---------------------------------------------------------------------- -// Set one or more bits in our flag bits -//---------------------------------------------------------------------- -Flags::ValueType -Flags::Set (ValueType bits) -{ - m_flags |= bits; - return m_flags; -} - -//---------------------------------------------------------------------- -// Returns true if any flag bits in "bits" are set -//---------------------------------------------------------------------- -bool -Flags::IsSet (ValueType bits) const -{ - return (m_flags & bits) != 0; -} - -//---------------------------------------------------------------------- -// Returns true if all flag bits in "bits" are clear -//---------------------------------------------------------------------- -bool -Flags::IsClear (ValueType bits) const -{ - return (m_flags & bits) == 0; -} - - -size_t -Flags::SetCount () const -{ - size_t count = 0; - for (ValueType mask = m_flags; mask; mask >>= 1) - { - if (mask & 1) - ++count; - } - return count; -} - -size_t -Flags::ClearCount () const -{ - size_t count = 0; - for (ValueType shift = 0; shift < sizeof(ValueType)*8; ++shift) - { - if ((m_flags & (1u << shift)) == 0) - ++count; - } - return count; -} diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp index 7bbbf4f11c3..a612b6500cf 100644 --- a/lldb/source/Core/Log.cpp +++ b/lldb/source/Core/Log.cpp @@ -91,29 +91,27 @@ Log::PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args) Mutex::Locker locker; - uint32_t log_options = m_options.GetAllFlagBits(); - // Lock the threaded logging mutex if we are doing thread safe logging - if (log_options & LLDB_LOG_OPTION_THREADSAFE) + if (m_options.Test (LLDB_LOG_OPTION_THREADSAFE)) locker.Reset(g_LogThreadedMutex.GetMutex()); // Add a sequence ID if requested - if (log_options & LLDB_LOG_OPTION_PREPEND_SEQUENCE) + if (m_options.Test (LLDB_LOG_OPTION_PREPEND_SEQUENCE)) header.Printf ("%u ", ++g_sequence_id); // Timestamp if requested - if (log_options & LLDB_LOG_OPTION_PREPEND_TIMESTAMP) + if (m_options.Test (LLDB_LOG_OPTION_PREPEND_TIMESTAMP)) { struct timeval tv = TimeValue::Now().GetAsTimeVal(); header.Printf ("%9llu.%6.6llu ", tv.tv_sec, tv.tv_usec); } // Add the process and thread if requested - if (log_options & LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD) + if (m_options.Test (LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD)) header.Printf ("[%4.4x/%4.4x]: ", getpid(), Host::GetCurrentThreadID()); // Add the process and thread if requested - if (log_options & LLDB_LOG_OPTION_PREPEND_THREAD_NAME) + if (m_options.Test (LLDB_LOG_OPTION_PREPEND_THREAD_NAME)) { const char *thread_name_str = Host::GetThreadName (getpid(), Host::GetCurrentThreadID()); if (thread_name_str) @@ -171,7 +169,7 @@ Log::PrintfWithFlags (uint32_t flags, const char *format, ...) void Log::Debug (const char *format, ...) { - if (GetOptions().IsSet(LLDB_LOG_OPTION_DEBUG)) + if (GetOptions().Test(LLDB_LOG_OPTION_DEBUG)) { va_list args; va_start (args, format); @@ -188,7 +186,7 @@ Log::Debug (const char *format, ...) void Log::DebugVerbose (const char *format, ...) { - if (GetOptions().IsSet(LLDB_LOG_OPTION_DEBUG) && GetOptions().IsSet(LLDB_LOG_OPTION_VERBOSE)) + if (GetOptions().AllSet (LLDB_LOG_OPTION_DEBUG | LLDB_LOG_OPTION_VERBOSE)) { va_list args; va_start (args, format); @@ -204,7 +202,7 @@ Log::DebugVerbose (const char *format, ...) void Log::LogIf (uint32_t bits, const char *format, ...) { - if ((bits & m_options.GetAllFlagBits()) == bits) + if (m_options.AllSet (bits)) { va_list args; va_start (args, format); @@ -262,7 +260,7 @@ Log::FatalError (int err, const char *format, ...) void Log::Verbose (const char *format, ...) { - if (m_options.IsSet(LLDB_LOG_OPTION_VERBOSE)) + if (m_options.Test(LLDB_LOG_OPTION_VERBOSE)) { va_list args; va_start (args, format); @@ -278,7 +276,7 @@ Log::Verbose (const char *format, ...) void Log::WarningVerbose (const char *format, ...) { - if (m_options.IsSet(LLDB_LOG_OPTION_VERBOSE)) + if (m_options.Test(LLDB_LOG_OPTION_VERBOSE)) { char *arg_msg = NULL; va_list args; diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index 3dae577c5c8..28935b2249c 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -248,7 +248,7 @@ Section::Dump (Stream *s, Target *target) const range.Dump (s, 0); } - s->Printf("%c 0x%8.8llx 0x%8.8llx 0x%8.8x ", resolved ? ' ' : '*', m_file_offset, m_file_size, GetAllFlagBits()); + s->Printf("%c 0x%8.8llx 0x%8.8llx 0x%8.8x ", resolved ? ' ' : '*', m_file_offset, m_file_size, Get()); DumpName (s); diff --git a/lldb/source/Core/Stream.cpp b/lldb/source/Core/Stream.cpp index 9beec35c8f7..f971a4178df 100644 --- a/lldb/source/Core/Stream.cpp +++ b/lldb/source/Core/Stream.cpp @@ -64,7 +64,7 @@ int Stream::PutSLEB128 (int64_t sval) { int bytes_written = 0; - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) { bool more = true; while (more) @@ -98,7 +98,7 @@ int Stream::PutULEB128 (uint64_t uval) { int bytes_written = 0; - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) { do { @@ -129,7 +129,7 @@ Stream::PutCString (const char *cstr) { int cstr_len = strlen(cstr); // when in binary mode, emit the NULL terminator - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) ++cstr_len; return Write (cstr, cstr_len); } @@ -212,7 +212,7 @@ Stream::PrintfVarArg (const char *format, va_list args) { va_end (args); // Include the NULL termination byte for binary output - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) length += 1; // The formatted string fit into our stack based buffer, so we can just // append that to our packet @@ -227,7 +227,7 @@ Stream::PrintfVarArg (const char *format, va_list args) if (str_ptr) { // Include the NULL termination byte for binary output - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) length += 1; bytes_written = Write (str_ptr, length); ::free (str_ptr); @@ -429,7 +429,7 @@ Stream::SetAddressByteSize(uint8_t addr_size) bool Stream::GetVerbose() const { - return m_flags.IsSet(eVerbose); + return m_flags.Test(eVerbose); } //------------------------------------------------------------------ @@ -438,7 +438,7 @@ Stream::GetVerbose() const bool Stream::GetDebug() const { - return m_flags.IsSet(eDebug); + return m_flags.Test(eDebug); } //------------------------------------------------------------------ @@ -512,7 +512,7 @@ Stream::PutNHex8 (size_t n, uint8_t uvalue) { int bytes_written = 0; for (size_t i=0; i<n; ++i) - bytes_written += _PutHex8 (uvalue, m_flags.IsSet(eAddPrefix)); + bytes_written += _PutHex8 (uvalue, m_flags.Test(eAddPrefix)); return bytes_written; } @@ -520,7 +520,7 @@ int Stream::_PutHex8 (uint8_t uvalue, bool add_prefix) { int bytes_written = 0; - if (m_flags.IsSet(eBinary)) + if (m_flags.Test(eBinary)) { bytes_written = Write (&uvalue, 1); } @@ -541,7 +541,7 @@ Stream::_PutHex8 (uint8_t uvalue, bool add_prefix) int Stream::PutHex8 (uint8_t uvalue) { - return _PutHex8 (uvalue, m_flags.IsSet(eAddPrefix)); + return _PutHex8 (uvalue, m_flags.Test(eAddPrefix)); } int @@ -550,7 +550,7 @@ Stream::PutHex16 (uint16_t uvalue, ByteOrder byte_order) if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; - bool add_prefix = m_flags.IsSet(eAddPrefix); + bool add_prefix = m_flags.Test(eAddPrefix); int bytes_written = 0; if (byte_order == eByteOrderLittle) { @@ -571,7 +571,7 @@ Stream::PutHex32(uint32_t uvalue, ByteOrder byte_order) if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; - bool add_prefix = m_flags.IsSet(eAddPrefix); + bool add_prefix = m_flags.Test(eAddPrefix); int bytes_written = 0; if (byte_order == eByteOrderLittle) { @@ -592,7 +592,7 @@ Stream::PutHex64(uint64_t uvalue, ByteOrder byte_order) if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; - bool add_prefix = m_flags.IsSet(eAddPrefix); + bool add_prefix = m_flags.Test(eAddPrefix); int bytes_written = 0; if (byte_order == eByteOrderLittle) { @@ -669,8 +669,9 @@ Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, By int bytes_written = 0; const uint8_t *src = (const uint8_t *)s; - bool binary_is_clear = m_flags.IsClear (eBinary); - m_flags.Set (eBinary); + bool binary_was_set = m_flags.Test (eBinary); + if (!binary_was_set) + m_flags.Set (eBinary); if (src_byte_order == dst_byte_order) { for (size_t i = 0; i < src_len; ++i) @@ -681,7 +682,7 @@ Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, By for (size_t i = src_len-1; i < src_len; --i) bytes_written += _PutHex8 (src[i], false); } - if (binary_is_clear) + if (!binary_was_set) m_flags.Clear (eBinary); return bytes_written; @@ -698,7 +699,7 @@ Stream::PutBytesAsRawHex8 (const void *s, size_t src_len, ByteOrder src_byte_ord int bytes_written = 0; const uint8_t *src = (const uint8_t *)s; - bool binary_is_set = m_flags.IsSet(eBinary); + bool binary_is_set = m_flags.Test(eBinary); m_flags.Clear(eBinary); if (src_byte_order == dst_byte_order) { @@ -720,7 +721,7 @@ int Stream::PutCStringAsRawHex8 (const char *s) { int bytes_written = 0; - bool binary_is_set = m_flags.IsSet(eBinary); + bool binary_is_set = m_flags.Test(eBinary); m_flags.Clear(eBinary); do { diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 4345eecea18..d10bf064c08 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -358,8 +358,8 @@ ValueObject::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int3 bool child_is_base_class = false; const bool transparent_pointers = synthetic_array_member == false; clang::ASTContext *clang_ast = GetClangAST(); - void *clang_type = GetClangType(); - void *child_clang_type; + clang_type_t clang_type = GetClangType(); + clang_type_t child_clang_type; child_clang_type = ClangASTContext::GetChildClangTypeAtIndex (clang_ast, GetName().AsCString(), clang_type, @@ -401,22 +401,38 @@ ValueObject::GetSummaryAsCString (ExecutionContextScope *exe_scope) { if (m_summary_str.empty()) { - void *clang_type = GetClangType(); + clang_type_t clang_type = GetClangType(); // See if this is a pointer to a C string? - uint32_t fixed_length = 0; if (clang_type) { StreamString sstr; + clang_type_t elem_or_pointee_clang_type; + const Flags type_flags (ClangASTContext::GetTypeInfo (clang_type, + GetClangAST(), + &elem_or_pointee_clang_type)); - if (ClangASTContext::IsCStringType (clang_type, fixed_length)) + if (type_flags.AnySet (ClangASTContext::eTypeIsArray | ClangASTContext::eTypeIsPointer) && + ClangASTContext::IsCharType (elem_or_pointee_clang_type)) { Process *process = exe_scope->CalculateProcess(); if (process != NULL) { + lldb::addr_t cstr_address = LLDB_INVALID_ADDRESS; lldb::AddressType cstr_address_type = eAddressTypeInvalid; - lldb::addr_t cstr_address = GetPointerValue (cstr_address_type, true); + size_t cstr_len = 0; + if (type_flags.Test (ClangASTContext::eTypeIsArray)) + { + // We have an array + cstr_len = ClangASTContext::GetArraySize (clang_type); + cstr_address = GetAddressOf (cstr_address_type, true); + } + else + { + // We have a pointer + cstr_address = GetPointerValue (cstr_address_type, true); + } if (cstr_address != LLDB_INVALID_ADDRESS) { DataExtractor data; @@ -425,14 +441,14 @@ ValueObject::GetSummaryAsCString (ExecutionContextScope *exe_scope) std::vector<char> cstr_buffer; size_t cstr_length; Error error; - if (fixed_length > 0) + if (cstr_len > 0) { - data_buffer.resize(fixed_length); + data_buffer.resize(cstr_len); // Resize the formatted buffer in case every character // uses the "\xXX" format and one extra byte for a NULL cstr_buffer.resize(data_buffer.size() * 4 + 1); data.SetData (&data_buffer.front(), data_buffer.size(), eByteOrderHost); - bytes_read = process->ReadMemory (cstr_address, &data_buffer.front(), fixed_length, error); + bytes_read = process->ReadMemory (cstr_address, &data_buffer.front(), cstr_len, error); if (bytes_read > 0) { sstr << '"'; @@ -590,7 +606,7 @@ ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope) case Value::eContextTypeDCType: case Value::eContextTypeDCVariable: { - void *clang_type = GetClangType (); + clang_type_t clang_type = GetClangType (); if (clang_type) { StreamString sstr; @@ -644,11 +660,37 @@ ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope) } addr_t +ValueObject::GetAddressOf (lldb::AddressType &address_type, bool scalar_is_load_address) +{ + switch (m_value.GetValueType()) + { + case Value::eValueTypeScalar: + if (scalar_is_load_address) + { + address_type = eAddressTypeLoad; + return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); + } + break; + + case Value::eValueTypeLoadAddress: + case Value::eValueTypeFileAddress: + case Value::eValueTypeHostAddress: + { + address_type = m_value.GetValueAddressType (); + return m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS); + } + break; + } + address_type = eAddressTypeInvalid; + return LLDB_INVALID_ADDRESS; +} + +addr_t ValueObject::GetPointerValue (lldb::AddressType &address_type, bool scalar_is_load_address) { lldb::addr_t address = LLDB_INVALID_ADDRESS; address_type = eAddressTypeInvalid; - switch (GetValue().GetValueType()) + switch (m_value.GetValueType()) { case Value::eValueTypeScalar: if (scalar_is_load_address) @@ -773,7 +815,7 @@ ValueObject::Write () lldb::LanguageType ValueObject::GetObjectRuntimeLanguage () { - void *opaque_qual_type = GetClangType(); + clang_type_t opaque_qual_type = GetClangType(); if (opaque_qual_type == NULL) return lldb::eLanguageTypeC; @@ -825,6 +867,8 @@ ValueObject::IsPointerType () return ClangASTContext::IsPointerType (GetClangType()); } + + bool ValueObject::IsPointerOrReferenceType () { @@ -909,7 +953,6 @@ ValueObject::GetExpressionPath (Stream &s) } } - void ValueObject::DumpValueObject ( @@ -929,13 +972,12 @@ ValueObject::DumpValueObject { if (valobj) { - //const char *loc_cstr = valobj->GetLocationAsCString(); clang_type_t clang_type = valobj->GetClangType(); - const Flags type_info_flags (ClangASTContext::GetTypeInfoMask (clang_type)); + const Flags type_flags (ClangASTContext::GetTypeInfo (clang_type, NULL, NULL)); const char *err_cstr = NULL; - const bool has_children = type_info_flags.IsSet (ClangASTContext::eTypeHasChildren); - const bool has_value = type_info_flags.IsSet (ClangASTContext::eTypeHasValue); + const bool has_children = type_flags.Test (ClangASTContext::eTypeHasChildren); + const bool has_value = type_flags.Test (ClangASTContext::eTypeHasValue); const bool print_valobj = flat_output == false || has_value; @@ -983,6 +1025,7 @@ ValueObject::DumpValueObject } else { + const bool is_ref = type_flags.Test (ClangASTContext::eTypeIsReference); if (print_valobj) { const char *sum_cstr = valobj->GetSummaryAsCString(exe_scope); @@ -1006,9 +1049,39 @@ ValueObject::DumpValueObject if (curr_depth < max_depth) { - bool is_ptr_or_ref = type_info_flags.IsSet (ClangASTContext::eTypeIsPointer | ClangASTContext::eTypeIsReference); + // We will show children for all concrete types. We won't show + // pointer contents unless a pointer depth has been specified. + // We won't reference contents unless the reference is the + // root object (depth of zero). + bool print_children = true; + + // Use a new temporary pointer depth in case we override the + // current pointer depth below... + uint32_t curr_ptr_depth = ptr_depth; + + const bool is_ptr = type_flags.Test (ClangASTContext::eTypeIsPointer); + if (is_ptr || is_ref) + { + // We have a pointer or reference whose value is an address. + // Make sure that address is not NULL + lldb::AddressType ptr_address_type; + if (valobj->GetPointerValue (ptr_address_type, true) == 0) + print_children = false; + + else if (is_ref && curr_depth == 0) + { + // If this is the root object (depth is zero) that we are showing + // and it is a reference, and no pointer depth has been supplied + // print out what it references. Don't do this at deeper depths + // otherwise we can end up with infinite recursion... + curr_ptr_depth = 1; + } + + if (curr_ptr_depth == 0) + print_children = false; + } - if (!is_ptr_or_ref || ptr_depth > 0) + if (print_children) { const uint32_t num_children = valobj->GetNumChildren(); if (num_children) @@ -1034,7 +1107,7 @@ ValueObject::DumpValueObject exe_scope, child_sp.get(), NULL, - is_ptr_or_ref ? ptr_depth - 1 : ptr_depth, + (is_ptr || is_ref) ? curr_ptr_depth - 1 : curr_ptr_depth, curr_depth + 1, max_depth, show_types, @@ -1055,7 +1128,7 @@ ValueObject::DumpValueObject { // Aggregate, no children... if (print_valobj) - s.PutCString("{}\n"); + s.PutCString(" {}\n"); } else { @@ -1066,8 +1139,6 @@ ValueObject::DumpValueObject } else { - // We printed a pointer, but we are stopping and not printing - // and children of this pointer... s.EOL(); } } diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp index 59b54e1a960..60f3e754a26 100644 --- a/lldb/source/Expression/ClangUserExpression.cpp +++ b/lldb/source/Expression/ClangUserExpression.cpp @@ -125,11 +125,12 @@ ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx) // ApplyObjcCastHack(m_expr_text); - ApplyUnicharHack(m_expr_text); + //ApplyUnicharHack(m_expr_text); if (m_cplusplus) { - m_transformed_stream.Printf("void \n" + m_transformed_stream.Printf("typedef unsigned short unichar; \n" + "void \n" "$__lldb_class::%s(void *$__lldb_arg) \n" "{ \n" " %s; \n" @@ -141,7 +142,8 @@ ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx) } else { - m_transformed_stream.Printf("void \n" + m_transformed_stream.Printf("typedef unsigned short unichar;\n" + "void \n" "%s(void *$__lldb_arg) \n" "{ \n" " %s; \n" diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp index e2db8dbbd87..df35ba98738 100644 --- a/lldb/source/Interpreter/CommandObject.cpp +++ b/lldb/source/Interpreter/CommandObject.cpp @@ -220,7 +220,7 @@ CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result) Process *process = m_interpreter.GetDebugger().GetExecutionContext().process; if (process == NULL) { - if (GetFlags().IsSet(CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused)) + if (GetFlags().AnySet (CommandObject::eFlagProcessMustBeLaunched | CommandObject::eFlagProcessMustBePaused)) { result.AppendError ("Process must exist."); result.SetStatus (eReturnStatusFailed); @@ -244,7 +244,7 @@ CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result) case eStateDetached: case eStateExited: case eStateUnloaded: - if (GetFlags().IsSet(CommandObject::eFlagProcessMustBeLaunched)) + if (GetFlags().Test(CommandObject::eFlagProcessMustBeLaunched)) { result.AppendError ("Process must be launched."); result.SetStatus (eReturnStatusFailed); @@ -254,7 +254,7 @@ CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result) case eStateRunning: case eStateStepping: - if (GetFlags().IsSet(CommandObject::eFlagProcessMustBePaused)) + if (GetFlags().Test(CommandObject::eFlagProcessMustBePaused)) { result.AppendError ("Process is running. Use 'process interrupt' to pause execution."); result.SetStatus (eReturnStatusFailed); diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp index 946c8f9310c..d59bcc638fe 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp @@ -44,7 +44,7 @@ DynamicLoaderMacOSXDYLDLog::GetLogIfAllCategoriesSet (uint32_t mask) Log *log = LogAccessor (true, NULL); if (log && mask) { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); + uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) return NULL; } diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index ddadd2cea01..51914f469b1 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -1049,7 +1049,7 @@ ObjectFileMachO::ParseSymtab (bool minimize) } else { - uint32_t section_type = symbol_section->GetAllFlagBits() & SectionFlagMaskSectionType; + uint32_t section_type = symbol_section->Get() & SectionFlagMaskSectionType; switch (section_type) { diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp index cfea47518ca..483cca2fd65 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachException.cpp @@ -367,7 +367,7 @@ MachException::Message::Reply(task_t task, pid_t pid, int signal) else err.Clear(); - if (log && log->GetMask().IsSet(PD_LOG_EXCEPTIONS) || err.Fail()) + if (log && log->GetMask().Test(PD_LOG_EXCEPTIONS) || err.Fail()) err.PutToLog(log, "::ptrace (request = PT_THUPDATE, pid = %i, tid = 0x%4.4x, signal = %i)", state_pid, state.thread_port, signal); } @@ -490,7 +490,7 @@ kern_return_t MachException::PortInfo::Restore (task_t task) { Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf("MachException::PortInfo::Restore (task = 0x%4.4x)", task); uint32_t i = 0; Error err; diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp index 97a0c494cfc..a315fddcc72 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachTask.cpp @@ -163,7 +163,7 @@ MachTask::ReadMemory (lldb::addr_t addr, void *buf, size_t size, Error& error) if (log) { log->Printf ("MachTask::ReadMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes read", (uint64_t)addr, size, buf, n); - if (log->GetMask().IsSet(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().IsSet(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) + if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) { DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4); data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8); @@ -189,7 +189,7 @@ MachTask::WriteMemory (lldb::addr_t addr, const void *buf, size_t size, Error& e if (log) { log->Printf ("MachTask::WriteMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes written", (uint64_t)addr, size, buf, n); - if (log->GetMask().IsSet(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().IsSet(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) + if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8)) { DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4); data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8); @@ -329,7 +329,7 @@ MachTask::BasicInfo(task_t task, struct task_basic_info *info) Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK); if (log || err.Fail()) err.PutToLog(log, "::task_info ( target_task = 0x%4.4x, flavor = TASK_BASIC_INFO, task_info_out => %p, task_info_outCnt => %u )", task, info, count); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE) && err.Success()) + if (log && log->GetMask().Test(PD_LOG_VERBOSE) && err.Success()) { float user = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f; float system = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f; diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp index 0e78cdc4d6d..5b724c9702c 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_i386.cpp @@ -142,7 +142,7 @@ MachThreadContext_i386::NotifyException (MachException::Data& exc) // rflags.Clear(trace_bit); // } // -// rflags_scalar = rflags.GetAllFlagBits(); +// rflags_scalar = rflags.Get(); // // If the code makes it here we have changes to the GPRs which // // we need to write back out, so lets do that. // if (reg_ctx->WriteRegisterValue(m_flags_reg, rflags_scalar)) diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp index 0dcbe746de4..3afcb221b3a 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachThreadContext_x86_64.cpp @@ -141,7 +141,7 @@ MachThreadContext_x86_64::NotifyException(MachException::Data& exc) // rflags.Clear(trace_bit); // } // -// rflags_scalar = rflags.GetAllFlagBits(); +// rflags_scalar = rflags.Get(); // // If the code makes it here we have changes to the GPRs which // // we need to write back out, so lets do that. // if (reg_ctx->WriteRegisterValue(m_flags_reg, rflags_scalar)) diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp index 87044fb31b2..fd8636f5786 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/MacOSX/MachVMRegion.cpp @@ -146,7 +146,7 @@ MachVMRegion::GetRegionForAddress(lldb::addr_t addr) } else { - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) { log->Printf("info = { prot = %u, " "max_prot = %u, " diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp index e1c1bcc2fae..96bb7d44e87 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp @@ -584,7 +584,7 @@ ProcessMacOSX::UpdateThreadListIfNeeded () { // locker will keep a mutex locked until it goes out of scope Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ProcessMacOSX::%s (pid = %4.4x)", __FUNCTION__, GetID()); const uint32_t stop_id = GetStopID(); diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h index 9a6e1499499..afbd9b3f1ae 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.h @@ -417,7 +417,7 @@ protected: bool ProcessUsingSpringBoard() const { - return m_flags.IsSet(eFlagsUsingSBS); + return m_flags.Test (eFlagsUsingSBS); } lldb_private::ArchSpec& diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp index fe3e6943445..1fcb9cce58c 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSXLog.cpp @@ -27,7 +27,7 @@ ProcessMacOSXLog::GetLogIfAllCategoriesSet (uint32_t mask) Log *log = g_log; if (log && mask) { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); + uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) return NULL; } @@ -84,8 +84,8 @@ ProcessMacOSXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args } if (flag_bits == 0) flag_bits = PD_LOG_DEFAULT; - g_log->GetMask().SetAllFlagBits(flag_bits); - g_log->GetOptions().SetAllFlagBits(log_options); + g_log->GetMask().Reset(flag_bits); + g_log->GetOptions().Reset(log_options); } return g_log; } diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp index 63c9dc591de..c400ef6eaee 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ThreadMacOSX.cpp @@ -249,7 +249,7 @@ int32_t ThreadMacOSX::Suspend() { Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__); lldb::tid_t tid = GetID (); if (ThreadIDIsValid(tid)) @@ -267,7 +267,7 @@ int32_t ThreadMacOSX::Resume() { Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ()", __FUNCTION__); lldb::tid_t tid = GetID (); if (ThreadIDIsValid(tid)) @@ -288,7 +288,7 @@ bool ThreadMacOSX::RestoreSuspendCount() { Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD); - if (log && log->GetMask().IsSet(PD_LOG_VERBOSE)) + if (log && log->GetMask().Test(PD_LOG_VERBOSE)) log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__); Error err; lldb::tid_t tid = GetID (); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index f47f1f2521c..6e2fe1c6847 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -397,6 +397,9 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) bool GDBRemoteRegisterContext::WriteAllRegisterValues (const lldb::DataBufferSP &data_sp) { + if (!data_sp || data_sp->GetBytes() == NULL || data_sp->GetByteSize() == 0) + return false; + GDBRemoteCommunication &gdb_comm = GetGDBProcess().GetGDBRemote(); StringExtractorGDBRemote response; Mutex::Locker locker; diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 5e99e9ce331..4fca6f06d13 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -949,7 +949,7 @@ ProcessGDBRemote::UpdateThreadListIfNeeded () { // locker will keep a mutex locked until it goes out of scope Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD); - if (log && log->GetMask().IsSet(GDBR_LOG_VERBOSE)) + if (log && log->GetMask().Test(GDBR_LOG_VERBOSE)) log->Printf ("ProcessGDBRemote::%s (pid = %i)", __FUNCTION__, GetID()); Mutex::Locker locker (m_thread_list.GetMutex ()); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp index b34df7bacb8..5a7348636e4 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp @@ -27,7 +27,7 @@ ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (uint32_t mask) Log *log = g_log; if (log && mask) { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); + uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) return NULL; } @@ -84,8 +84,8 @@ ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, A } if (flag_bits == 0) flag_bits = GDBR_LOG_DEFAULT; - g_log->GetMask().SetAllFlagBits(flag_bits); - g_log->GetOptions().SetAllFlagBits(log_options); + g_log->GetMask().Reset(flag_bits); + g_log->GetOptions().Reset(log_options); } return g_log; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp index b5c4f7ded44..fcad7d3eb02 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp @@ -908,7 +908,7 @@ static dw_offset_t DumpCallback const DWARFCompileUnit* cu = cu_sp.get(); Stream *s = dumpInfo->strm; - bool show_parents = s->GetFlags().IsSet(DWARFDebugInfo::eDumpFlag_ShowAncestors); + bool show_parents = s->GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowAncestors); if (die) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp index 3f77b0b71e5..7c7b65ad0c3 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -1098,7 +1098,7 @@ DWARFDebugInfoEntry::Dump { const DataExtractor& debug_info_data = dwarf2Data->get_debug_info_data(); uint32_t offset = m_offset; - bool english = s->GetFlags().IsSet (DWARFDebugInfo::eDumpFlag_EnglishyNames); + bool english = s->GetFlags().Test (DWARFDebugInfo::eDumpFlag_EnglishyNames); if (debug_info_data.ValidOffset(offset)) { @@ -1171,8 +1171,8 @@ DWARFDebugInfoEntry::DumpAttribute ) { bool verbose = s->GetVerbose(); - bool show_form = s->GetFlags().IsSet(DWARFDebugInfo::eDumpFlag_ShowForm); - bool english = s->GetFlags().IsSet(DWARFDebugInfo::eDumpFlag_EnglishyNames); + bool show_form = s->GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm); + bool english = s->GetFlags().Test(DWARFDebugInfo::eDumpFlag_EnglishyNames); const DataExtractor* debug_str_data = dwarf2Data ? &dwarf2Data->get_debug_str_data() : NULL; if (verbose) s->Offset(*offset_ptr); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp index 3aa7d65445b..22c2bf15021 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp @@ -156,8 +156,8 @@ LogChannelDWARF::Enable } if (flag_bits == 0) flag_bits = DWARF_LOG_DEFAULT; - m_log_sp->GetMask().SetAllFlagBits(flag_bits); - m_log_sp->GetOptions().SetAllFlagBits(log_options); + m_log_sp->GetMask().Reset(flag_bits); + m_log_sp->GetOptions().Reset(log_options); return m_log_sp.get() != NULL; } @@ -187,8 +187,10 @@ LogChannelDWARF::GetLogIfAll (uint32_t mask) { Log *log = GetLog(); if (log) - if (log->GetMask().IsSet(mask)) + { + if (log->GetMask().AllSet(mask)) return log; + } return NULL; } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index ae2bd033705..690d0618175 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1075,12 +1075,12 @@ SymbolFileDWARF::ParseChildMembers if (num_attributes > 0) { Declaration decl; - DWARFExpression location; + //DWARFExpression location; const char *name = NULL; bool is_artificial = false; lldb::user_id_t encoding_uid = LLDB_INVALID_UID; AccessType accessibility = eAccessNone; - off_t member_offset = 0; + //off_t member_offset = 0; size_t byte_size = 0; size_t bit_offset = 0; size_t bit_size = 0; @@ -1102,18 +1102,18 @@ SymbolFileDWARF::ParseChildMembers case DW_AT_bit_size: bit_size = form_value.Unsigned(); break; case DW_AT_byte_size: byte_size = form_value.Unsigned(); break; case DW_AT_data_member_location: - if (form_value.BlockData()) - { - Value initialValue(0); - Value memberOffset(0); - const DataExtractor& debug_info_data = get_debug_info_data(); - uint32_t block_length = form_value.Unsigned(); - uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); - if (DWARFExpression::Evaluate(NULL, NULL, debug_info_data, NULL, NULL, block_offset, block_length, eRegisterKindDWARF, &initialValue, memberOffset, NULL)) - { - member_offset = memberOffset.ResolveValue(NULL, NULL).UInt(); - } - } +// if (form_value.BlockData()) +// { +// Value initialValue(0); +// Value memberOffset(0); +// const DataExtractor& debug_info_data = get_debug_info_data(); +// uint32_t block_length = form_value.Unsigned(); +// uint32_t block_offset = form_value.BlockData() - debug_info_data.GetDataStart(); +// if (DWARFExpression::Evaluate(NULL, NULL, debug_info_data, NULL, NULL, block_offset, block_length, eRegisterKindDWARF, &initialValue, memberOffset, NULL)) +// { +// member_offset = memberOffset.ResolveValue(NULL, NULL).UInt(); +// } +// } break; case DW_AT_accessibility: accessibility = DW_ACCESS_to_AccessType (form_value.Unsigned()); break; @@ -1262,9 +1262,17 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type { // We have a struct/union/class/enum that needs to be fully resolved. const DWARFDebugInfoEntry* die = m_forward_decl_clang_type_to_die.lookup (ClangASTType::RemoveFastQualifiers(clang_type)); - assert (die); if (die == NULL) - return NULL; + { + // We have already resolved this type... + return clang_type; + } + // Once we start resolving this type, remove it from the forward declaration + // map in case anyone child members or other types require this type to get resolved. + // The type will get resolved when all of the calls to SymbolFileDWARF::ResolveClangOpaqueTypeDefinition + // are done. + m_forward_decl_clang_type_to_die.erase (ClangASTType::RemoveFastQualifiers(clang_type)); + DWARFDebugInfo* debug_info = DebugInfo(); diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 7a4d859f5c9..b536176a992 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -31,6 +31,7 @@ #undef NDEBUG #include "lldb/Core/dwarf.h" +#include "lldb/Core/Flags.h" #include <stdio.h> @@ -1652,10 +1653,18 @@ ClangASTContext::AddMethodToObjCObjectType uint32_t -ClangASTContext::GetTypeInfoMask (clang_type_t clang_type) +ClangASTContext::GetTypeInfo +( + clang_type_t clang_type, + clang::ASTContext *ast_context, + clang_type_t *pointee_or_element_clang_type +) { if (clang_type == NULL) - return false; + return 0; + + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = NULL; QualType qual_type (QualType::getFromOpaquePtr(clang_type)); @@ -1665,51 +1674,87 @@ ClangASTContext::GetTypeInfoMask (clang_type_t clang_type) case clang::Type::Builtin: switch (cast<clang::BuiltinType>(qual_type)->getKind()) { - default: - break; case clang::BuiltinType::ObjCId: case clang::BuiltinType::ObjCClass: - case clang::BuiltinType::ObjCSel: + if (ast_context && pointee_or_element_clang_type) + *pointee_or_element_clang_type = ast_context->ObjCBuiltinClassTy.getAsOpaquePtr(); return eTypeIsBuiltIn | eTypeIsPointer | eTypeHasValue; + + default: + break; } return eTypeIsBuiltIn | eTypeHasValue; - case clang::Type::BlockPointer: return eTypeIsPointer | eTypeHasChildren | eTypeIsBlock; + + case clang::Type::BlockPointer: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = qual_type->getPointeeType().getAsOpaquePtr(); + return eTypeIsPointer | eTypeHasChildren | eTypeIsBlock; + case clang::Type::Complex: return eTypeHasChildren | eTypeIsBuiltIn | eTypeHasValue; - case clang::Type::ConstantArray: return eTypeHasChildren | eTypeIsArray; + + case clang::Type::ConstantArray: + case clang::Type::DependentSizedArray: + case clang::Type::IncompleteArray: + case clang::Type::VariableArray: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = cast<ArrayType>(qual_type.getTypePtr())->getElementType().getAsOpaquePtr(); + return eTypeHasChildren | eTypeIsArray; + case clang::Type::DependentName: return 0; - case clang::Type::DependentSizedArray: return eTypeHasChildren | eTypeIsArray; case clang::Type::DependentSizedExtVector: return eTypeHasChildren | eTypeIsVector; case clang::Type::DependentTemplateSpecialization: return eTypeIsTemplate; case clang::Type::Decltype: return 0; - case clang::Type::Enum: return eTypeIsEnumeration | eTypeHasValue; + + case clang::Type::Enum: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = cast<EnumType>(qual_type)->getDecl()->getIntegerType().getAsOpaquePtr(); + return eTypeIsEnumeration | eTypeHasValue; + case clang::Type::Elaborated: return 0; case clang::Type::ExtVector: return eTypeHasChildren | eTypeIsVector; case clang::Type::FunctionProto: return eTypeIsFuncPrototype | eTypeHasValue; case clang::Type::FunctionNoProto: return eTypeIsFuncPrototype | eTypeHasValue; - case clang::Type::IncompleteArray: return eTypeHasChildren | eTypeIsArray; case clang::Type::InjectedClassName: return 0; - case clang::Type::LValueReference: return eTypeHasChildren | eTypeIsReference | eTypeHasValue; + + case clang::Type::LValueReference: + case clang::Type::RValueReference: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = cast<ReferenceType>(qual_type.getTypePtr())->getPointeeType().getAsOpaquePtr(); + return eTypeHasChildren | eTypeIsReference | eTypeHasValue; + case clang::Type::MemberPointer: return eTypeIsPointer | eTypeIsMember | eTypeHasValue; - case clang::Type::ObjCObjectPointer: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass | eTypeIsPointer | eTypeHasValue; + + case clang::Type::ObjCObjectPointer: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = qual_type->getPointeeType().getAsOpaquePtr(); + return eTypeHasChildren | eTypeIsObjC | eTypeIsClass | eTypeIsPointer | eTypeHasValue; + case clang::Type::ObjCObject: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass; case clang::Type::ObjCInterface: return eTypeHasChildren | eTypeIsObjC | eTypeIsClass; - case clang::Type::Pointer: return eTypeHasChildren | eTypeIsPointer | eTypeHasValue; + + case clang::Type::Pointer: + if (pointee_or_element_clang_type) + *pointee_or_element_clang_type = qual_type->getPointeeType().getAsOpaquePtr(); + return eTypeHasChildren | eTypeIsPointer | eTypeHasValue; + case clang::Type::Record: if (qual_type->getAsCXXRecordDecl()) return eTypeHasChildren | eTypeIsClass | eTypeIsCPlusPlus; else return eTypeHasChildren | eTypeIsStructUnion; break; - case clang::Type::RValueReference: return eTypeHasChildren | eTypeIsReference | eTypeHasValue; case clang::Type::SubstTemplateTypeParm: return eTypeIsTemplate; case clang::Type::TemplateTypeParm: return eTypeIsTemplate; case clang::Type::TemplateSpecialization: return eTypeIsTemplate; - case clang::Type::Typedef: return eTypeIsTypedef | - ClangASTContext::GetTypeInfoMask (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr()); + + case clang::Type::Typedef: + return eTypeIsTypedef | ClangASTContext::GetTypeInfo (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), + ast_context, + pointee_or_element_clang_type); + case clang::Type::TypeOfExpr: return 0; case clang::Type::TypeOf: return 0; case clang::Type::UnresolvedUsing: return 0; - case clang::Type::VariableArray: return eTypeHasChildren | eTypeIsArray; case clang::Type::Vector: return eTypeHasChildren | eTypeIsVector; default: return 0; } @@ -1767,10 +1812,10 @@ ClangASTContext::GetNumChildren (clang_type_t clang_qual_type, bool omit_empty_b case clang::Type::Builtin: switch (cast<clang::BuiltinType>(qual_type)->getKind()) { - case clang::BuiltinType::ObjCId: // Child is Class + case clang::BuiltinType::ObjCId: // child is Class case clang::BuiltinType::ObjCClass: // child is Class - case clang::BuiltinType::ObjCSel: // child is const char * num_children = 1; + break; default: break; @@ -1880,6 +1925,22 @@ ClangASTContext::GetNumChildren (clang_type_t clang_qual_type, bool omit_empty_b } break; + case clang::Type::LValueReference: + case clang::Type::RValueReference: + { + ReferenceType *reference_type = cast<ReferenceType>(qual_type.getTypePtr()); + QualType pointee_type = reference_type->getPointeeType(); + uint32_t num_pointee_children = ClangASTContext::GetNumChildren (pointee_type.getAsOpaquePtr(), + omit_empty_base_classes); + // If this type points to a simple type, then it has 1 child + if (num_pointee_children == 0) + num_children = 1; + else + num_children = num_pointee_children; + } + break; + + case clang::Type::Typedef: num_children = ClangASTContext::GetNumChildren (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), omit_empty_base_classes); break; @@ -1963,15 +2024,6 @@ ClangASTContext::GetChildClangTypeAtIndex child_byte_size = ast_context->getTypeSize(ast_context->ObjCBuiltinClassTy) / CHAR_BIT; return ast_context->ObjCBuiltinClassTy.getAsOpaquePtr(); - case clang::BuiltinType::ObjCSel: - { - QualType char_type(ast_context->CharTy); - char_type.addConst(); - child_byte_size = ast_context->getTypeSize(char_type); - return char_type.getAsOpaquePtr(); - } - break; - default: break; } @@ -2247,6 +2299,48 @@ ClangASTContext::GetChildClangTypeAtIndex } break; + case clang::Type::LValueReference: + case clang::Type::RValueReference: + { + ReferenceType *reference_type = cast<ReferenceType>(parent_qual_type.getTypePtr()); + QualType pointee_type(reference_type->getPointeeType()); + clang_type_t pointee_clang_type = pointee_type.getAsOpaquePtr(); + if (transparent_pointers && ClangASTContext::IsAggregateType (pointee_clang_type)) + { + return GetChildClangTypeAtIndex (ast_context, + parent_name, + pointee_clang_type, + idx, + transparent_pointers, + omit_empty_base_classes, + child_name, + child_byte_size, + child_byte_offset, + child_bitfield_bit_size, + child_bitfield_bit_offset, + child_is_base_class); + } + else + { + if (parent_name) + { + child_name.assign(1, '&'); + child_name += parent_name; + } + + // We have a pointer to an simple type + if (idx == 0) + { + std::pair<uint64_t, unsigned> clang_type_info = ast_context->getTypeInfo(pointee_type); + assert(clang_type_info.first % 8 == 0); + child_byte_size = clang_type_info.first / 8; + child_byte_offset = 0; + return pointee_type.getAsOpaquePtr(); + } + } + } + break; + case clang::Type::Typedef: return GetChildClangTypeAtIndex (ast_context, parent_name, @@ -3379,7 +3473,6 @@ ClangASTContext::IsPointerOrReferenceType (clang_type_t clang_type, clang_type_t break; case clang::BuiltinType::ObjCId: case clang::BuiltinType::ObjCClass: - case clang::BuiltinType::ObjCSel: return true; } return false; @@ -3451,7 +3544,6 @@ ClangASTContext::IsPointerType (clang_type_t clang_type, clang_type_t*target_typ break; case clang::BuiltinType::ObjCId: case clang::BuiltinType::ObjCClass: - case clang::BuiltinType::ObjCSel: return true; } return false; @@ -3564,67 +3656,43 @@ ClangASTContext::IsObjCClassType (clang_type_t clang_type) } - +bool +ClangASTContext::IsCharType (clang_type_t clang_type) +{ + if (clang_type) + return QualType::getFromOpaquePtr(clang_type)->isCharType(); + return false; +} bool ClangASTContext::IsCStringType (clang_type_t clang_type, uint32_t &length) { - if (clang_type) + clang_type_t pointee_or_element_clang_type = NULL; + Flags type_flags (ClangASTContext::GetTypeInfo (clang_type, NULL, &pointee_or_element_clang_type)); + + if (pointee_or_element_clang_type == NULL) + return false; + + if (type_flags.AnySet (eTypeIsArray | eTypeIsPointer)) { - QualType qual_type (QualType::getFromOpaquePtr(clang_type)); - const clang::Type::TypeClass type_class = qual_type->getTypeClass(); - switch (type_class) + QualType pointee_or_element_qual_type (QualType::getFromOpaquePtr (pointee_or_element_clang_type)); + + if (pointee_or_element_qual_type.getUnqualifiedType()->isCharType()) { - case clang::Type::ConstantArray: + QualType qual_type (QualType::getFromOpaquePtr(clang_type)); + if (type_flags.Test (eTypeIsArray)) { - ConstantArrayType *array = cast<ConstantArrayType>(qual_type.getTypePtr()); - QualType element_qual_type = array->getElementType(); - clang::Type *canonical_type = element_qual_type->getCanonicalTypeInternal().getTypePtr(); - if (canonical_type && canonical_type->isCharType()) - { - // We know the size of the array and it could be a C string - // since it is an array of characters - length = array->getSize().getLimitedValue(); - return true; - } + // We know the size of the array and it could be a C string + // since it is an array of characters + length = cast<ConstantArrayType>(qual_type.getTypePtr())->getSize().getLimitedValue(); + return true; } - break; - - case clang::Type::Pointer: + else { - PointerType *pointer_type = cast<PointerType>(qual_type.getTypePtr()); - clang::Type *pointee_type_ptr = pointer_type->getPointeeType().getTypePtr(); - if (pointee_type_ptr) - { - clang::Type *canonical_type_ptr = pointee_type_ptr->getCanonicalTypeInternal().getTypePtr(); - length = 0; // No length info, read until a NULL terminator is received - if (canonical_type_ptr) - return canonical_type_ptr->isCharType(); - else - return pointee_type_ptr->isCharType(); - } + length = 0; + return true; } - break; - case clang::Type::Typedef: - return ClangASTContext::IsCStringType (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), length); - - case clang::Type::LValueReference: - case clang::Type::RValueReference: - { - ReferenceType *reference_type = cast<ReferenceType>(qual_type.getTypePtr()); - clang::Type *pointee_type_ptr = reference_type->getPointeeType().getTypePtr(); - if (pointee_type_ptr) - { - clang::Type *canonical_type_ptr = pointee_type_ptr->getCanonicalTypeInternal().getTypePtr(); - length = 0; // No length info, read until a NULL terminator is received - if (canonical_type_ptr) - return canonical_type_ptr->isCharType(); - else - return pointee_type_ptr->isCharType(); - } - } - break; } } return false; @@ -3659,8 +3727,17 @@ ClangASTContext::IsFunctionPointerType (clang_type_t clang_type) return false; } - - +size_t +ClangASTContext::GetArraySize (clang_type_t clang_type) +{ + if (clang_type) + { + ConstantArrayType *array = cast<ConstantArrayType>(QualType::getFromOpaquePtr(clang_type).getTypePtr()); + if (array) + return array->getSize().getLimitedValue(); + } + return 0; +} bool ClangASTContext::IsArrayType (clang_type_t clang_type, clang_type_t*member_type, uint64_t *size) diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index dc7d514baf0..b41423e218c 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -542,16 +542,16 @@ lldb_private::Type::ResolveClangType (bool forward_decl_is_ok) if (encoding_type != NULL) { bool forward_decl_is_ok_for_encoding = forward_decl_is_ok; - switch (m_encoding_uid_type) - { - case eEncodingIsPointerUID: - case eEncodingIsLValueReferenceUID: - case eEncodingIsRValueReferenceUID: - forward_decl_is_ok_for_encoding = true; - break; - default: - break; - } +// switch (m_encoding_uid_type) +// { +// case eEncodingIsPointerUID: +// case eEncodingIsLValueReferenceUID: +// case eEncodingIsRValueReferenceUID: +// forward_decl_is_ok_for_encoding = true; +// break; +// default: +// break; +// } if (encoding_type->ResolveClangType (forward_decl_is_ok_for_encoding)) { diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index 2be00d659a1..2c45df149cc 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -239,7 +239,7 @@ StackFrame::ChangePC (addr_t pc) m_frame_code_addr.SetOffset(pc); m_frame_code_addr.SetSection(NULL); m_sc.Clear(); - m_flags.SetAllFlagBits(0); + m_flags.Reset(0); m_thread.ClearStackFrames (); } @@ -299,7 +299,7 @@ const SymbolContext& StackFrame::GetSymbolContext (uint32_t resolve_scope) { // Copy our internal symbol context into "sc". - if ((m_flags.GetAllFlagBits() & resolve_scope) != resolve_scope) + if ((m_flags.Get() & resolve_scope) != resolve_scope) { // Resolve our PC to section offset if we haven't alreday done so // and if we don't have a module. The resolved address section will diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp index 74e059fe642..92f78bbd14b 100644 --- a/lldb/source/Target/ThreadPlanStepInRange.cpp +++ b/lldb/source/Target/ThreadPlanStepInRange.cpp @@ -231,7 +231,7 @@ ThreadPlanStepInRange::DefaultShouldStopHereCallback (ThreadPlan *current_plan, StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get(); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP); - if (flags.IsSet(eAvoidNoDebug)) + if (flags.Test(eAvoidNoDebug)) { if (!frame->HasDebugInformation()) { diff --git a/lldb/source/lldb-log.cpp b/lldb/source/lldb-log.cpp index 1428383ead3..4d4f9f5851b 100644 --- a/lldb/source/lldb-log.cpp +++ b/lldb/source/lldb-log.cpp @@ -47,7 +47,7 @@ lldb_private::GetLogMask () { Log *log = LogAccessor (true, NULL); if (log) - return log->GetMask().GetAllFlagBits(); + return log->GetMask().Get(); return 0; } @@ -64,7 +64,7 @@ lldb_private::GetLogIfAllCategoriesSet (uint32_t mask) Log *log = LogAccessor (true, NULL); if (log && mask) { - uint32_t log_mask = log->GetMask().GetAllFlagBits(); + uint32_t log_mask = log->GetMask().Get(); if ((log_mask & mask) != mask) return NULL; } @@ -101,7 +101,7 @@ Log * lldb_private::GetLogIfAnyCategoriesSet (uint32_t mask) { Log *log = LogAccessor (true, NULL); - if (log && mask && (mask & log->GetMask().GetAllFlagBits())) + if (log && mask && (mask & log->GetMask().Get())) return log; return NULL; } @@ -121,7 +121,7 @@ lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &ar uint32_t flag_bits; Log* log = LogAccessor (true, NULL); if (log) - flag_bits = log->GetMask().GetAllFlagBits(); + flag_bits = log->GetMask().Get(); else flag_bits = 0; @@ -166,8 +166,8 @@ lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &ar } } - log->GetMask().SetAllFlagBits(flag_bits); - log->GetOptions().SetAllFlagBits(log_options); + log->GetMask().Reset(flag_bits); + log->GetOptions().Reset(log_options); } return log; } diff --git a/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj b/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj index 6c5d9738175..9cbe29e084b 100644 --- a/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj +++ b/lldb/tools/debugserver/debugserver.xcodeproj/project.pbxproj @@ -369,6 +369,7 @@ isa = PBXProject; buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */; compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( English, |