diff options
Diffstat (limited to 'lldb/source/Core')
42 files changed, 53 insertions, 1615 deletions
diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp index e03d721b566..01fedd7d095 100644 --- a/lldb/source/Core/AddressRange.cpp +++ b/lldb/source/Core/AddressRange.cpp @@ -9,9 +9,9 @@ #include "lldb/Core/AddressRange.h" #include "lldb/Core/Module.h" -#include "lldb/Core/Stream.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/AddressResolver.cpp b/lldb/source/Core/AddressResolver.cpp index 40f4d55340e..758703ff65f 100644 --- a/lldb/source/Core/AddressResolver.cpp +++ b/lldb/source/Core/AddressResolver.cpp @@ -15,10 +15,10 @@ #include "lldb/Core/Log.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/SearchFilter.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" using namespace lldb_private; diff --git a/lldb/source/Core/AddressResolverFileLine.cpp b/lldb/source/Core/AddressResolverFileLine.cpp index 939cf45f3e8..ff2994aa9bf 100644 --- a/lldb/source/Core/AddressResolverFileLine.cpp +++ b/lldb/source/Core/AddressResolverFileLine.cpp @@ -11,9 +11,9 @@ // Project includes #include "lldb/Core/Log.h" -#include "lldb/Core/StreamString.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/AddressResolverName.cpp b/lldb/source/Core/AddressResolverName.cpp index d9b6dad5e4e..6184c502dda 100644 --- a/lldb/source/Core/AddressResolverName.cpp +++ b/lldb/source/Core/AddressResolverName.cpp @@ -15,10 +15,10 @@ // Project includes #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" -#include "lldb/Core/StreamString.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp index cf7afb83dab..7db94cd53c4 100644 --- a/lldb/source/Core/ArchSpec.cpp +++ b/lldb/source/Core/ArchSpec.cpp @@ -24,7 +24,6 @@ // Project includes #include "Plugins/Process/Utility/ARMDefines.h" #include "Plugins/Process/Utility/InstructionUtils.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/StringList.h" #include "lldb/Host/Endian.h" #include "lldb/Host/HostInfo.h" @@ -33,6 +32,7 @@ #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/NameMatches.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/SafeMachO.h" using namespace lldb; diff --git a/lldb/source/Core/Baton.cpp b/lldb/source/Core/Baton.cpp index 998a5dffca9..db1027af1e6 100644 --- a/lldb/source/Core/Baton.cpp +++ b/lldb/source/Core/Baton.cpp @@ -13,7 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/Broadcaster.cpp b/lldb/source/Core/Broadcaster.cpp index d2cca7a2a65..dba64ac5fb1 100644 --- a/lldb/source/Core/Broadcaster.cpp +++ b/lldb/source/Core/Broadcaster.cpp @@ -16,7 +16,7 @@ #include "lldb/Core/Event.h" #include "lldb/Core/Listener.h" #include "lldb/Core/Log.h" -#include "lldb/Core/StreamString.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt index cf092537e6d..4af54914b9b 100644 --- a/lldb/source/Core/CMakeLists.txt +++ b/lldb/source/Core/CMakeLists.txt @@ -9,7 +9,6 @@ add_lldb_library(lldbCore Broadcaster.cpp Communication.cpp Connection.cpp - ConstString.cpp DataBufferHeap.cpp DataBufferMemoryMap.cpp DataEncoder.cpp @@ -18,7 +17,6 @@ add_lldb_library(lldbCore Disassembler.cpp DynamicLoader.cpp EmulateInstruction.cpp - Error.cpp Event.cpp FastDemangle.cpp FileLineResolver.cpp @@ -36,18 +34,15 @@ add_lldb_library(lldbCore Opcode.cpp PluginManager.cpp RegisterValue.cpp - RegularExpression.cpp Scalar.cpp SearchFilter.cpp Section.cpp SourceManager.cpp State.cpp - Stream.cpp StreamAsynchronousIO.cpp StreamCallback.cpp StreamFile.cpp StreamGDBRemote.cpp - StreamString.cpp StringList.cpp StructuredData.cpp Timer.cpp diff --git a/lldb/source/Core/ConstString.cpp b/lldb/source/Core/ConstString.cpp deleted file mode 100644 index 21b4d3d76f1..00000000000 --- a/lldb/source/Core/ConstString.cpp +++ /dev/null @@ -1,336 +0,0 @@ -//===-- ConstString.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/ConstString.h" - -// C Includes -// C++ Includes -#include <array> -#include <mutex> - -// Other libraries and framework includes -#include "llvm/ADT/StringExtras.h" -#include "llvm/ADT/StringMap.h" -#include "llvm/Support/RWMutex.h" - -// Project includes -#include "lldb/Core/Stream.h" - -using namespace lldb_private; - -class Pool { -public: - typedef const char *StringPoolValueType; - typedef llvm::StringMap<StringPoolValueType, llvm::BumpPtrAllocator> - StringPool; - typedef llvm::StringMapEntry<StringPoolValueType> StringPoolEntryType; - - static StringPoolEntryType & - GetStringMapEntryFromKeyData(const char *keyData) { - char *ptr = const_cast<char *>(keyData) - sizeof(StringPoolEntryType); - return *reinterpret_cast<StringPoolEntryType *>(ptr); - } - - size_t GetConstCStringLength(const char *ccstr) const { - if (ccstr != nullptr) { - const uint8_t h = hash(llvm::StringRef(ccstr)); - llvm::sys::SmartScopedReader<false> rlock(m_string_pools[h].m_mutex); - const StringPoolEntryType &entry = GetStringMapEntryFromKeyData(ccstr); - return entry.getKey().size(); - } - return 0; - } - - StringPoolValueType GetMangledCounterpart(const char *ccstr) const { - if (ccstr != nullptr) { - const uint8_t h = hash(llvm::StringRef(ccstr)); - llvm::sys::SmartScopedReader<false> rlock(m_string_pools[h].m_mutex); - return GetStringMapEntryFromKeyData(ccstr).getValue(); - } - return nullptr; - } - - bool SetMangledCounterparts(const char *key_ccstr, const char *value_ccstr) { - if (key_ccstr != nullptr && value_ccstr != nullptr) { - { - const uint8_t h = hash(llvm::StringRef(key_ccstr)); - llvm::sys::SmartScopedWriter<false> wlock(m_string_pools[h].m_mutex); - GetStringMapEntryFromKeyData(key_ccstr).setValue(value_ccstr); - } - { - const uint8_t h = hash(llvm::StringRef(value_ccstr)); - llvm::sys::SmartScopedWriter<false> wlock(m_string_pools[h].m_mutex); - GetStringMapEntryFromKeyData(value_ccstr).setValue(key_ccstr); - } - return true; - } - return false; - } - - const char *GetConstCString(const char *cstr) { - if (cstr != nullptr) - return GetConstCStringWithLength(cstr, strlen(cstr)); - return nullptr; - } - - const char *GetConstCStringWithLength(const char *cstr, size_t cstr_len) { - if (cstr != nullptr) - return GetConstCStringWithStringRef(llvm::StringRef(cstr, cstr_len)); - return nullptr; - } - - const char *GetConstCStringWithStringRef(const llvm::StringRef &string_ref) { - if (string_ref.data()) { - const uint8_t h = hash(string_ref); - - { - llvm::sys::SmartScopedReader<false> rlock(m_string_pools[h].m_mutex); - auto it = m_string_pools[h].m_string_map.find(string_ref); - if (it != m_string_pools[h].m_string_map.end()) - return it->getKeyData(); - } - - llvm::sys::SmartScopedWriter<false> wlock(m_string_pools[h].m_mutex); - StringPoolEntryType &entry = - *m_string_pools[h] - .m_string_map.insert(std::make_pair(string_ref, nullptr)) - .first; - return entry.getKeyData(); - } - return nullptr; - } - - const char * - GetConstCStringAndSetMangledCounterPart(const char *demangled_cstr, - const char *mangled_ccstr) { - if (demangled_cstr != nullptr) { - const char *demangled_ccstr = nullptr; - - { - llvm::StringRef string_ref(demangled_cstr); - const uint8_t h = hash(string_ref); - llvm::sys::SmartScopedWriter<false> wlock(m_string_pools[h].m_mutex); - - // Make string pool entry with the mangled counterpart already set - StringPoolEntryType &entry = - *m_string_pools[h] - .m_string_map.insert(std::make_pair(string_ref, mangled_ccstr)) - .first; - - // Extract the const version of the demangled_cstr - demangled_ccstr = entry.getKeyData(); - } - - { - // Now assign the demangled const string as the counterpart of the - // mangled const string... - const uint8_t h = hash(llvm::StringRef(mangled_ccstr)); - llvm::sys::SmartScopedWriter<false> wlock(m_string_pools[h].m_mutex); - GetStringMapEntryFromKeyData(mangled_ccstr).setValue(demangled_ccstr); - } - - // Return the constant demangled C string - return demangled_ccstr; - } - return nullptr; - } - - const char *GetConstTrimmedCStringWithLength(const char *cstr, - size_t cstr_len) { - if (cstr != nullptr) { - const size_t trimmed_len = std::min<size_t>(strlen(cstr), cstr_len); - return GetConstCStringWithLength(cstr, trimmed_len); - } - return nullptr; - } - - //------------------------------------------------------------------ - // Return the size in bytes that this object and any items in its - // collection of uniqued strings + data count values takes in - // memory. - //------------------------------------------------------------------ - size_t MemorySize() const { - size_t mem_size = sizeof(Pool); - for (const auto &pool : m_string_pools) { - llvm::sys::SmartScopedReader<false> rlock(pool.m_mutex); - for (const auto &entry : pool.m_string_map) - mem_size += sizeof(StringPoolEntryType) + entry.getKey().size(); - } - return mem_size; - } - -protected: - uint8_t hash(const llvm::StringRef &s) const { - uint32_t h = llvm::HashString(s); - return ((h >> 24) ^ (h >> 16) ^ (h >> 8) ^ h) & 0xff; - } - - struct PoolEntry { - mutable llvm::sys::SmartRWMutex<false> m_mutex; - StringPool m_string_map; - }; - - std::array<PoolEntry, 256> m_string_pools; -}; - -//---------------------------------------------------------------------- -// Frameworks and dylibs aren't supposed to have global C++ -// initializers so we hide the string pool in a static function so -// that it will get initialized on the first call to this static -// function. -// -// Note, for now we make the string pool a pointer to the pool, because -// we can't guarantee that some objects won't get destroyed after the -// global destructor chain is run, and trying to make sure no destructors -// touch ConstStrings is difficult. So we leak the pool instead. -//---------------------------------------------------------------------- -static Pool &StringPool() { - static std::once_flag g_pool_initialization_flag; - static Pool *g_string_pool = nullptr; - - std::call_once(g_pool_initialization_flag, - []() { g_string_pool = new Pool(); }); - - return *g_string_pool; -} - -ConstString::ConstString(const char *cstr) - : m_string(StringPool().GetConstCString(cstr)) {} - -ConstString::ConstString(const char *cstr, size_t cstr_len) - : m_string(StringPool().GetConstCStringWithLength(cstr, cstr_len)) {} - -ConstString::ConstString(const llvm::StringRef &s) - : m_string(StringPool().GetConstCStringWithLength(s.data(), s.size())) {} - -bool ConstString::operator<(const ConstString &rhs) const { - if (m_string == rhs.m_string) - return false; - - llvm::StringRef lhs_string_ref(m_string, - StringPool().GetConstCStringLength(m_string)); - llvm::StringRef rhs_string_ref( - rhs.m_string, StringPool().GetConstCStringLength(rhs.m_string)); - - // If both have valid C strings, then return the comparison - if (lhs_string_ref.data() && rhs_string_ref.data()) - return lhs_string_ref < rhs_string_ref; - - // Else one of them was nullptr, so if LHS is nullptr then it is less than - return lhs_string_ref.data() == nullptr; -} - -Stream &lldb_private::operator<<(Stream &s, const ConstString &str) { - const char *cstr = str.GetCString(); - if (cstr != nullptr) - s << cstr; - - return s; -} - -size_t ConstString::GetLength() const { - return StringPool().GetConstCStringLength(m_string); -} - -bool ConstString::Equals(const ConstString &lhs, const ConstString &rhs, - const bool case_sensitive) { - if (lhs.m_string == rhs.m_string) - return true; - - // Since the pointers weren't equal, and identical ConstStrings always have - // identical pointers, - // the result must be false for case sensitive equality test. - if (case_sensitive) - return false; - - // perform case insensitive equality test - llvm::StringRef lhs_string_ref( - lhs.m_string, StringPool().GetConstCStringLength(lhs.m_string)); - llvm::StringRef rhs_string_ref( - rhs.m_string, StringPool().GetConstCStringLength(rhs.m_string)); - return lhs_string_ref.equals_lower(rhs_string_ref); -} - -int ConstString::Compare(const ConstString &lhs, const ConstString &rhs, - const bool case_sensitive) { - // If the iterators are the same, this is the same string - const char *lhs_cstr = lhs.m_string; - const char *rhs_cstr = rhs.m_string; - if (lhs_cstr == rhs_cstr) - return 0; - if (lhs_cstr && rhs_cstr) { - llvm::StringRef lhs_string_ref( - lhs_cstr, StringPool().GetConstCStringLength(lhs_cstr)); - llvm::StringRef rhs_string_ref( - rhs_cstr, StringPool().GetConstCStringLength(rhs_cstr)); - - if (case_sensitive) { - return lhs_string_ref.compare(rhs_string_ref); - } else { - return lhs_string_ref.compare_lower(rhs_string_ref); - } - } - - if (lhs_cstr) - return +1; // LHS isn't nullptr but RHS is - else - return -1; // LHS is nullptr but RHS isn't -} - -void ConstString::Dump(Stream *s, const char *fail_value) const { - if (s != nullptr) { - const char *cstr = AsCString(fail_value); - if (cstr != nullptr) - s->PutCString(cstr); - } -} - -void ConstString::DumpDebug(Stream *s) const { - const char *cstr = GetCString(); - size_t cstr_len = GetLength(); - // Only print the parens if we have a non-nullptr string - const char *parens = cstr ? "\"" : ""; - s->Printf("%*p: ConstString, string = %s%s%s, length = %" PRIu64, - static_cast<int>(sizeof(void *) * 2), - static_cast<const void *>(this), parens, cstr, parens, - static_cast<uint64_t>(cstr_len)); -} - -void ConstString::SetCString(const char *cstr) { - m_string = StringPool().GetConstCString(cstr); -} - -void ConstString::SetString(const llvm::StringRef &s) { - m_string = StringPool().GetConstCStringWithLength(s.data(), s.size()); -} - -void ConstString::SetCStringWithMangledCounterpart(const char *demangled, - const ConstString &mangled) { - m_string = StringPool().GetConstCStringAndSetMangledCounterPart( - demangled, mangled.m_string); -} - -bool ConstString::GetMangledCounterpart(ConstString &counterpart) const { - counterpart.m_string = StringPool().GetMangledCounterpart(m_string); - return (bool)counterpart; -} - -void ConstString::SetCStringWithLength(const char *cstr, size_t cstr_len) { - m_string = StringPool().GetConstCStringWithLength(cstr, cstr_len); -} - -void ConstString::SetTrimmedCStringWithLength(const char *cstr, - size_t cstr_len) { - m_string = StringPool().GetConstTrimmedCStringWithLength(cstr, cstr_len); -} - -size_t ConstString::StaticMemorySize() { - // Get the size of the static string pool - return StringPool().MemorySize(); -} diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp index 70e8a394f69..5ea4b4f5a3a 100644 --- a/lldb/source/Core/DataBufferMemoryMap.cpp +++ b/lldb/source/Core/DataBufferMemoryMap.cpp @@ -46,11 +46,11 @@ // Project includes #include "lldb/Core/DataBufferMemoryMap.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Log.h" #include "lldb/Host/File.h" #include "lldb/Host/FileSpec.h" #include "lldb/Host/HostInfo.h" +#include "lldb/Utility/Error.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index fbc6e80bea0..01c94abbd24 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -32,8 +32,6 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Disassembler.h" #include "lldb/Core/Log.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/UUID.h" #include "lldb/Core/dwarf.h" #include "lldb/Host/Endian.h" @@ -42,6 +40,8 @@ #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index eb45c6df17e..420cb411eb9 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -28,7 +28,6 @@ #include "lldb/Core/StreamAsynchronousIO.h" #include "lldb/Core/StreamCallback.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/StructuredData.h" #include "lldb/Core/Timer.h" #include "lldb/Core/ValueObject.h" @@ -59,6 +58,7 @@ #include "lldb/Target/TargetList.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/AnsiTerminal.h" +#include "lldb/Utility/StreamString.h" #include "lldb/lldb-private.h" using namespace lldb; diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 7cac29491c8..c520fd4d30b 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -20,10 +20,8 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/EmulateInstruction.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/Timer.h" #include "lldb/Host/FileSystem.h" #include "lldb/Interpreter/OptionValue.h" @@ -39,6 +37,8 @@ #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/RegularExpression.h" #include "lldb/lldb-private.h" #define DEFAULT_DISASM_BYTE_SIZE 32 diff --git a/lldb/source/Core/EmulateInstruction.cpp b/lldb/source/Core/EmulateInstruction.cpp index bc32fb2f35e..1425a0c8bf1 100644 --- a/lldb/source/Core/EmulateInstruction.cpp +++ b/lldb/source/Core/EmulateInstruction.cpp @@ -17,17 +17,17 @@ // Project includes #include "lldb/Core/Address.h" #include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Error.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" #include "lldb/Host/Endian.h" #include "lldb/Symbol/UnwindPlan.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/Error.cpp b/lldb/source/Core/Error.cpp deleted file mode 100644 index 23696127d3b..00000000000 --- a/lldb/source/Core/Error.cpp +++ /dev/null @@ -1,336 +0,0 @@ -//===-- Error.cpp -----------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// C Includes -#ifdef __APPLE__ -#include <mach/mach.h> -#endif - -// C++ Includes -#include <cerrno> -#include <cstdarg> - -// Other libraries and framework includes -#include "llvm/ADT/SmallVector.h" - -// Project includes -#include "lldb/Core/Error.h" -#include "lldb/Core/Log.h" -#include "lldb/Host/PosixApi.h" - -using namespace lldb; -using namespace lldb_private; - -Error::Error() : m_code(0), m_type(eErrorTypeInvalid), m_string() {} - -Error::Error(ValueType err, ErrorType type) - : m_code(err), m_type(type), m_string() {} - -Error::Error(const Error &rhs) = default; - -Error::Error(const char *format, ...) - : m_code(0), m_type(eErrorTypeInvalid), m_string() { - va_list args; - va_start(args, format); - SetErrorToGenericError(); - SetErrorStringWithVarArg(format, args); - va_end(args); -} - -//---------------------------------------------------------------------- -// Assignment operator -//---------------------------------------------------------------------- -const Error &Error::operator=(const Error &rhs) { - if (this != &rhs) { - m_code = rhs.m_code; - m_type = rhs.m_type; - m_string = rhs.m_string; - } - return *this; -} - -//---------------------------------------------------------------------- -// Assignment operator -//---------------------------------------------------------------------- -const Error &Error::operator=(uint32_t err) { - m_code = err; - m_type = eErrorTypeMachKernel; - m_string.clear(); - return *this; -} - -Error::~Error() = default; - -//---------------------------------------------------------------------- -// Get the error value as a NULL C string. The error string will be -// fetched and cached on demand. The cached error string value will -// remain until the error value is changed or cleared. -//---------------------------------------------------------------------- -const char *Error::AsCString(const char *default_error_str) const { - if (Success()) - return nullptr; - - if (m_string.empty()) { - const char *s = nullptr; - switch (m_type) { - case eErrorTypeMachKernel: -#if defined(__APPLE__) - s = ::mach_error_string(m_code); -#endif - break; - - case eErrorTypePOSIX: - s = ::strerror(m_code); - break; - - default: - break; - } - if (s != nullptr) - m_string.assign(s); - } - if (m_string.empty()) { - if (default_error_str) - m_string.assign(default_error_str); - else - return nullptr; // User wanted a nullptr string back... - } - return m_string.c_str(); -} - -//---------------------------------------------------------------------- -// Clear the error and any cached error string that it might contain. -//---------------------------------------------------------------------- -void Error::Clear() { - m_code = 0; - m_type = eErrorTypeInvalid; - m_string.clear(); -} - -//---------------------------------------------------------------------- -// Access the error value. -//---------------------------------------------------------------------- -Error::ValueType Error::GetError() const { return m_code; } - -//---------------------------------------------------------------------- -// Access the error type. -//---------------------------------------------------------------------- -ErrorType Error::GetType() const { return m_type; } - -//---------------------------------------------------------------------- -// Returns true if this object contains a value that describes an -// error or otherwise non-success result. -//---------------------------------------------------------------------- -bool Error::Fail() const { return m_code != 0; } - -//---------------------------------------------------------------------- -// Log the error given a string with format. If the this object -// contains an error code, update the error string to contain the -// "error: " followed by the formatted string, followed by the error -// value and any string that describes the current error. This -// allows more context to be given to an error string that remains -// cached in this object. Logging always occurs even when the error -// code contains a non-error value. -//---------------------------------------------------------------------- -void Error::PutToLog(Log *log, const char *format, ...) { - char *arg_msg = nullptr; - va_list args; - va_start(args, format); - ::vasprintf(&arg_msg, format, args); - va_end(args); - - if (arg_msg != nullptr) { - if (Fail()) { - const char *err_str = AsCString(); - if (err_str == nullptr) - err_str = "???"; - - SetErrorStringWithFormat("error: %s err = %s (0x%8.8x)", arg_msg, err_str, - m_code); - if (log != nullptr) - log->Error("%s", m_string.c_str()); - } else { - if (log != nullptr) - log->Printf("%s err = 0x%8.8x", arg_msg, m_code); - } - ::free(arg_msg); - } -} - -//---------------------------------------------------------------------- -// Log the error given a string with format. If the this object -// contains an error code, update the error string to contain the -// "error: " followed by the formatted string, followed by the error -// value and any string that describes the current error. This -// allows more context to be given to an error string that remains -// cached in this object. Logging only occurs even when the error -// code contains a error value. -//---------------------------------------------------------------------- -void Error::LogIfError(Log *log, const char *format, ...) { - if (Fail()) { - char *arg_msg = nullptr; - va_list args; - va_start(args, format); - ::vasprintf(&arg_msg, format, args); - va_end(args); - - if (arg_msg != nullptr) { - const char *err_str = AsCString(); - if (err_str == nullptr) - err_str = "???"; - - SetErrorStringWithFormat("%s err = %s (0x%8.8x)", arg_msg, err_str, - m_code); - if (log != nullptr) - log->Error("%s", m_string.c_str()); - - ::free(arg_msg); - } - } -} - -//---------------------------------------------------------------------- -// Set accesssor for the error value to "err" and the type to -// "eErrorTypeMachKernel" -//---------------------------------------------------------------------- -void Error::SetMachError(uint32_t err) { - m_code = err; - m_type = eErrorTypeMachKernel; - m_string.clear(); -} - -void Error::SetExpressionError(lldb::ExpressionResults result, - const char *mssg) { - m_code = result; - m_type = eErrorTypeExpression; - m_string = mssg; -} - -int Error::SetExpressionErrorWithFormat(lldb::ExpressionResults result, - const char *format, ...) { - int length = 0; - - if (format != nullptr && format[0]) { - va_list args; - va_start(args, format); - length = SetErrorStringWithVarArg(format, args); - va_end(args); - } else { - m_string.clear(); - } - m_code = result; - m_type = eErrorTypeExpression; - return length; -} - -//---------------------------------------------------------------------- -// Set accesssor for the error value and type. -//---------------------------------------------------------------------- -void Error::SetError(ValueType err, ErrorType type) { - m_code = err; - m_type = type; - m_string.clear(); -} - -//---------------------------------------------------------------------- -// Update the error value to be "errno" and update the type to -// be "POSIX". -//---------------------------------------------------------------------- -void Error::SetErrorToErrno() { - m_code = errno; - m_type = eErrorTypePOSIX; - m_string.clear(); -} - -//---------------------------------------------------------------------- -// Update the error value to be LLDB_GENERIC_ERROR and update the type -// to be "Generic". -//---------------------------------------------------------------------- -void Error::SetErrorToGenericError() { - m_code = LLDB_GENERIC_ERROR; - m_type = eErrorTypeGeneric; - m_string.clear(); -} - -//---------------------------------------------------------------------- -// Set accessor for the error string value for a specific error. -// This allows any string to be supplied as an error explanation. -// The error string value will remain until the error value is -// cleared or a new error value/type is assigned. -//---------------------------------------------------------------------- -void Error::SetErrorString(llvm::StringRef err_str) { - if (!err_str.empty()) { - // If we have an error string, we should always at least have an error - // set to a generic value. - if (Success()) - SetErrorToGenericError(); - } - m_string = err_str; -} - -//------------------------------------------------------------------ -/// Set the current error string to a formatted error string. -/// -/// @param format -/// A printf style format string -//------------------------------------------------------------------ -int Error::SetErrorStringWithFormat(const char *format, ...) { - if (format != nullptr && format[0]) { - va_list args; - va_start(args, format); - int length = SetErrorStringWithVarArg(format, args); - va_end(args); - return length; - } else { - m_string.clear(); - } - return 0; -} - -int Error::SetErrorStringWithVarArg(const char *format, va_list args) { - if (format != nullptr && format[0]) { - // If we have an error string, we should always at least have - // an error set to a generic value. - if (Success()) - SetErrorToGenericError(); - - // Try and fit our error into a 1024 byte buffer first... - llvm::SmallVector<char, 1024> buf; - buf.resize(1024); - // Copy in case our first call to vsnprintf doesn't fit into our - // allocated buffer above - va_list copy_args; - va_copy(copy_args, args); - unsigned length = ::vsnprintf(buf.data(), buf.size(), format, args); - if (length >= buf.size()) { - // The error formatted string didn't fit into our buffer, resize it - // to the exact needed size, and retry - buf.resize(length + 1); - length = ::vsnprintf(buf.data(), buf.size(), format, copy_args); - va_end(copy_args); - assert(length < buf.size()); - } - m_string.assign(buf.data(), length); - va_end(args); - return length; - } else { - m_string.clear(); - } - return 0; -} - -//---------------------------------------------------------------------- -// Returns true if the error code in this object is considered a -// successful return value. -//---------------------------------------------------------------------- -bool Error::Success() const { return m_code == 0; } - -bool Error::WasInterrupted() const { - return (m_type == eErrorTypePOSIX && m_code == EINTR); -} diff --git a/lldb/source/Core/Event.cpp b/lldb/source/Core/Event.cpp index bd57198f548..5b1a0699925 100644 --- a/lldb/source/Core/Event.cpp +++ b/lldb/source/Core/Event.cpp @@ -18,9 +18,9 @@ #include "lldb/Core/Event.h" #include "lldb/Core/Log.h" #include "lldb/Core/State.h" -#include "lldb/Core/Stream.h" #include "lldb/Host/Endian.h" #include "lldb/Target/Process.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/FileLineResolver.cpp b/lldb/source/Core/FileLineResolver.cpp index db56cae9e9b..b8f2b98fccc 100644 --- a/lldb/source/Core/FileLineResolver.cpp +++ b/lldb/source/Core/FileLineResolver.cpp @@ -11,9 +11,9 @@ // Project includes #include "lldb/Core/Log.h" -#include "lldb/Core/StreamString.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/FileSpecList.cpp b/lldb/source/Core/FileSpecList.cpp index d4ce4b787aa..2f2713af336 100644 --- a/lldb/source/Core/FileSpecList.cpp +++ b/lldb/source/Core/FileSpecList.cpp @@ -15,7 +15,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" using namespace lldb_private; using namespace std; diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 08166d208ae..e2b246d6764 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -19,8 +19,6 @@ #include "lldb/Core/Address.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/DataFormatters/DataVisualization.h" @@ -45,6 +43,8 @@ #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" #include "lldb/Utility/AnsiTerminal.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/History.cpp b/lldb/source/Core/History.cpp index 0466a83da51..bf2e1eae162 100644 --- a/lldb/source/Core/History.cpp +++ b/lldb/source/Core/History.cpp @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/Listener.cpp b/lldb/source/Core/Listener.cpp index 3adb677f53d..b1910e12a42 100644 --- a/lldb/source/Core/Listener.cpp +++ b/lldb/source/Core/Listener.cpp @@ -18,7 +18,7 @@ #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Event.h" #include "lldb/Core/Log.h" -#include "lldb/Core/StreamString.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/Log.cpp b/lldb/source/Core/Log.cpp index 1329ea05917..a2ff2f2b711 100644 --- a/lldb/source/Core/Log.cpp +++ b/lldb/source/Core/Log.cpp @@ -11,11 +11,11 @@ #include "lldb/Core/Log.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/StreamFile.h" -#include "lldb/Core/StreamString.h" #include "lldb/Host/Host.h" #include "lldb/Host/ThisThread.h" #include "lldb/Interpreter/Args.h" #include "lldb/Utility/NameMatches.h" +#include "lldb/Utility/StreamString.h" // Other libraries and framework includes #include "llvm/ADT/SmallString.h" diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index c2c63b66563..d0951fae448 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -28,13 +28,13 @@ #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" #include "Plugins/Language/ObjC/ObjCLanguage.h" -#include "lldb/Core/ConstString.h" #include "lldb/Core/Log.h" #include "lldb/Core/Logging.h" #include "lldb/Core/Mangled.h" -#include "lldb/Core/RegularExpression.h" -#include "lldb/Core/Stream.h" #include "lldb/Core/Timer.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/Stream.h" #include <ctype.h> #include <stdlib.h> #include <string.h> diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index d36f7cea359..b92d2673a87 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -21,14 +21,11 @@ #include "lldb/Core/AddressResolverFileLine.h" #include "lldb/Core/DataBuffer.h" #include "lldb/Core/DataBufferHeap.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Log.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" -#include "lldb/Core/RegularExpression.h" #include "lldb/Core/Section.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/Timer.h" #include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" @@ -46,6 +43,9 @@ #include "lldb/Target/Process.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/StreamString.h" #include "Plugins/ObjectFile/JIT/ObjectFileJIT.h" diff --git a/lldb/source/Core/Opcode.cpp b/lldb/source/Core/Opcode.cpp index 11b913841ec..475f9434aad 100644 --- a/lldb/source/Core/Opcode.cpp +++ b/lldb/source/Core/Opcode.cpp @@ -18,8 +18,8 @@ #include "lldb/Core/ArchSpec.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Stream.h" #include "lldb/Host/Endian.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index b7b6b9a54ef..91d640d641d 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -22,11 +22,11 @@ // Project includes #include "lldb/Core/Debugger.h" -#include "lldb/Core/Error.h" #include "lldb/Host/FileSpec.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Interpreter/OptionValueProperties.h" +#include "lldb/Utility/Error.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/RegisterValue.cpp b/lldb/source/Core/RegisterValue.cpp index 2bc0b9dd474..af3a082c074 100644 --- a/lldb/source/Core/RegisterValue.cpp +++ b/lldb/source/Core/RegisterValue.cpp @@ -19,12 +19,12 @@ // Project includes #include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Error.h" #include "lldb/Core/Scalar.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" #include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/RegularExpression.cpp b/lldb/source/Core/RegularExpression.cpp deleted file mode 100644 index 54e0231556d..00000000000 --- a/lldb/source/Core/RegularExpression.cpp +++ /dev/null @@ -1,208 +0,0 @@ -//===-- RegularExpression.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/RegularExpression.h" - -// C Includes -// C++ Includes -#include <cstring> - -// Other libraries and framework includes -#include "llvm/ADT/StringRef.h" - -// Project includes -#include "lldb/Core/Error.h" - -//---------------------------------------------------------------------- -// Enable enhanced mode if it is available. This allows for things like -// \d for digit, \s for space, and many more, but it isn't available -// everywhere. -//---------------------------------------------------------------------- -#if defined(REG_ENHANCED) -#define DEFAULT_COMPILE_FLAGS (REG_ENHANCED | REG_EXTENDED) -#else -#define DEFAULT_COMPILE_FLAGS (REG_EXTENDED) -#endif - -using namespace lldb_private; - -RegularExpression::RegularExpression() : m_re(), m_comp_err(1), m_preg() { - memset(&m_preg, 0, sizeof(m_preg)); -} - -//---------------------------------------------------------------------- -// Constructor that compiles "re" using "flags" and stores the -// resulting compiled regular expression into this object. -//---------------------------------------------------------------------- -RegularExpression::RegularExpression(llvm::StringRef str) - : m_re(), m_comp_err(1), m_preg() { - memset(&m_preg, 0, sizeof(m_preg)); - Compile(str); -} - -RegularExpression::RegularExpression(const RegularExpression &rhs) { - memset(&m_preg, 0, sizeof(m_preg)); - Compile(rhs.GetText()); -} - -const RegularExpression &RegularExpression:: -operator=(const RegularExpression &rhs) { - if (&rhs != this) - Compile(rhs.GetText()); - return *this; -} - -//---------------------------------------------------------------------- -// Destructor -// -// Any previously compiled regular expression contained in this -// object will be freed. -//---------------------------------------------------------------------- -RegularExpression::~RegularExpression() { Free(); } - -//---------------------------------------------------------------------- -// Compile a regular expression using the supplied regular -// expression text and flags. The compiled regular expression lives -// in this object so that it can be readily used for regular -// expression matches. Execute() can be called after the regular -// expression is compiled. Any previously compiled regular -// expression contained in this object will be freed. -// -// RETURNS -// True if the regular expression compiles successfully, false -// otherwise. -//---------------------------------------------------------------------- -bool RegularExpression::Compile(llvm::StringRef str) { - Free(); - - if (!str.empty()) { - m_re = str; - m_comp_err = ::regcomp(&m_preg, m_re.c_str(), DEFAULT_COMPILE_FLAGS); - } else { - // No valid regular expression - m_comp_err = 1; - } - - return m_comp_err == 0; -} - -//---------------------------------------------------------------------- -// Execute a regular expression match using the compiled regular -// expression that is already in this object against the match -// string "s". If any parens are used for regular expression -// matches "match_count" should indicate the number of regmatch_t -// values that are present in "match_ptr". The regular expression -// will be executed using the "execute_flags". -//--------------------------------------------------------------------- -bool RegularExpression::Execute(llvm::StringRef str, Match *match) const { - int err = 1; - if (m_comp_err == 0) { - // Argument to regexec must be null-terminated. - std::string reg_str = str; - if (match) { - err = ::regexec(&m_preg, reg_str.c_str(), match->GetSize(), - match->GetData(), 0); - } else { - err = ::regexec(&m_preg, reg_str.c_str(), 0, nullptr, 0); - } - } - - if (err != 0) { - // The regular expression didn't compile, so clear the matches - if (match) - match->Clear(); - return false; - } - return true; -} - -bool RegularExpression::Match::GetMatchAtIndex(llvm::StringRef s, uint32_t idx, - std::string &match_str) const { - llvm::StringRef match_str_ref; - if (GetMatchAtIndex(s, idx, match_str_ref)) { - match_str = match_str_ref.str(); - return true; - } - return false; -} - -bool RegularExpression::Match::GetMatchAtIndex( - llvm::StringRef s, uint32_t idx, llvm::StringRef &match_str) const { - if (idx < m_matches.size()) { - if (m_matches[idx].rm_eo == -1 && m_matches[idx].rm_so == -1) - return false; - - if (m_matches[idx].rm_eo == m_matches[idx].rm_so) { - // Matched the empty string... - match_str = llvm::StringRef(); - return true; - } else if (m_matches[idx].rm_eo > m_matches[idx].rm_so) { - match_str = s.substr(m_matches[idx].rm_so, - m_matches[idx].rm_eo - m_matches[idx].rm_so); - return true; - } - } - return false; -} - -bool RegularExpression::Match::GetMatchSpanningIndices( - llvm::StringRef s, uint32_t idx1, uint32_t idx2, - llvm::StringRef &match_str) const { - if (idx1 < m_matches.size() && idx2 < m_matches.size()) { - if (m_matches[idx1].rm_so == m_matches[idx2].rm_eo) { - // Matched the empty string... - match_str = llvm::StringRef(); - return true; - } else if (m_matches[idx1].rm_so < m_matches[idx2].rm_eo) { - match_str = s.substr(m_matches[idx1].rm_so, - m_matches[idx2].rm_eo - m_matches[idx1].rm_so); - return true; - } - } - return false; -} - -//---------------------------------------------------------------------- -// Returns true if the regular expression compiled and is ready -// for execution. -//---------------------------------------------------------------------- -bool RegularExpression::IsValid() const { return m_comp_err == 0; } - -//---------------------------------------------------------------------- -// Returns the text that was used to compile the current regular -// expression. -//---------------------------------------------------------------------- -llvm::StringRef RegularExpression::GetText() const { return m_re; } - -//---------------------------------------------------------------------- -// Free any contained compiled regular expressions. -//---------------------------------------------------------------------- -void RegularExpression::Free() { - if (m_comp_err == 0) { - m_re.clear(); - regfree(&m_preg); - // Set a compile error since we no longer have a valid regex - m_comp_err = 1; - } -} - -size_t RegularExpression::GetErrorAsCString(char *err_str, - size_t err_str_max_len) const { - if (m_comp_err == 0) { - if (err_str && err_str_max_len) - *err_str = '\0'; - return 0; - } - - return ::regerror(m_comp_err, &m_preg, err_str, err_str_max_len); -} - -bool RegularExpression::operator<(const RegularExpression &rhs) const { - return (m_re < rhs.m_re); -} diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp index 2b99ec17b0a..29b76611699 100644 --- a/lldb/source/Core/Scalar.cpp +++ b/lldb/source/Core/Scalar.cpp @@ -20,11 +20,11 @@ // Project includes #include "lldb/Core/DataExtractor.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/Stream.h" #include "lldb/Host/Endian.h" #include "lldb/Host/StringConvert.h" #include "lldb/Interpreter/Args.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/Stream.h" #include "Plugins/Process/Utility/InstructionUtils.h" diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index 603fe571149..9293d67a115 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -16,14 +16,14 @@ #include "lldb/Core/DataBuffer.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Module.h" -#include "lldb/Core/RegularExpression.h" -#include "lldb/Core/Stream.h" #include "lldb/Host/FileSystem.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" #include "lldb/Utility/AnsiTerminal.h" +#include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/Stream.cpp b/lldb/source/Core/Stream.cpp deleted file mode 100644 index 8dbb8d21065..00000000000 --- a/lldb/source/Core/Stream.cpp +++ /dev/null @@ -1,612 +0,0 @@ -//===-- Stream.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/Stream.h" -#include "lldb/Host/Endian.h" -#include "lldb/Host/PosixApi.h" -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <inttypes.h> - -using namespace lldb; -using namespace lldb_private; - -Stream::Stream(uint32_t flags, uint32_t addr_size, ByteOrder byte_order) - : m_flags(flags), m_addr_size(addr_size), m_byte_order(byte_order), - m_indent_level(0) {} - -Stream::Stream() - : m_flags(0), m_addr_size(4), m_byte_order(endian::InlHostByteOrder()), - m_indent_level(0) {} - -//------------------------------------------------------------------ -// Destructor -//------------------------------------------------------------------ -Stream::~Stream() {} - -ByteOrder Stream::SetByteOrder(ByteOrder byte_order) { - ByteOrder old_byte_order = m_byte_order; - m_byte_order = byte_order; - return old_byte_order; -} - -//------------------------------------------------------------------ -// Put an offset "uval" out to the stream using the printf format -// in "format". -//------------------------------------------------------------------ -void Stream::Offset(uint32_t uval, const char *format) { Printf(format, uval); } - -//------------------------------------------------------------------ -// Put an SLEB128 "uval" out to the stream using the printf format -// in "format". -//------------------------------------------------------------------ -size_t Stream::PutSLEB128(int64_t sval) { - size_t bytes_written = 0; - if (m_flags.Test(eBinary)) { - bool more = true; - while (more) { - uint8_t byte = sval & 0x7fu; - sval >>= 7; - /* sign bit of byte is 2nd high order bit (0x40) */ - if ((sval == 0 && !(byte & 0x40)) || (sval == -1 && (byte & 0x40))) - more = false; - else - // more bytes to come - byte |= 0x80u; - bytes_written += Write(&byte, 1); - } - } else { - bytes_written = Printf("0x%" PRIi64, sval); - } - - return bytes_written; -} - -//------------------------------------------------------------------ -// Put an ULEB128 "uval" out to the stream using the printf format -// in "format". -//------------------------------------------------------------------ -size_t Stream::PutULEB128(uint64_t uval) { - size_t bytes_written = 0; - if (m_flags.Test(eBinary)) { - do { - - uint8_t byte = uval & 0x7fu; - uval >>= 7; - if (uval != 0) { - // more bytes to come - byte |= 0x80u; - } - bytes_written += Write(&byte, 1); - } while (uval != 0); - } else { - bytes_written = Printf("0x%" PRIx64, uval); - } - return bytes_written; -} - -//------------------------------------------------------------------ -// Print a raw NULL terminated C string to the stream. -//------------------------------------------------------------------ -size_t Stream::PutCString(llvm::StringRef str) { - size_t bytes_written = 0; - bytes_written = Write(str.data(), str.size()); - - // when in binary mode, emit the NULL terminator - if (m_flags.Test(eBinary)) - bytes_written += PutChar('\0'); - return bytes_written; -} - -//------------------------------------------------------------------ -// Print a double quoted NULL terminated C string to the stream -// using the printf format in "format". -//------------------------------------------------------------------ -void Stream::QuotedCString(const char *cstr, const char *format) { - Printf(format, cstr); -} - -//------------------------------------------------------------------ -// Put an address "addr" out to the stream with optional prefix -// and suffix strings. -//------------------------------------------------------------------ -void Stream::Address(uint64_t addr, uint32_t addr_size, const char *prefix, - const char *suffix) { - if (prefix == NULL) - prefix = ""; - if (suffix == NULL) - suffix = ""; - // int addr_width = m_addr_size << 1; - // Printf ("%s0x%0*" PRIx64 "%s", prefix, addr_width, addr, suffix); - Printf("%s0x%0*" PRIx64 "%s", prefix, addr_size * 2, (uint64_t)addr, suffix); -} - -//------------------------------------------------------------------ -// Put an address range out to the stream with optional prefix -// and suffix strings. -//------------------------------------------------------------------ -void Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, - uint32_t addr_size, const char *prefix, - const char *suffix) { - if (prefix && prefix[0]) - PutCString(prefix); - Address(lo_addr, addr_size, "["); - Address(hi_addr, addr_size, "-", ")"); - if (suffix && suffix[0]) - PutCString(suffix); -} - -size_t Stream::PutChar(char ch) { return Write(&ch, 1); } - -//------------------------------------------------------------------ -// Print some formatted output to the stream. -//------------------------------------------------------------------ -size_t Stream::Printf(const char *format, ...) { - va_list args; - va_start(args, format); - size_t result = PrintfVarArg(format, args); - va_end(args); - return result; -} - -//------------------------------------------------------------------ -// Print some formatted output to the stream. -//------------------------------------------------------------------ -size_t Stream::PrintfVarArg(const char *format, va_list args) { - char str[1024]; - va_list args_copy; - - va_copy(args_copy, args); - - size_t bytes_written = 0; - // Try and format our string into a fixed buffer first and see if it fits - size_t length = ::vsnprintf(str, sizeof(str), format, args); - if (length < sizeof(str)) { - // Include the NULL termination byte for binary output - 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 - bytes_written = Write(str, length); - } else { - // Our stack buffer wasn't big enough to contain the entire formatted - // string, so lets let vasprintf create the string for us! - char *str_ptr = NULL; - length = ::vasprintf(&str_ptr, format, args_copy); - if (str_ptr) { - // Include the NULL termination byte for binary output - if (m_flags.Test(eBinary)) - length += 1; - bytes_written = Write(str_ptr, length); - ::free(str_ptr); - } - } - va_end(args_copy); - return bytes_written; -} - -//------------------------------------------------------------------ -// Print and End of Line character to the stream -//------------------------------------------------------------------ -size_t Stream::EOL() { return PutChar('\n'); } - -//------------------------------------------------------------------ -// Indent the current line using the current indentation level and -// print an optional string following the indentation spaces. -//------------------------------------------------------------------ -size_t Stream::Indent(const char *s) { - return Printf("%*.*s%s", m_indent_level, m_indent_level, "", s ? s : ""); -} - -size_t Stream::Indent(llvm::StringRef str) { - return Printf("%*.*s%s", m_indent_level, m_indent_level, "", str.str().c_str()); -} - -//------------------------------------------------------------------ -// Stream a character "ch" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(char ch) { - PutChar(ch); - return *this; -} - -//------------------------------------------------------------------ -// Stream the NULL terminated C string out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(const char *s) { - Printf("%s", s); - return *this; -} - -Stream &Stream::operator<<(llvm::StringRef str) { - Write(str.data(), str.size()); - return *this; -} - -//------------------------------------------------------------------ -// Stream the pointer value out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(const void *p) { - Printf("0x%.*tx", (int)sizeof(const void *) * 2, (ptrdiff_t)p); - return *this; -} - -//------------------------------------------------------------------ -// Stream a uint8_t "uval" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(uint8_t uval) { - PutHex8(uval); - return *this; -} - -//------------------------------------------------------------------ -// Stream a uint16_t "uval" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(uint16_t uval) { - PutHex16(uval, m_byte_order); - return *this; -} - -//------------------------------------------------------------------ -// Stream a uint32_t "uval" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(uint32_t uval) { - PutHex32(uval, m_byte_order); - return *this; -} - -//------------------------------------------------------------------ -// Stream a uint64_t "uval" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(uint64_t uval) { - PutHex64(uval, m_byte_order); - return *this; -} - -//------------------------------------------------------------------ -// Stream a int8_t "sval" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(int8_t sval) { - Printf("%i", (int)sval); - return *this; -} - -//------------------------------------------------------------------ -// Stream a int16_t "sval" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(int16_t sval) { - Printf("%i", (int)sval); - return *this; -} - -//------------------------------------------------------------------ -// Stream a int32_t "sval" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(int32_t sval) { - Printf("%i", (int)sval); - return *this; -} - -//------------------------------------------------------------------ -// Stream a int64_t "sval" out to this stream. -//------------------------------------------------------------------ -Stream &Stream::operator<<(int64_t sval) { - Printf("%" PRIi64, sval); - return *this; -} - -//------------------------------------------------------------------ -// Get the current indentation level -//------------------------------------------------------------------ -int Stream::GetIndentLevel() const { return m_indent_level; } - -//------------------------------------------------------------------ -// Set the current indentation level -//------------------------------------------------------------------ -void Stream::SetIndentLevel(int indent_level) { m_indent_level = indent_level; } - -//------------------------------------------------------------------ -// Increment the current indentation level -//------------------------------------------------------------------ -void Stream::IndentMore(int amount) { m_indent_level += amount; } - -//------------------------------------------------------------------ -// Decrement the current indentation level -//------------------------------------------------------------------ -void Stream::IndentLess(int amount) { - if (m_indent_level >= amount) - m_indent_level -= amount; - else - m_indent_level = 0; -} - -//------------------------------------------------------------------ -// Get the address size in bytes -//------------------------------------------------------------------ -uint32_t Stream::GetAddressByteSize() const { return m_addr_size; } - -//------------------------------------------------------------------ -// Set the address size in bytes -//------------------------------------------------------------------ -void Stream::SetAddressByteSize(uint32_t addr_size) { m_addr_size = addr_size; } - -//------------------------------------------------------------------ -// The flags get accessor -//------------------------------------------------------------------ -Flags &Stream::GetFlags() { return m_flags; } - -//------------------------------------------------------------------ -// The flags const get accessor -//------------------------------------------------------------------ -const Flags &Stream::GetFlags() const { return m_flags; } - -//------------------------------------------------------------------ -// The byte order get accessor -//------------------------------------------------------------------ - -lldb::ByteOrder Stream::GetByteOrder() const { return m_byte_order; } - -size_t Stream::PrintfAsRawHex8(const char *format, ...) { - va_list args; - va_list args_copy; - va_start(args, format); - va_copy(args_copy, args); // Copy this so we - - char str[1024]; - size_t bytes_written = 0; - // Try and format our string into a fixed buffer first and see if it fits - size_t length = ::vsnprintf(str, sizeof(str), format, args); - if (length < sizeof(str)) { - // The formatted string fit into our stack based buffer, so we can just - // append that to our packet - for (size_t i = 0; i < length; ++i) - bytes_written += _PutHex8(str[i], false); - } else { - // Our stack buffer wasn't big enough to contain the entire formatted - // string, so lets let vasprintf create the string for us! - char *str_ptr = NULL; - length = ::vasprintf(&str_ptr, format, args_copy); - if (str_ptr) { - for (size_t i = 0; i < length; ++i) - bytes_written += _PutHex8(str_ptr[i], false); - ::free(str_ptr); - } - } - va_end(args); - va_end(args_copy); - - return bytes_written; -} - -size_t Stream::PutNHex8(size_t n, uint8_t uvalue) { - size_t bytes_written = 0; - for (size_t i = 0; i < n; ++i) - bytes_written += _PutHex8(uvalue, false); - return bytes_written; -} - -size_t Stream::_PutHex8(uint8_t uvalue, bool add_prefix) { - size_t bytes_written = 0; - if (m_flags.Test(eBinary)) { - bytes_written = Write(&uvalue, 1); - } else { - if (add_prefix) - PutCString("0x"); - - static char g_hex_to_ascii_hex_char[16] = {'0', '1', '2', '3', '4', '5', - '6', '7', '8', '9', 'a', 'b', - 'c', 'd', 'e', 'f'}; - char nibble_chars[2]; - nibble_chars[0] = g_hex_to_ascii_hex_char[(uvalue >> 4) & 0xf]; - nibble_chars[1] = g_hex_to_ascii_hex_char[(uvalue >> 0) & 0xf]; - bytes_written = Write(nibble_chars, sizeof(nibble_chars)); - } - return bytes_written; -} - -size_t Stream::PutHex8(uint8_t uvalue) { return _PutHex8(uvalue, false); } - -size_t Stream::PutHex16(uint16_t uvalue, ByteOrder byte_order) { - if (byte_order == eByteOrderInvalid) - byte_order = m_byte_order; - - size_t bytes_written = 0; - if (byte_order == eByteOrderLittle) { - for (size_t byte = 0; byte < sizeof(uvalue); ++byte) - bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false); - } else { - for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue); --byte) - bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false); - } - return bytes_written; -} - -size_t Stream::PutHex32(uint32_t uvalue, ByteOrder byte_order) { - if (byte_order == eByteOrderInvalid) - byte_order = m_byte_order; - - size_t bytes_written = 0; - if (byte_order == eByteOrderLittle) { - for (size_t byte = 0; byte < sizeof(uvalue); ++byte) - bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false); - } else { - for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue); --byte) - bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false); - } - return bytes_written; -} - -size_t Stream::PutHex64(uint64_t uvalue, ByteOrder byte_order) { - if (byte_order == eByteOrderInvalid) - byte_order = m_byte_order; - - size_t bytes_written = 0; - if (byte_order == eByteOrderLittle) { - for (size_t byte = 0; byte < sizeof(uvalue); ++byte) - bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false); - } else { - for (size_t byte = sizeof(uvalue) - 1; byte < sizeof(uvalue); --byte) - bytes_written += _PutHex8((uint8_t)(uvalue >> (byte * 8)), false); - } - return bytes_written; -} - -size_t Stream::PutMaxHex64(uint64_t uvalue, size_t byte_size, - lldb::ByteOrder byte_order) { - switch (byte_size) { - case 1: - return PutHex8((uint8_t)uvalue); - case 2: - return PutHex16((uint16_t)uvalue); - case 4: - return PutHex32((uint32_t)uvalue); - case 8: - return PutHex64(uvalue); - } - return 0; -} - -size_t Stream::PutPointer(void *ptr) { - return PutRawBytes(&ptr, sizeof(ptr), endian::InlHostByteOrder(), - endian::InlHostByteOrder()); -} - -size_t Stream::PutFloat(float f, ByteOrder byte_order) { - if (byte_order == eByteOrderInvalid) - byte_order = m_byte_order; - - return PutRawBytes(&f, sizeof(f), endian::InlHostByteOrder(), byte_order); -} - -size_t Stream::PutDouble(double d, ByteOrder byte_order) { - if (byte_order == eByteOrderInvalid) - byte_order = m_byte_order; - - return PutRawBytes(&d, sizeof(d), endian::InlHostByteOrder(), byte_order); -} - -size_t Stream::PutLongDouble(long double ld, ByteOrder byte_order) { - if (byte_order == eByteOrderInvalid) - byte_order = m_byte_order; - - return PutRawBytes(&ld, sizeof(ld), endian::InlHostByteOrder(), byte_order); -} - -size_t Stream::PutRawBytes(const void *s, size_t src_len, - ByteOrder src_byte_order, ByteOrder dst_byte_order) { - if (src_byte_order == eByteOrderInvalid) - src_byte_order = m_byte_order; - - if (dst_byte_order == eByteOrderInvalid) - dst_byte_order = m_byte_order; - - size_t bytes_written = 0; - const uint8_t *src = (const uint8_t *)s; - 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) - bytes_written += _PutHex8(src[i], false); - } else { - for (size_t i = src_len - 1; i < src_len; --i) - bytes_written += _PutHex8(src[i], false); - } - if (!binary_was_set) - m_flags.Clear(eBinary); - - return bytes_written; -} - -size_t Stream::PutBytesAsRawHex8(const void *s, size_t src_len, - ByteOrder src_byte_order, - ByteOrder dst_byte_order) { - if (src_byte_order == eByteOrderInvalid) - src_byte_order = m_byte_order; - - if (dst_byte_order == eByteOrderInvalid) - dst_byte_order = m_byte_order; - - size_t bytes_written = 0; - const uint8_t *src = (const uint8_t *)s; - bool binary_is_set = m_flags.Test(eBinary); - m_flags.Clear(eBinary); - if (src_byte_order == dst_byte_order) { - for (size_t i = 0; i < src_len; ++i) - bytes_written += _PutHex8(src[i], false); - } else { - for (size_t i = src_len - 1; i < src_len; --i) - bytes_written += _PutHex8(src[i], false); - } - if (binary_is_set) - m_flags.Set(eBinary); - - return bytes_written; -} - -size_t Stream::PutCStringAsRawHex8(const char *s) { - size_t bytes_written = 0; - bool binary_is_set = m_flags.Test(eBinary); - m_flags.Clear(eBinary); - do { - bytes_written += _PutHex8(*s, false); - ++s; - } while (*s); - if (binary_is_set) - m_flags.Set(eBinary); - return bytes_written; -} - -void Stream::UnitTest(Stream *s) { - s->PutHex8(0x12); - - s->PutChar(' '); - s->PutHex16(0x3456, endian::InlHostByteOrder()); - s->PutChar(' '); - s->PutHex16(0x3456, eByteOrderBig); - s->PutChar(' '); - s->PutHex16(0x3456, eByteOrderLittle); - - s->PutChar(' '); - s->PutHex32(0x789abcde, endian::InlHostByteOrder()); - s->PutChar(' '); - s->PutHex32(0x789abcde, eByteOrderBig); - s->PutChar(' '); - s->PutHex32(0x789abcde, eByteOrderLittle); - - s->PutChar(' '); - s->PutHex64(0x1122334455667788ull, endian::InlHostByteOrder()); - s->PutChar(' '); - s->PutHex64(0x1122334455667788ull, eByteOrderBig); - s->PutChar(' '); - s->PutHex64(0x1122334455667788ull, eByteOrderLittle); - - const char *hola = "Hello World!!!"; - s->PutChar(' '); - s->PutCString(hola); - - s->PutChar(' '); - s->Write(hola, 5); - - s->PutChar(' '); - s->PutCStringAsRawHex8(hola); - - s->PutChar(' '); - s->PutCStringAsRawHex8("01234"); - - s->PutChar(' '); - s->Printf("pid=%i", 12733); - - s->PutChar(' '); - s->PrintfAsRawHex8("pid=%i", 12733); - s->PutChar('\n'); -} diff --git a/lldb/source/Core/StreamFile.cpp b/lldb/source/Core/StreamFile.cpp index f8c7fb9a84d..3d22fc13263 100644 --- a/lldb/source/Core/StreamFile.cpp +++ b/lldb/source/Core/StreamFile.cpp @@ -14,7 +14,7 @@ // C++ Includes // Other libraries and framework includes // Project includes -#include "lldb/Core/Error.h" +#include "lldb/Utility/Error.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/StreamString.cpp b/lldb/source/Core/StreamString.cpp deleted file mode 100644 index 461648815f1..00000000000 --- a/lldb/source/Core/StreamString.cpp +++ /dev/null @@ -1,65 +0,0 @@ -//===-- StreamString.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/StreamString.h" -#include <stdio.h> - -using namespace lldb; -using namespace lldb_private; - -StreamString::StreamString() : Stream(0, 4, eByteOrderBig) {} - -StreamString::StreamString(uint32_t flags, uint32_t addr_size, - ByteOrder byte_order) - : Stream(flags, addr_size, byte_order), m_packet() {} - -StreamString::~StreamString() {} - -void StreamString::Flush() { - // Nothing to do when flushing a buffer based stream... -} - -size_t StreamString::Write(const void *s, size_t length) { - m_packet.append(reinterpret_cast<const char *>(s), length); - return length; -} - -void StreamString::Clear() { m_packet.clear(); } - -bool StreamString::Empty() const { return GetSize() == 0; } - -size_t StreamString::GetSize() const { return m_packet.size(); } - -size_t StreamString::GetSizeOfLastLine() const { - const size_t length = m_packet.size(); - size_t last_line_begin_pos = m_packet.find_last_of("\r\n"); - if (last_line_begin_pos == std::string::npos) { - return length; - } else { - ++last_line_begin_pos; - return length - last_line_begin_pos; - } -} - -llvm::StringRef StreamString::GetString() const { return m_packet; } - -void StreamString::FillLastLineToColumn(uint32_t column, char fill_char) { - const size_t length = m_packet.size(); - size_t last_line_begin_pos = m_packet.find_last_of("\r\n"); - if (last_line_begin_pos == std::string::npos) { - last_line_begin_pos = 0; - } else { - ++last_line_begin_pos; - } - - const size_t line_columns = length - last_line_begin_pos; - if (column > line_columns) { - m_packet.append(column - line_columns, fill_char); - } -} diff --git a/lldb/source/Core/StringList.cpp b/lldb/source/Core/StringList.cpp index d2c4ac6775a..597bd9ed276 100644 --- a/lldb/source/Core/StringList.cpp +++ b/lldb/source/Core/StringList.cpp @@ -10,8 +10,8 @@ #include "lldb/Core/StringList.h" #include "lldb/Core/Log.h" -#include "lldb/Core/StreamString.h" #include "lldb/Host/FileSpec.h" +#include "lldb/Utility/StreamString.h" #include <string> diff --git a/lldb/source/Core/StructuredData.cpp b/lldb/source/Core/StructuredData.cpp index 1e190f52314..d3cbf74eeca 100644 --- a/lldb/source/Core/StructuredData.cpp +++ b/lldb/source/Core/StructuredData.cpp @@ -14,12 +14,12 @@ #include <stdlib.h> #include "lldb/Core/DataBuffer.h" -#include "lldb/Core/Error.h" -#include "lldb/Core/StreamString.h" #include "lldb/Host/File.h" #include "lldb/Host/FileSpec.h" #include "lldb/Host/StringConvert.h" +#include "lldb/Utility/Error.h" #include "lldb/Utility/JSON.h" +#include "lldb/Utility/StreamString.h" using namespace lldb_private; diff --git a/lldb/source/Core/Timer.cpp b/lldb/source/Core/Timer.cpp index ca1a2b749ec..5222bf72bd7 100644 --- a/lldb/source/Core/Timer.cpp +++ b/lldb/source/Core/Timer.cpp @@ -13,8 +13,8 @@ #include <mutex> #include <vector> -#include "lldb/Core/Stream.h" #include "lldb/Host/Host.h" +#include "lldb/Utility/Stream.h" #include <stdio.h> diff --git a/lldb/source/Core/UUID.cpp b/lldb/source/Core/UUID.cpp index a08a748821d..5c783d3c097 100644 --- a/lldb/source/Core/UUID.cpp +++ b/lldb/source/Core/UUID.cpp @@ -18,7 +18,7 @@ // Other libraries and framework includes // Project includes -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" namespace lldb_private { diff --git a/lldb/source/Core/UserID.cpp b/lldb/source/Core/UserID.cpp index 5446154c1d2..7ad31877f42 100644 --- a/lldb/source/Core/UserID.cpp +++ b/lldb/source/Core/UserID.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// #include "lldb/Core/UserID.h" -#include "lldb/Core/Stream.h" +#include "lldb/Utility/Stream.h" #include <inttypes.h> diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index 92c3c8440d1..edcc5b2a455 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -11,14 +11,14 @@ #include <algorithm> #include <string.h> -#include "lldb/Core/Error.h" -#include "lldb/Core/RegularExpression.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/OptionValueProperties.h" #include "lldb/Interpreter/OptionValueString.h" +#include "lldb/Utility/Error.h" +#include "lldb/Utility/RegularExpression.h" +#include "lldb/Utility/Stream.h" +#include "lldb/Utility/StreamString.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/VMRange.cpp b/lldb/source/Core/VMRange.cpp index 8d21f4b1273..d77908d3faa 100644 --- a/lldb/source/Core/VMRange.cpp +++ b/lldb/source/Core/VMRange.cpp @@ -9,8 +9,8 @@ #include "lldb/lldb-private.h" -#include "lldb/Core/Stream.h" #include "lldb/Core/VMRange.h" +#include "lldb/Utility/Stream.h" #include <algorithm> using namespace lldb; diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index a480c3cf375..70350f47712 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -17,7 +17,6 @@ #include "lldb/Core/DataExtractor.h" #include "lldb/Core/Module.h" #include "lldb/Core/State.h" -#include "lldb/Core/Stream.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/ObjectFile.h" @@ -28,6 +27,7 @@ #include "lldb/Target/Process.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" +#include "lldb/Utility/Stream.h" using namespace lldb; using namespace lldb_private; diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index fc2312d60d5..b8b4373448b 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -21,7 +21,6 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" -#include "lldb/Core/StreamString.h" #include "lldb/Core/ValueObjectCast.h" #include "lldb/Core/ValueObjectChild.h" #include "lldb/Core/ValueObjectConstResult.h" @@ -29,6 +28,7 @@ #include "lldb/Core/ValueObjectList.h" #include "lldb/Core/ValueObjectMemory.h" #include "lldb/Core/ValueObjectSyntheticFilter.h" +#include "lldb/Utility/StreamString.h" #include "lldb/DataFormatters/DataVisualization.h" #include "lldb/DataFormatters/StringPrinter.h" |