diff options
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/Address.cpp | 10 | ||||
-rw-r--r-- | lldb/source/Core/AddressRange.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Core/AddressResolverFileLine.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/ArchSpec.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Core/ConstString.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Core/DataBufferMemoryMap.cpp | 14 | ||||
-rw-r--r-- | lldb/source/Core/DataExtractor.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Core/Error.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/FileSpec.cpp | 18 | ||||
-rw-r--r-- | lldb/source/Core/Language.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/Makefile | 14 | ||||
-rw-r--r-- | lldb/source/Core/SearchFilter.cpp | 10 | ||||
-rw-r--r-- | lldb/source/Core/Stream.cpp | 38 | ||||
-rw-r--r-- | lldb/source/Core/StreamFile.cpp | 20 | ||||
-rw-r--r-- | lldb/source/Core/StringList.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Core/Value.cpp | 7 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectChild.cpp | 6 |
18 files changed, 106 insertions, 70 deletions
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index c857a6b6d1f..057b8567a4d 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -241,24 +241,28 @@ ReadCStringFromMemory (ExecutionContextScope *exe_scope, const Address &address, } Address::Address () : + SymbolContextScope(), m_section (NULL), m_offset (LLDB_INVALID_ADDRESS) { } Address::Address (const Address& rhs) : + SymbolContextScope(rhs), m_section (rhs.m_section), m_offset (rhs.m_offset) { } Address::Address (const Section* section, addr_t offset) : + SymbolContextScope(), m_section (section), m_offset (offset) { } Address::Address (addr_t address, const SectionList * sections) : + SymbolContextScope(), m_section (NULL), m_offset (LLDB_INVALID_ADDRESS) { @@ -430,6 +434,9 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum lldb_private::Address so_addr; switch (style) { + case DumpStyleInvalid: + return false; + case DumpStyleSectionNameOffset: if (m_section != NULL) { @@ -637,6 +644,9 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum } } break; + + default: + break; } } diff --git a/lldb/source/Core/AddressRange.cpp b/lldb/source/Core/AddressRange.cpp index fbdf7026e5a..47b957aca0a 100644 --- a/lldb/source/Core/AddressRange.cpp +++ b/lldb/source/Core/AddressRange.cpp @@ -146,6 +146,9 @@ AddressRange::Dump(Stream *s, Process *process, Address::DumpStyle style, Addres switch (style) { + default: + break; + case Address::DumpStyleSectionNameOffset: case Address::DumpStyleSectionPointerOffset: s->PutChar ('['); diff --git a/lldb/source/Core/AddressResolverFileLine.cpp b/lldb/source/Core/AddressResolverFileLine.cpp index c4aadcca9c1..b93f331d823 100644 --- a/lldb/source/Core/AddressResolverFileLine.cpp +++ b/lldb/source/Core/AddressResolverFileLine.cpp @@ -54,7 +54,7 @@ AddressResolverFileLine::SearchCallback sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list); - for (int i = 0; i < sc_list_size; i++) + for (uint32_t i = 0; i < sc_list_size; i++) { SymbolContext sc; if (sc_list.GetContextAtIndex(i, sc)) diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp index b7fbf5f25a0..006aa708a55 100644 --- a/lldb/source/Core/ArchSpec.cpp +++ b/lldb/source/Core/ArchSpec.cpp @@ -239,6 +239,7 @@ ArchSpec::AsCString (lldb::ArchitectureType arch_type, uint32_t cpu, uint32_t su switch (arch_type) { + case kNumArchTypes: case eArchTypeInvalid: break; @@ -334,6 +335,7 @@ ArchSpec::GetGenericCPUType () const { switch (m_type) { + case kNumArchTypes: case eArchTypeInvalid: break; @@ -990,7 +992,7 @@ enum eRegNumPPC_GCC_vscr = 110, eRegNumPPC_GCC_spe_acc = 111, eRegNumPPC_GCC_spefscr = 112, - eRegNumPPC_GCC_sfp = 113, + eRegNumPPC_GCC_sfp = 113 }; static const char * g_arm_gcc_reg_names[] = { @@ -1605,6 +1607,7 @@ ArchSpec::GetAddressByteSize() const { switch (m_type) { + case kNumArchTypes: case eArchTypeInvalid: break; @@ -1702,6 +1705,9 @@ ArchSpec::SetArch (const char *arch_name) } } break; + + case kNumArchTypes: + break; } const char *str = arch_name; diff --git a/lldb/source/Core/ConstString.cpp b/lldb/source/Core/ConstString.cpp index 06d83829fae..1caf843a3d3 100644 --- a/lldb/source/Core/ConstString.cpp +++ b/lldb/source/Core/ConstString.cpp @@ -85,10 +85,7 @@ public: Mutex::Locker locker (m_mutex); llvm::StringRef string_ref (cstr, cstr_len); llvm::StringMapEntry<uint32_t>& entry = m_string_map.GetOrCreateValue (string_ref); - const char *ccstr = entry.getKeyData(); - llvm::StringMapEntry<uint32_t>&reconstituted_entry = GetStringMapEntryFromKeyData (ccstr); - assert (&entry == &reconstituted_entry); - return ccstr; + return entry.getKeyData(); } return NULL; } diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp index 9c63bf134db..898280e25bc 100644 --- a/lldb/source/Core/DataBufferMemoryMap.cpp +++ b/lldb/source/Core/DataBufferMemoryMap.cpp @@ -154,12 +154,16 @@ DataBufferMemoryMap::MemoryMapFromFileDescriptor (int fd, off_t offset, size_t l { if ((stat.st_mode & S_IFREG) && (stat.st_size > offset)) { + const size_t max_bytes_available = stat.st_size - offset; if (length == SIZE_MAX) - length = stat.st_size - offset; - - // Cap the length if too much data was requested - if (length > stat.st_size - offset) - length = stat.st_size - offset; + { + length = max_bytes_available; + } + else if (length > max_bytes_available) + { + // Cap the length if too much data was requested + length = max_bytes_available; + } if (length > 0) { diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index 0b1f5403333..72d7d934054 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -1088,7 +1088,7 @@ DataExtractor::GetSLEB128 (uint32_t *offset_ptr) const int size = sizeof (uint32_t) * 8; const uint8_t *src = m_start + *offset_ptr; - uint8_t byte; + uint8_t byte = 0; int bytecount = 0; while (src < m_end) @@ -1316,6 +1316,8 @@ DataExtractor::Dump s->Address(GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset), sizeof (addr_t)); break; + default: + case eFormatDefault: case eFormatHex: if (item_byte_size <= 8) { diff --git a/lldb/source/Core/Error.cpp b/lldb/source/Core/Error.cpp index 206fd699b4f..104dfc6d693 100644 --- a/lldb/source/Core/Error.cpp +++ b/lldb/source/Core/Error.cpp @@ -334,7 +334,7 @@ Error::SetErrorStringWithVarArg (const char *format, va_list args) // allocated buffer above va_list copy_args; va_copy (copy_args, args); - int length = ::vsnprintf (buf.data(), buf.size(), format, args); + size_t length = ::vsnprintf (buf.data(), buf.size(), format, args); if (length >= buf.size()) { // The error formatted string didn't fit into our buffer, resize it diff --git a/lldb/source/Core/FileSpec.cpp b/lldb/source/Core/FileSpec.cpp index bf90e967cc2..7e2e087a545 100644 --- a/lldb/source/Core/FileSpec.cpp +++ b/lldb/source/Core/FileSpec.cpp @@ -58,7 +58,7 @@ GetCachedGlobTildeSlash() // Returns 0 if there WAS a ~ in the path but the username couldn't be resolved. // Otherwise returns the number of characters copied into dst_path. If the return // is >= dst_len, then the resolved path is too long... -int +size_t FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len) { char user_home[PATH_MAX]; @@ -70,7 +70,7 @@ FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len) // If there's no ~, then just copy src_path straight to dst_path (they may be the same string...) if (src_path[0] != '~') { - int len = strlen (src_path); + size_t len = strlen (src_path); if (len >= dst_len) { ::bcopy (src_path, dst_path, dst_len - 1); @@ -106,7 +106,7 @@ FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len) // User name of "" means the current user... struct passwd *user_entry; - const char *home_dir; + const char *home_dir = NULL; if (user_name[0] == '\0') { @@ -125,7 +125,7 @@ FileSpec::ResolveUsername (const char *src_path, char *dst_path, size_t dst_len) return ::snprintf (dst_path, dst_len, "%s%s", home_dir, remainder); } -int +size_t FileSpec::Resolve (const char *src_path, char *dst_path, size_t dst_len) { if (src_path == NULL || src_path[0] == '\0') @@ -135,7 +135,7 @@ FileSpec::Resolve (const char *src_path, char *dst_path, size_t dst_len) char unglobbed_path[PATH_MAX]; if (src_path[0] == '~') { - int return_count = ResolveUsername(src_path, unglobbed_path, sizeof(unglobbed_path)); + size_t return_count = ResolveUsername(src_path, unglobbed_path, sizeof(unglobbed_path)); // If we couldn't find the user referred to, or the resultant path was too long, // then just copy over the src_path. @@ -509,16 +509,16 @@ FileSpec::GetPath(char *path, size_t max_path_length) const { if (filename && filename[0]) { - return snprintf (path, max_path_length, "%s/%s", dirname, filename) < max_path_length; + return (size_t)::snprintf (path, max_path_length, "%s/%s", dirname, filename) < max_path_length; } else { - strncpy (path, dirname, max_path_length); + ::strncpy (path, dirname, max_path_length); } } else if (filename) { - strncpy (path, filename, max_path_length); + ::strncpy (path, filename, max_path_length); } else { @@ -660,7 +660,7 @@ FileSpec::ReadFileContents (off_t file_offset, size_t file_size) const { // Make sure we read exactly what we asked for and if we got // less, adjust the array - if (bytesRead < data_heap_ap->GetByteSize()) + if ((size_t)bytesRead < data_heap_ap->GetByteSize()) data_heap_ap->SetByteSize(bytesRead); data_sp.reset(data_heap_ap.release()); } diff --git a/lldb/source/Core/Language.cpp b/lldb/source/Core/Language.cpp index b209d186f28..add2a22d66c 100644 --- a/lldb/source/Core/Language.cpp +++ b/lldb/source/Core/Language.cpp @@ -48,7 +48,7 @@ g_languages[] = { { "python" , NULL , "Python" } } }; -static const uint32_t +static const size_t g_num_languages = sizeof(g_languages)/sizeof(LanguageStrings); Language::Language(Language::Type language) : diff --git a/lldb/source/Core/Makefile b/lldb/source/Core/Makefile new file mode 100644 index 00000000000..b7773e3f571 --- /dev/null +++ b/lldb/source/Core/Makefile @@ -0,0 +1,14 @@ +##===- source/Core/Makefile --------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LLDB_LEVEL := ../.. +LIBRARYNAME := lldbCore +BUILD_ARCHIVE = 1 + +include $(LLDB_LEVEL)/Makefile diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp index b08f4d80d5e..c8888421af7 100644 --- a/lldb/source/Core/SearchFilter.cpp +++ b/lldb/source/Core/SearchFilter.cpp @@ -154,9 +154,9 @@ SearchFilter::SearchInModuleList (Searcher &searcher, ModuleList &modules) searcher.SearchCallback (*this, empty_sc, NULL, false); else { - size_t numModules = modules.GetSize(); + const size_t numModules = modules.GetSize(); - for (int i = 0; i < numModules; i++) + for (size_t i = 0; i < numModules; i++) { ModuleSP module_sp(modules.GetModuleAtIndex(i)); if (ModulePasses(module_sp)) @@ -186,7 +186,7 @@ SearchFilter::DoModuleIteration (const SymbolContext &context, Searcher &searche if (!context.module_sp) { size_t n_modules = m_target_sp->GetImages().GetSize(); - for (int i = 0; i < n_modules; i++) + for (size_t i = 0; i < n_modules; i++) { // If this is the last level supplied, then call the callback directly, // otherwise descend. @@ -395,8 +395,8 @@ SearchFilterByModule::Search (Searcher &searcher) // find the ones that match the file name. ModuleList matching_modules; - // const size_t num_matching_modules = m_target_sp->GetImages().FindModules(&m_module_spec, NULL, NULL, NULL, matching_modules); - for (int i = 0; i < m_target_sp->GetImages().GetSize (); i++) + const size_t num_modules = m_target_sp->GetImages().GetSize (); + for (size_t i = 0; i < num_modules; i++) { Module* module = m_target_sp->GetImages().GetModulePointerAtIndex(i); if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0) diff --git a/lldb/source/Core/Stream.cpp b/lldb/source/Core/Stream.cpp index 0d3c8e0aced..9beec35c8f7 100644 --- a/lldb/source/Core/Stream.cpp +++ b/lldb/source/Core/Stream.cpp @@ -67,12 +67,10 @@ Stream::PutSLEB128 (int64_t sval) if (m_flags.IsSet(eBinary)) { bool more = true; - bool negative = (sval < 0); while (more) { uint8_t byte = sval & 0x7fu; sval >>= 7; - assert((!negative && sval >= 0) || (negative && sval < 0)); /* sign bit of byte is 2nd high order bit (0x40) */ if ((sval == 0 && !(byte & 0x40)) || (sval == -1 && (byte & 0x40)) ) @@ -209,7 +207,7 @@ Stream::PrintfVarArg (const char *format, va_list args) int bytes_written = 0; // Try and format our string into a fixed buffer first and see if it fits - int length = vsnprintf (str, sizeof(str), format, args); + size_t length = ::vsnprintf (str, sizeof(str), format, args); if (length < sizeof(str)) { va_end (args); @@ -479,16 +477,15 @@ Stream::PrintfAsRawHex8 (const char *format, ...) va_start (args, format); va_copy (args, args_copy); // Copy this so we - int i; char str[1024]; int bytes_written = 0; // Try and format our string into a fixed buffer first and see if it fits - int length = vsnprintf (str, sizeof(str), format, args); + 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 (i=0; i<length; ++i) + for (size_t i=0; i<length; ++i) bytes_written += _PutHex8 (str[i], false); } else @@ -499,7 +496,7 @@ Stream::PrintfAsRawHex8 (const char *format, ...) length = ::vasprintf (&str_ptr, format, args_copy); if (str_ptr) { - for (i=0; i<length; ++i) + for (size_t i=0; i<length; ++i) bytes_written += _PutHex8 (str_ptr[i], false); ::free (str_ptr); } @@ -514,7 +511,7 @@ int Stream::PutNHex8 (size_t n, uint8_t uvalue) { int bytes_written = 0; - for (int i=0; i<n; ++i) + for (size_t i=0; i<n; ++i) bytes_written += _PutHex8 (uvalue, m_flags.IsSet(eAddPrefix)); return bytes_written; } @@ -555,15 +552,14 @@ Stream::PutHex16 (uint16_t uvalue, ByteOrder byte_order) bool add_prefix = m_flags.IsSet(eAddPrefix); int bytes_written = 0; - int byte; if (byte_order == eByteOrderLittle) { - for (byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) + for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } else { - for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false) + for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } return bytes_written; @@ -577,15 +573,14 @@ Stream::PutHex32(uint32_t uvalue, ByteOrder byte_order) bool add_prefix = m_flags.IsSet(eAddPrefix); int bytes_written = 0; - int byte; if (byte_order == eByteOrderLittle) { - for (byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) + for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } else { - for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false) + for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } return bytes_written; @@ -599,15 +594,14 @@ Stream::PutHex64(uint64_t uvalue, ByteOrder byte_order) bool add_prefix = m_flags.IsSet(eAddPrefix); int bytes_written = 0; - int byte; if (byte_order == eByteOrderLittle) { - for (byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) + for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } else { - for (byte = sizeof(uvalue)-1; byte >= 0; --byte, add_prefix = false) + for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); } return bytes_written; @@ -675,17 +669,16 @@ 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; - int i; bool binary_is_clear = m_flags.IsClear (eBinary); m_flags.Set (eBinary); if (src_byte_order == dst_byte_order) { - for (i=0;i<src_len; ++i) + for (size_t i = 0; i < src_len; ++i) bytes_written += _PutHex8 (src[i], false); } else { - for (i=src_len-1;i>=0; --i) + for (size_t i = src_len-1; i < src_len; --i) bytes_written += _PutHex8 (src[i], false); } if (binary_is_clear) @@ -705,17 +698,16 @@ 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; - int i; bool binary_is_set = m_flags.IsSet(eBinary); m_flags.Clear(eBinary); if (src_byte_order == dst_byte_order) { - for (i=0;i<src_len; ++i) + for (size_t i = 0; i < src_len; ++i) bytes_written += _PutHex8 (src[i], false); } else { - for (i=src_len-1;i>=0; --i) + for (size_t i = src_len-1; i < src_len; --i) bytes_written += _PutHex8 (src[i], false); } if (binary_is_set) diff --git a/lldb/source/Core/StreamFile.cpp b/lldb/source/Core/StreamFile.cpp index 415822789bb..c8e87d91a5a 100644 --- a/lldb/source/Core/StreamFile.cpp +++ b/lldb/source/Core/StreamFile.cpp @@ -24,32 +24,32 @@ using namespace lldb_private; StreamFile::StreamFile () : Stream (), m_file (NULL), - m_path_name (), - m_close_file (false) + m_close_file (false), + m_path_name () { } StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, FILE *f) : Stream (flags, addr_size, byte_order), m_file(f), - m_path_name (), - m_close_file(false) + m_close_file(false), + m_path_name () { } StreamFile::StreamFile(FILE *f) : Stream (), m_file(f), - m_path_name (), - m_close_file(false) + m_close_file(false), + m_path_name () { } StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, const char *path, const char *permissions) : Stream (flags, addr_size, byte_order), m_file (NULL), - m_path_name (path), - m_close_file(false) + m_close_file(false), + m_path_name (path) { Open(path, permissions); } @@ -57,8 +57,8 @@ StreamFile::StreamFile(uint32_t flags, uint32_t addr_size, ByteOrder byte_order, StreamFile::StreamFile(const char *path, const char *permissions) : Stream (), m_file (NULL), - m_path_name (path), - m_close_file(false) + m_close_file(false), + m_path_name (path) { Open(path, permissions); } diff --git a/lldb/source/Core/StringList.cpp b/lldb/source/Core/StringList.cpp index cb96fb0f7b9..61d78834966 100644 --- a/lldb/source/Core/StringList.cpp +++ b/lldb/source/Core/StringList.cpp @@ -68,7 +68,7 @@ StringList::AppendList (StringList strings) { uint32_t len = strings.GetSize(); - for (int i = 0; i < len; ++i) + for (uint32_t i = 0; i < len; ++i) m_strings.push_back (strings.GetStringAtIndex(i)); } @@ -106,7 +106,7 @@ StringList::LongestCommonPrefix (std::string &common_prefix) for (++pos; pos != end; ++pos) { - int new_size = strlen (m_strings[pos].c_str()); + size_t new_size = strlen (m_strings[pos].c_str()); // First trim common_prefix if it is longer than the current element: if (common_prefix.size() > new_size) @@ -114,7 +114,7 @@ StringList::LongestCommonPrefix (std::string &common_prefix) // Then trim it at the first disparity: - for (int i = 0; i < common_prefix.size(); i++) + for (size_t i = 0; i < common_prefix.size(); i++) { if (m_strings[pos][i] != common_prefix[i]) { @@ -189,7 +189,7 @@ StringList::RemoveBlankLines () if (GetSize() == 0) return; - int idx = 0; + size_t idx = 0; while (idx < m_strings.size()) { if (m_strings[idx].empty()) diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index c4c17dd0428..32c27496b8f 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -616,7 +616,7 @@ Value::GetValueAsData (ExecutionContext *exe_ctx, clang::ASTContext *ast_context data.SetData(data_sp); } - uint8_t* dst = (uint8_t*)data.PeekData (data_offset, byte_size); + uint8_t* dst = const_cast<uint8_t*>(data.PeekData (data_offset, byte_size)); if (dst != NULL) { if (address_type == eAddressTypeHost) @@ -677,6 +677,10 @@ Value::ResolveValue(ExecutionContext *exe_ctx, clang::ASTContext *ast_context) case eValueTypeScalar: // raw scalar value break; + case eContextTypeValue: + m_value.Clear(); // TODO: Sean, fill this in + break; + default: case eValueTypeFileAddress: m_value.Clear(); @@ -757,6 +761,7 @@ Value::GetContextTypeAsCString (ContextType context_type) case eContextTypeDCRegisterInfo: return "RegisterInfo *"; case eContextTypeDCType: return "Type *"; case eContextTypeDCVariable: return "Variable *"; + case eContextTypeValue: return "Value"; // TODO: Sean, more description here? }; return "???"; } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 8baa4e1a979..4a1e002242e 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -516,6 +516,9 @@ ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope) } } break; + + default: + break; } } } @@ -579,7 +582,7 @@ ValueObject::SetValueFromCString (ExecutionContextScope *exe_scope, const char * { const size_t byte_size = GetByteSize(); const off_t byte_offset = GetByteOffset(); - uint8_t *dst = (uint8_t *)m_data.PeekData(byte_offset, byte_size); + uint8_t *dst = const_cast<uint8_t *>(m_data.PeekData(byte_offset, byte_size)); if (dst != NULL) { // We are decoding a float into host byte order below, so make diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index 5c6e9d2e357..b9258bd45db 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -111,9 +111,9 @@ ValueObjectChild::GetTypeName() const char *clang_type_name = m_type_name.AsCString(); if (clang_type_name) { - char bitfield_type_name[strlen(clang_type_name) + 32]; - ::snprintf (bitfield_type_name, sizeof(bitfield_type_name), "%s:%u", clang_type_name, m_bitfield_bit_size); - m_type_name.SetCString(bitfield_type_name); + std::vector<char> bitfield_type_name (strlen(clang_type_name) + 32, 0); + ::snprintf (bitfield_type_name.data(), bitfield_type_name.size(), "%s:%u", clang_type_name, m_bitfield_bit_size); + m_type_name.SetCString(bitfield_type_name.data()); } } } |