aboutsummaryrefslogtreecommitdiff
path: root/source/Symbol
diff options
context:
space:
mode:
Diffstat (limited to 'source/Symbol')
-rw-r--r--source/Symbol/ArmUnwindInfo.cpp2
-rw-r--r--source/Symbol/Block.cpp2
-rw-r--r--source/Symbol/CMakeLists.txt20
-rw-r--r--source/Symbol/ClangASTContext.cpp56
-rw-r--r--source/Symbol/ClangASTImporter.cpp2
-rw-r--r--source/Symbol/ClangExternalASTSourceCallbacks.cpp89
-rw-r--r--source/Symbol/ClangExternalASTSourceCommon.cpp2
-rw-r--r--source/Symbol/CompactUnwindInfo.cpp6
-rw-r--r--source/Symbol/CompilerType.cpp17
-rw-r--r--source/Symbol/DWARFCallFrameInfo.cpp160
-rw-r--r--source/Symbol/Declaration.cpp4
-rw-r--r--source/Symbol/FuncUnwinders.cpp20
-rw-r--r--source/Symbol/Function.cpp15
-rw-r--r--source/Symbol/GoASTContext.cpp14
-rw-r--r--source/Symbol/JavaASTContext.cpp12
-rw-r--r--source/Symbol/LineTable.cpp11
-rw-r--r--source/Symbol/OCamlASTContext.cpp9
-rw-r--r--source/Symbol/ObjectFile.cpp58
-rw-r--r--source/Symbol/Symbol.cpp2
-rw-r--r--source/Symbol/SymbolContext.cpp2
-rw-r--r--source/Symbol/SymbolFile.cpp4
-rw-r--r--source/Symbol/SymbolVendor.cpp2
-rw-r--r--source/Symbol/Symtab.cpp10
-rw-r--r--source/Symbol/Type.cpp6
-rw-r--r--source/Symbol/UnwindPlan.cpp4
-rw-r--r--source/Symbol/Variable.cpp4
-rw-r--r--source/Symbol/VariableList.cpp2
27 files changed, 333 insertions, 202 deletions
diff --git a/source/Symbol/ArmUnwindInfo.cpp b/source/Symbol/ArmUnwindInfo.cpp
index 19951498c1d7..742c057e10e3 100644
--- a/source/Symbol/ArmUnwindInfo.cpp
+++ b/source/Symbol/ArmUnwindInfo.cpp
@@ -12,10 +12,10 @@
#include "Utility/ARM_DWARF_Registers.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ArmUnwindInfo.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/UnwindPlan.h"
+#include "lldb/Utility/Endian.h"
/*
* Unwind information reader and parser for the ARM exception handling ABI
diff --git a/source/Symbol/Block.cpp b/source/Symbol/Block.cpp
index 6c4c28d1f7f7..648d8ee48bf5 100644
--- a/source/Symbol/Block.cpp
+++ b/source/Symbol/Block.cpp
@@ -9,13 +9,13 @@
#include "lldb/Symbol/Block.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/VariableList.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Symbol/CMakeLists.txt b/source/Symbol/CMakeLists.txt
index c5f7be73f4bf..69a2b5a1699c 100644
--- a/source/Symbol/CMakeLists.txt
+++ b/source/Symbol/CMakeLists.txt
@@ -36,4 +36,24 @@ add_lldb_library(lldbSymbol
Variable.cpp
VariableList.cpp
VerifyDecl.cpp
+
+ LINK_LIBS
+ clangAST
+ clangBasic
+ clangFrontend
+ lldbCore
+ lldbExpression
+ lldbHost
+ lldbTarget
+ lldbUtility
+ lldbPluginExpressionParserClang
+ lldbPluginExpressionParserGo
+ lldbPluginSymbolFileDWARF
+ lldbPluginSymbolFilePDB
+ lldbPluginObjectContainerBSDArchive
+ lldbPluginCPlusPlusLanguage
+ lldbPluginObjCLanguage
+
+ LINK_COMPONENTS
+ Support
)
diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp
index 49b28349fd15..482a08322663 100644
--- a/source/Symbol/ClangASTContext.cpp
+++ b/source/Symbol/ClangASTContext.cpp
@@ -14,7 +14,7 @@
// C Includes
// C++ Includes
-#include <mutex> // std::once
+#include <mutex>
#include <string>
#include <vector>
@@ -65,16 +65,17 @@
#endif
#include "llvm/Support/Signals.h"
+#include "llvm/Support/Threading.h"
#include "Plugins/ExpressionParser/Clang/ClangFunctionCaller.h"
#include "Plugins/ExpressionParser/Clang/ClangUserExpression.h"
#include "Plugins/ExpressionParser/Clang/ClangUtilityFunction.h"
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/Flags.h"
-#include "lldb/Core/Log.h"
+#include "lldb/Utility/Flags.h"
+
+#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ThreadSafeDenseMap.h"
@@ -92,7 +93,10 @@
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/RegularExpression.h"
#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
#include "Plugins/SymbolFile/PDB/PDBASTParser.h"
@@ -127,8 +131,8 @@ typedef lldb_private::ThreadSafeDenseMap<clang::ASTContext *, ClangASTContext *>
static ClangASTMap &GetASTMap() {
static ClangASTMap *g_map_ptr = nullptr;
- static std::once_flag g_once_flag;
- std::call_once(g_once_flag, []() {
+ static llvm::once_flag g_once_flag;
+ llvm::call_once(g_once_flag, []() {
g_map_ptr = new ClangASTMap(); // leaked on purpose to avoid spins
});
return *g_map_ptr;
@@ -954,8 +958,8 @@ ClangASTContext::GetBasicTypeEnumeration(const ConstString &name) {
if (name) {
typedef UniqueCStringMap<lldb::BasicType> TypeNameToBasicTypeMap;
static TypeNameToBasicTypeMap g_type_map;
- static std::once_flag g_once_flag;
- std::call_once(g_once_flag, []() {
+ static llvm::once_flag g_once_flag;
+ llvm::call_once(g_once_flag, []() {
// "void"
g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid);
@@ -4314,6 +4318,8 @@ ClangASTContext::GetTypeClass(lldb::opaque_compiler_type_t type) {
break;
case clang::Type::TemplateSpecialization:
break;
+ case clang::Type::DeducedTemplateSpecialization:
+ break;
case clang::Type::Atomic:
break;
case clang::Type::Pipe:
@@ -5039,7 +5045,6 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type,
case clang::BuiltinType::Kind::OCLImage3dWO:
case clang::BuiltinType::Kind::OCLImage3dRW:
case clang::BuiltinType::Kind::OCLQueue:
- case clang::BuiltinType::Kind::OCLNDRange:
case clang::BuiltinType::Kind::OCLReserveID:
case clang::BuiltinType::Kind::OCLSampler:
case clang::BuiltinType::Kind::OMPArraySection:
@@ -5123,6 +5128,7 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type,
case clang::Type::TypeOf:
case clang::Type::Decltype:
case clang::Type::TemplateSpecialization:
+ case clang::Type::DeducedTemplateSpecialization:
case clang::Type::Atomic:
case clang::Type::Adjusted:
case clang::Type::Pipe:
@@ -5272,6 +5278,7 @@ lldb::Format ClangASTContext::GetFormat(lldb::opaque_compiler_type_t type) {
case clang::Type::TypeOf:
case clang::Type::Decltype:
case clang::Type::TemplateSpecialization:
+ case clang::Type::DeducedTemplateSpecialization:
case clang::Type::Atomic:
case clang::Type::Adjusted:
case clang::Type::Pipe:
@@ -8821,7 +8828,7 @@ ClangASTContext::ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
void ClangASTContext::DumpValue(
lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s,
- lldb::Format format, const lldb_private::DataExtractor &data,
+ lldb::Format format, const DataExtractor &data,
lldb::offset_t data_byte_offset, size_t data_byte_size,
uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, bool show_types,
bool show_summary, bool verbose, uint32_t depth) {
@@ -9029,8 +9036,9 @@ void ClangASTContext::DumpValue(
if (is_array_of_characters) {
s->PutChar('"');
- data.Dump(s, data_byte_offset, lldb::eFormatChar, element_byte_size,
- element_count, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0);
+ DumpDataExtractor(data, s, data_byte_offset, lldb::eFormatChar,
+ element_byte_size, element_count, UINT32_MAX,
+ LLDB_INVALID_ADDRESS, 0, 0);
s->PutChar('"');
return;
} else {
@@ -9186,8 +9194,9 @@ void ClangASTContext::DumpValue(
default:
// We are down to a scalar type that we just need to display.
- data.Dump(s, data_byte_offset, format, data_byte_size, 1, UINT32_MAX,
- LLDB_INVALID_ADDRESS, bitfield_bit_size, bitfield_bit_offset);
+ DumpDataExtractor(data, s, data_byte_offset, format, data_byte_size, 1,
+ UINT32_MAX, LLDB_INVALID_ADDRESS, bitfield_bit_size,
+ bitfield_bit_offset);
if (show_summary)
DumpSummary(type, exe_ctx, s, data, data_byte_offset, data_byte_size);
@@ -9197,8 +9206,8 @@ void ClangASTContext::DumpValue(
bool ClangASTContext::DumpTypeValue(
lldb::opaque_compiler_type_t type, Stream *s, lldb::Format format,
- const lldb_private::DataExtractor &data, lldb::offset_t byte_offset,
- size_t byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ const DataExtractor &data, lldb::offset_t byte_offset, size_t byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
ExecutionContextScope *exe_scope) {
if (!type)
return false;
@@ -9336,9 +9345,10 @@ bool ClangASTContext::DumpTypeValue(
byte_size = 4;
break;
}
- return data.Dump(s, byte_offset, format, byte_size, item_count,
- UINT32_MAX, LLDB_INVALID_ADDRESS, bitfield_bit_size,
- bitfield_bit_offset, exe_scope);
+ return DumpDataExtractor(data, s, byte_offset, format, byte_size,
+ item_count, UINT32_MAX, LLDB_INVALID_ADDRESS,
+ bitfield_bit_size, bitfield_bit_offset,
+ exe_scope);
}
break;
}
@@ -9364,8 +9374,8 @@ void ClangASTContext::DumpSummary(lldb::opaque_compiler_type_t type,
else
buf.resize(256);
- lldb_private::DataExtractor cstr_data(&buf.front(), buf.size(),
- process->GetByteOrder(), 4);
+ DataExtractor cstr_data(&buf.front(), buf.size(),
+ process->GetByteOrder(), 4);
buf.back() = '\0';
size_t bytes_read;
size_t total_cstr_len = 0;
@@ -9377,8 +9387,8 @@ void ClangASTContext::DumpSummary(lldb::opaque_compiler_type_t type,
break;
if (total_cstr_len == 0)
s->PutCString(" \"");
- cstr_data.Dump(s, 0, lldb::eFormatChar, 1, len, UINT32_MAX,
- LLDB_INVALID_ADDRESS, 0, 0);
+ DumpDataExtractor(cstr_data, s, 0, lldb::eFormatChar, 1, len,
+ UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0);
total_cstr_len += len;
if (len < buf.size())
break;
diff --git a/source/Symbol/ClangASTImporter.cpp b/source/Symbol/ClangASTImporter.cpp
index c0e8fea1f3bf..72ccaed43eaa 100644
--- a/source/Symbol/ClangASTImporter.cpp
+++ b/source/Symbol/ClangASTImporter.cpp
@@ -8,12 +8,12 @@
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/ClangASTImporter.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Symbol/ClangUtil.h"
#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/Log.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
diff --git a/source/Symbol/ClangExternalASTSourceCallbacks.cpp b/source/Symbol/ClangExternalASTSourceCallbacks.cpp
index e39baea8ead2..c88119bc9a4c 100644
--- a/source/Symbol/ClangExternalASTSourceCallbacks.cpp
+++ b/source/Symbol/ClangExternalASTSourceCallbacks.cpp
@@ -40,7 +40,7 @@
#include <assert.h>
#endif
-#include "lldb/Core/Log.h"
+#include "lldb/Utility/Log.h"
#include "clang/AST/Decl.h"
using namespace clang;
@@ -61,93 +61,6 @@ bool ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(
}
std::string decl_name(clang_decl_name.getAsString());
-
- switch (clang_decl_name.getNameKind()) {
- // Normal identifiers.
- case clang::DeclarationName::Identifier:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"Identifier\", name = \"%s\")\n", decl_ctx,
- // decl_name.c_str());
- if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0) {
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
- }
- break;
-
- case clang::DeclarationName::ObjCZeroArgSelector:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"ObjCZeroArgSelector\", name = \"%s\")\n",
- // decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::ObjCOneArgSelector:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"ObjCOneArgSelector\", name = \"%s\")\n",
- // decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::ObjCMultiArgSelector:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"ObjCMultiArgSelector\", name = \"%s\")\n",
- // decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXConstructorName:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"CXXConstructorName\", name = \"%s\")\n",
- // decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXDestructorName:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"CXXDestructorName\", name = \"%s\")\n",
- // decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXConversionFunctionName:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"CXXConversionFunctionName\", name =
- // \"%s\")\n", decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXOperatorName:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"CXXOperatorName\", name = \"%s\")\n",
- // decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXLiteralOperatorName:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"CXXLiteralOperatorName\", name = \"%s\")\n",
- // decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
-
- case clang::DeclarationName::CXXUsingDirective:
- // printf
- // ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx
- // = %p, decl_name = { kind = \"CXXUsingDirective\", name = \"%s\")\n",
- // decl_ctx, decl_name.c_str());
- SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
- return false;
- }
-
SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
return false;
}
diff --git a/source/Symbol/ClangExternalASTSourceCommon.cpp b/source/Symbol/ClangExternalASTSourceCommon.cpp
index 69263fa67da0..7a1a0f23a7ce 100644
--- a/source/Symbol/ClangExternalASTSourceCommon.cpp
+++ b/source/Symbol/ClangExternalASTSourceCommon.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb_private;
diff --git a/source/Symbol/CompactUnwindInfo.cpp b/source/Symbol/CompactUnwindInfo.cpp
index e3da6f17cfa4..77fcd33bbb3b 100644
--- a/source/Symbol/CompactUnwindInfo.cpp
+++ b/source/Symbol/CompactUnwindInfo.cpp
@@ -12,17 +12,17 @@
#include <algorithm>
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/CompactUnwindInfo.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
#include "llvm/Support/MathExtras.h"
diff --git a/source/Symbol/CompilerType.cpp b/source/Symbol/CompilerType.cpp
index 2684db980aac..cc33dc196226 100644
--- a/source/Symbol/CompilerType.cpp
+++ b/source/Symbol/CompilerType.cpp
@@ -9,19 +9,19 @@
#include "lldb/Symbol/CompilerType.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Scalar.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StreamString.h"
#include <iterator>
#include <mutex>
@@ -744,8 +744,7 @@ size_t CompilerType::ConvertStringToFloatValue(const char *s, uint8_t *dst,
#define DEPTH_INCREMENT 2
void CompilerType::DumpValue(ExecutionContext *exe_ctx, Stream *s,
- lldb::Format format,
- const lldb_private::DataExtractor &data,
+ lldb::Format format, const DataExtractor &data,
lldb::offset_t data_byte_offset,
size_t data_byte_size, uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset, bool show_types,
@@ -759,7 +758,7 @@ void CompilerType::DumpValue(ExecutionContext *exe_ctx, Stream *s,
}
bool CompilerType::DumpTypeValue(Stream *s, lldb::Format format,
- const lldb_private::DataExtractor &data,
+ const DataExtractor &data,
lldb::offset_t byte_offset, size_t byte_size,
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset,
@@ -772,7 +771,7 @@ bool CompilerType::DumpTypeValue(Stream *s, lldb::Format format,
}
void CompilerType::DumpSummary(ExecutionContext *exe_ctx, Stream *s,
- const lldb_private::DataExtractor &data,
+ const DataExtractor &data,
lldb::offset_t data_byte_offset,
size_t data_byte_size) {
if (IsValid())
diff --git a/source/Symbol/DWARFCallFrameInfo.cpp b/source/Symbol/DWARFCallFrameInfo.cpp
index 9504ea184236..d229e880d97d 100644
--- a/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/source/Symbol/DWARFCallFrameInfo.cpp
@@ -12,21 +12,144 @@
#include <list>
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Section.h"
#include "lldb/Core/Timer.h"
+#include "lldb/Core/dwarf.h"
#include "lldb/Host/Host.h"
#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/UnwindPlan.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
+//----------------------------------------------------------------------
+// GetDwarfEHPtr
+//
+// Used for calls when the value type is specified by a DWARF EH Frame
+// pointer encoding.
+//----------------------------------------------------------------------
+static uint64_t
+GetGNUEHPointer(const DataExtractor &DE, offset_t *offset_ptr,
+ uint32_t eh_ptr_enc, addr_t pc_rel_addr, addr_t text_addr,
+ addr_t data_addr) //, BSDRelocs *data_relocs) const
+{
+ if (eh_ptr_enc == DW_EH_PE_omit)
+ return ULLONG_MAX; // Value isn't in the buffer...
+
+ uint64_t baseAddress = 0;
+ uint64_t addressValue = 0;
+ const uint32_t addr_size = DE.GetAddressByteSize();
+#ifdef LLDB_CONFIGURATION_DEBUG
+ assert(addr_size == 4 || addr_size == 8);
+#endif
+
+ bool signExtendValue = false;
+ // Decode the base part or adjust our offset
+ switch (eh_ptr_enc & 0x70) {
+ case DW_EH_PE_pcrel:
+ signExtendValue = true;
+ baseAddress = *offset_ptr;
+ if (pc_rel_addr != LLDB_INVALID_ADDRESS)
+ baseAddress += pc_rel_addr;
+ // else
+ // Log::GlobalWarning ("PC relative pointer encoding found with
+ // invalid pc relative address.");
+ break;
+
+ case DW_EH_PE_textrel:
+ signExtendValue = true;
+ if (text_addr != LLDB_INVALID_ADDRESS)
+ baseAddress = text_addr;
+ // else
+ // Log::GlobalWarning ("text relative pointer encoding being
+ // decoded with invalid text section address, setting base address
+ // to zero.");
+ break;
+
+ case DW_EH_PE_datarel:
+ signExtendValue = true;
+ if (data_addr != LLDB_INVALID_ADDRESS)
+ baseAddress = data_addr;
+ // else
+ // Log::GlobalWarning ("data relative pointer encoding being
+ // decoded with invalid data section address, setting base address
+ // to zero.");
+ break;
+
+ case DW_EH_PE_funcrel:
+ signExtendValue = true;
+ break;
+
+ case DW_EH_PE_aligned: {
+ // SetPointerSize should be called prior to extracting these so the
+ // pointer size is cached
+ assert(addr_size != 0);
+ if (addr_size) {
+ // Align to a address size boundary first
+ uint32_t alignOffset = *offset_ptr % addr_size;
+ if (alignOffset)
+ offset_ptr += addr_size - alignOffset;
+ }
+ } break;
+
+ default:
+ break;
+ }
+
+ // Decode the value part
+ switch (eh_ptr_enc & DW_EH_PE_MASK_ENCODING) {
+ case DW_EH_PE_absptr: {
+ addressValue = DE.GetAddress(offset_ptr);
+ // if (data_relocs)
+ // addressValue = data_relocs->Relocate(*offset_ptr -
+ // addr_size, *this, addressValue);
+ } break;
+ case DW_EH_PE_uleb128:
+ addressValue = DE.GetULEB128(offset_ptr);
+ break;
+ case DW_EH_PE_udata2:
+ addressValue = DE.GetU16(offset_ptr);
+ break;
+ case DW_EH_PE_udata4:
+ addressValue = DE.GetU32(offset_ptr);
+ break;
+ case DW_EH_PE_udata8:
+ addressValue = DE.GetU64(offset_ptr);
+ break;
+ case DW_EH_PE_sleb128:
+ addressValue = DE.GetSLEB128(offset_ptr);
+ break;
+ case DW_EH_PE_sdata2:
+ addressValue = (int16_t)DE.GetU16(offset_ptr);
+ break;
+ case DW_EH_PE_sdata4:
+ addressValue = (int32_t)DE.GetU32(offset_ptr);
+ break;
+ case DW_EH_PE_sdata8:
+ addressValue = (int64_t)DE.GetU64(offset_ptr);
+ break;
+ default:
+ // Unhandled encoding type
+ assert(eh_ptr_enc);
+ break;
+ }
+
+ // Since we promote everything to 64 bit, we may need to sign extend
+ if (signExtendValue && addr_size < sizeof(baseAddress)) {
+ uint64_t sign_bit = 1ull << ((addr_size * 8ull) - 1ull);
+ if (sign_bit & addressValue) {
+ uint64_t mask = ~sign_bit + 1;
+ addressValue |= mask;
+ }
+ }
+ return baseAddress + addressValue;
+}
+
DWARFCallFrameInfo::DWARFCallFrameInfo(ObjectFile &objfile,
SectionSP &section_sp,
lldb::RegisterKind reg_kind,
@@ -223,9 +346,9 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) {
{
uint8_t arg_ptr_encoding = m_cfi_data.GetU8(&offset);
const lldb::addr_t pc_rel_addr = m_section_sp->GetFileAddress();
- cie_sp->personality_loc = m_cfi_data.GetGNUEHPointer(
- &offset, arg_ptr_encoding, pc_rel_addr, LLDB_INVALID_ADDRESS,
- LLDB_INVALID_ADDRESS);
+ cie_sp->personality_loc = GetGNUEHPointer(
+ m_cfi_data, &offset, arg_ptr_encoding, pc_rel_addr,
+ LLDB_INVALID_ADDRESS, LLDB_INVALID_ADDRESS);
}
break;
@@ -361,14 +484,15 @@ void DWARFCallFrameInfo::GetFDEIndex() {
const lldb::addr_t text_addr = LLDB_INVALID_ADDRESS;
const lldb::addr_t data_addr = LLDB_INVALID_ADDRESS;
- lldb::addr_t addr = m_cfi_data.GetGNUEHPointer(
- &offset, cie->ptr_encoding, pc_rel_addr, text_addr, data_addr);
+ lldb::addr_t addr =
+ GetGNUEHPointer(m_cfi_data, &offset, cie->ptr_encoding, pc_rel_addr,
+ text_addr, data_addr);
if (clear_address_zeroth_bit)
addr &= ~1ull;
- lldb::addr_t length = m_cfi_data.GetGNUEHPointer(
- &offset, cie->ptr_encoding & DW_EH_PE_MASK_ENCODING, pc_rel_addr,
- text_addr, data_addr);
+ lldb::addr_t length = GetGNUEHPointer(
+ m_cfi_data, &offset, cie->ptr_encoding & DW_EH_PE_MASK_ENCODING,
+ pc_rel_addr, text_addr, data_addr);
FDEEntryMap::Entry fde(addr, length, current_entry);
m_fde_index.Append(fde);
} else {
@@ -434,11 +558,12 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset,
const lldb::addr_t pc_rel_addr = m_section_sp->GetFileAddress();
const lldb::addr_t text_addr = LLDB_INVALID_ADDRESS;
const lldb::addr_t data_addr = LLDB_INVALID_ADDRESS;
- lldb::addr_t range_base = m_cfi_data.GetGNUEHPointer(
- &offset, cie->ptr_encoding, pc_rel_addr, text_addr, data_addr);
- lldb::addr_t range_len = m_cfi_data.GetGNUEHPointer(
- &offset, cie->ptr_encoding & DW_EH_PE_MASK_ENCODING, pc_rel_addr,
- text_addr, data_addr);
+ lldb::addr_t range_base =
+ GetGNUEHPointer(m_cfi_data, &offset, cie->ptr_encoding, pc_rel_addr,
+ text_addr, data_addr);
+ lldb::addr_t range_len = GetGNUEHPointer(
+ m_cfi_data, &offset, cie->ptr_encoding & DW_EH_PE_MASK_ENCODING,
+ pc_rel_addr, text_addr, data_addr);
AddressRange range(range_base, m_objfile.GetAddressByteSize(),
m_objfile.GetSectionList());
range.SetByteSize(range_len);
@@ -449,8 +574,9 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset,
uint32_t aug_data_len = (uint32_t)m_cfi_data.GetULEB128(&offset);
if (aug_data_len != 0 && cie->lsda_addr_encoding != DW_EH_PE_omit) {
offset_t saved_offset = offset;
- lsda_data_file_address = m_cfi_data.GetGNUEHPointer(
- &offset, cie->lsda_addr_encoding, pc_rel_addr, text_addr, data_addr);
+ lsda_data_file_address =
+ GetGNUEHPointer(m_cfi_data, &offset, cie->lsda_addr_encoding,
+ pc_rel_addr, text_addr, data_addr);
if (offset - saved_offset != aug_data_len) {
// There is more in the augmentation region than we know how to process;
// don't read anything.
diff --git a/source/Symbol/Declaration.cpp b/source/Symbol/Declaration.cpp
index 5d1dbdee1430..7cee6c5a3ef3 100644
--- a/source/Symbol/Declaration.cpp
+++ b/source/Symbol/Declaration.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/Declaration.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb_private;
@@ -42,7 +42,7 @@ void Declaration::Dump(Stream *s, bool show_fullpaths) const {
bool Declaration::DumpStopContext(Stream *s, bool show_fullpaths) const {
if (m_file) {
- if (show_fullpaths || s->GetVerbose())
+ if (show_fullpaths)
*s << m_file;
else
m_file.GetFilename().Dump(s);
diff --git a/source/Symbol/FuncUnwinders.cpp b/source/Symbol/FuncUnwinders.cpp
index 0abd8a25b5d7..3b94e250dac7 100644
--- a/source/Symbol/FuncUnwinders.cpp
+++ b/source/Symbol/FuncUnwinders.cpp
@@ -19,10 +19,10 @@
#include "lldb/Target/ABI.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/RegisterNumber.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/UnwindAssembly.h"
-#include "lldb/Utility/RegisterNumber.h"
using namespace lldb;
using namespace lldb_private;
@@ -73,13 +73,13 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtCallSite(Target &target,
UnwindPlanSP FuncUnwinders::GetCompactUnwindUnwindPlan(Target &target,
int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_compact_unwind.size() > 0)
return m_unwind_plan_compact_unwind[0]; // FIXME support multiple compact
// unwind plans for one func
if (m_tried_unwind_plan_compact_unwind)
return UnwindPlanSP();
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_tried_unwind_plan_compact_unwind = true;
if (m_range.GetBaseAddress().IsValid()) {
Address current_pc(m_range.GetBaseAddress());
@@ -101,10 +101,10 @@ UnwindPlanSP FuncUnwinders::GetCompactUnwindUnwindPlan(Target &target,
UnwindPlanSP FuncUnwinders::GetEHFrameUnwindPlan(Target &target,
int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_eh_frame_sp.get() || m_tried_unwind_plan_eh_frame)
return m_unwind_plan_eh_frame_sp;
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_tried_unwind_plan_eh_frame = true;
if (m_range.GetBaseAddress().IsValid()) {
Address current_pc(m_range.GetBaseAddress());
@@ -123,10 +123,10 @@ UnwindPlanSP FuncUnwinders::GetEHFrameUnwindPlan(Target &target,
UnwindPlanSP FuncUnwinders::GetArmUnwindUnwindPlan(Target &target,
int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_arm_unwind_sp.get() || m_tried_unwind_plan_arm_unwind)
return m_unwind_plan_arm_unwind_sp;
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_tried_unwind_plan_arm_unwind = true;
if (m_range.GetBaseAddress().IsValid()) {
Address current_pc(m_range.GetBaseAddress());
@@ -147,6 +147,7 @@ UnwindPlanSP FuncUnwinders::GetArmUnwindUnwindPlan(Target &target,
UnwindPlanSP FuncUnwinders::GetEHFrameAugmentedUnwindPlan(Target &target,
Thread &thread,
int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_eh_frame_augmented_sp.get() ||
m_tried_unwind_plan_eh_frame_augmented)
return m_unwind_plan_eh_frame_augmented_sp;
@@ -162,7 +163,6 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAugmentedUnwindPlan(Target &target,
return m_unwind_plan_eh_frame_augmented_sp;
}
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_tried_unwind_plan_eh_frame_augmented = true;
UnwindPlanSP eh_frame_plan = GetEHFrameUnwindPlan(target, current_offset);
@@ -190,12 +190,12 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAugmentedUnwindPlan(Target &target,
UnwindPlanSP FuncUnwinders::GetAssemblyUnwindPlan(Target &target,
Thread &thread,
int current_offset) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_assembly_sp.get() || m_tried_unwind_plan_assembly ||
m_unwind_table.GetAllowAssemblyEmulationUnwindPlans() == false) {
return m_unwind_plan_assembly_sp;
}
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_tried_unwind_plan_assembly = true;
UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
@@ -298,10 +298,10 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtNonCallSite(Target &target,
UnwindPlanSP FuncUnwinders::GetUnwindPlanFastUnwind(Target &target,
Thread &thread) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_fast_sp.get() || m_tried_unwind_fast)
return m_unwind_plan_fast_sp;
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_tried_unwind_fast = true;
UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
@@ -316,10 +316,10 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanFastUnwind(Target &target,
}
UnwindPlanSP FuncUnwinders::GetUnwindPlanArchitectureDefault(Thread &thread) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_arch_default_sp.get() || m_tried_unwind_arch_default)
return m_unwind_plan_arch_default_sp;
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_tried_unwind_arch_default = true;
Address current_pc;
@@ -340,11 +340,11 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanArchitectureDefault(Thread &thread) {
UnwindPlanSP
FuncUnwinders::GetUnwindPlanArchitectureDefaultAtFunctionEntry(Thread &thread) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_unwind_plan_arch_default_at_func_entry_sp.get() ||
m_tried_unwind_arch_default_at_func_entry)
return m_unwind_plan_arch_default_at_func_entry_sp;
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_tried_unwind_arch_default_at_func_entry = true;
Address current_pc;
@@ -365,10 +365,10 @@ FuncUnwinders::GetUnwindPlanArchitectureDefaultAtFunctionEntry(Thread &thread) {
}
Address &FuncUnwinders::GetFirstNonPrologueInsn(Target &target) {
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (m_first_non_prologue_insn.IsValid())
return m_first_non_prologue_insn;
- std::lock_guard<std::recursive_mutex> guard(m_mutex);
ExecutionContext exe_ctx(target.shared_from_this(), false);
UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target));
if (assembly_profiler_sp)
diff --git a/source/Symbol/Function.cpp b/source/Symbol/Function.cpp
index 8fde0a423883..9464cef0bc73 100644
--- a/source/Symbol/Function.cpp
+++ b/source/Symbol/Function.cpp
@@ -228,12 +228,15 @@ const CompileUnit *Function::GetCompileUnit() const { return m_comp_unit; }
void Function::GetDescription(Stream *s, lldb::DescriptionLevel level,
Target *target) {
- Type *func_type = GetType();
- const char *name = func_type ? func_type->GetName().AsCString() : "<unknown>";
-
- *s << "id = " << (const UserID &)*this << ", name = \"" << name
- << "\", range = ";
-
+ ConstString name = GetName();
+ ConstString mangled = m_mangled.GetMangledName();
+
+ *s << "id = " << (const UserID &)*this;
+ if (name)
+ *s << ", name = \"" << name.GetCString() << '"';
+ if (mangled)
+ *s << ", mangled = \"" << mangled.GetCString() << '"';
+ *s << ", range = ";
Address::DumpStyle fallback_style;
if (level == eDescriptionLevelVerbose)
fallback_style = Address::DumpStyleModuleWithFileAddress;
diff --git a/source/Symbol/GoASTContext.cpp b/source/Symbol/GoASTContext.cpp
index a28a6d756846..5ca173ae113c 100644
--- a/source/Symbol/GoASTContext.cpp
+++ b/source/Symbol/GoASTContext.cpp
@@ -11,12 +11,12 @@
#include <utility>
#include <vector>
+#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Core/ValueObject.h"
-#include "lldb/DataFormatters/StringPrinter.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/GoASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -25,6 +25,8 @@
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Target.h"
+#include "llvm/Support/Threading.h"
+
#include "Plugins/ExpressionParser/Go/GoUserExpression.h"
#include "Plugins/SymbolFile/DWARF/DWARFASTParserGo.h"
@@ -593,8 +595,8 @@ GoASTContext::GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) {
if (name) {
typedef UniqueCStringMap<lldb::BasicType> TypeNameToBasicTypeMap;
static TypeNameToBasicTypeMap g_type_map;
- static std::once_flag g_once_flag;
- std::call_once(g_once_flag, []() {
+ static llvm::once_flag g_once_flag;
+ llvm::call_once(g_once_flag, []() {
// "void"
g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid);
// "int"
@@ -1261,9 +1263,9 @@ bool GoASTContext::DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
byte_size = 4;
break;
}
- return data.Dump(s, byte_offset, format, byte_size, item_count, UINT32_MAX,
- LLDB_INVALID_ADDRESS, bitfield_bit_size,
- bitfield_bit_offset, exe_scope);
+ return DumpDataExtractor(data, s, byte_offset, format, byte_size,
+ item_count, UINT32_MAX, LLDB_INVALID_ADDRESS,
+ bitfield_bit_size, bitfield_bit_offset, exe_scope);
}
return 0;
}
diff --git a/source/Symbol/JavaASTContext.cpp b/source/Symbol/JavaASTContext.cpp
index 79073a653676..ac029dfe5dc8 100644
--- a/source/Symbol/JavaASTContext.cpp
+++ b/source/Symbol/JavaASTContext.cpp
@@ -10,10 +10,9 @@
#include <sstream>
#include "lldb/Core/ArchSpec.h"
-#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/DWARFExpression.h"
@@ -22,6 +21,7 @@
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Stream.h"
#include "Plugins/SymbolFile/DWARF/DWARFASTParserJava.h"
@@ -1004,10 +1004,10 @@ bool JavaASTContext::DumpTypeValue(
size_t data_byte_size, uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset, ExecutionContextScope *exe_scope) {
if (IsScalarType(type)) {
- return data.Dump(s, data_offset, format, data_byte_size,
- 1, // count
- UINT32_MAX, LLDB_INVALID_ADDRESS, bitfield_bit_size,
- bitfield_bit_offset, exe_scope);
+ return DumpDataExtractor(data, s, data_offset, format, data_byte_size,
+ 1, // count
+ UINT32_MAX, LLDB_INVALID_ADDRESS,
+ bitfield_bit_size, bitfield_bit_offset, exe_scope);
}
return false;
}
diff --git a/source/Symbol/LineTable.cpp b/source/Symbol/LineTable.cpp
index 02ab0c126117..3cb305302927 100644
--- a/source/Symbol/LineTable.cpp
+++ b/source/Symbol/LineTable.cpp
@@ -11,8 +11,8 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Symbol/CompileUnit.h"
+#include "lldb/Utility/Stream.h"
#include <algorithm>
using namespace lldb;
@@ -230,6 +230,14 @@ bool LineTable::FindLineEntryByAddress(const Address &so_addr,
}
}
}
+ else
+ {
+ // There might be code in the containing objfile before the first line
+ // table entry. Make sure that does not get considered part of the first
+ // line table entry.
+ if (pos->file_addr > so_addr.GetFileAddress())
+ return false;
+ }
// Make sure we have a valid match and that the match isn't a
// terminating
@@ -501,6 +509,7 @@ LineTable *LineTable::LinkLineTable(const FileRangeMap &file_range_map) {
if (terminate_previous_entry && !sequence.m_entries.empty()) {
assert(prev_file_addr != LLDB_INVALID_ADDRESS);
+ UNUSED_IF_ASSERT_DISABLED(prev_file_addr);
sequence.m_entries.push_back(sequence.m_entries.back());
if (prev_end_entry_linked_file_addr == LLDB_INVALID_ADDRESS)
prev_end_entry_linked_file_addr =
diff --git a/source/Symbol/OCamlASTContext.cpp b/source/Symbol/OCamlASTContext.cpp
index d459be3c23d2..1456ebfa9dce 100644
--- a/source/Symbol/OCamlASTContext.cpp
+++ b/source/Symbol/OCamlASTContext.cpp
@@ -9,7 +9,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/OCamlASTContext.h"
-#include "lldb/Core/Log.h"
+#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamFile.h"
@@ -19,6 +19,7 @@
#include "lldb/Symbol/Type.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
#include "Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h"
@@ -621,9 +622,9 @@ bool OCamlASTContext::DumpTypeValue(
}
if (IsScalarType(type)) {
- return data.Dump(s, byte_offset, format, byte_size, 1, SIZE_MAX,
- LLDB_INVALID_ADDRESS, bitfield_bit_size,
- bitfield_bit_offset, exe_scope);
+ return DumpDataExtractor(data, s, byte_offset, format, byte_size, 1,
+ SIZE_MAX, LLDB_INVALID_ADDRESS, bitfield_bit_size,
+ bitfield_bit_offset, exe_scope);
}
return false;
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index 0b1d6b29983b..483a315defbd 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -9,18 +9,22 @@
#include "lldb/Symbol/ObjectFile.h"
#include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h"
-#include "lldb/Core/DataBuffer.h"
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectContainer.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/SectionLoadList.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/DataBuffer.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataBufferLLVM.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/RegularExpression.h"
#include "lldb/lldb-private.h"
using namespace lldb;
@@ -73,8 +77,8 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file,
// and object container plug-ins can use these bytes to see if they
// can parse this file.
if (file_size > 0) {
- data_sp = file->ReadFileContents(file_offset,
- std::min<size_t>(512, file_size));
+ data_sp =
+ DataBufferLLVM::CreateSliceFromPath(file->GetPath(), 512, file_offset);
data_offset = 0;
}
}
@@ -117,7 +121,8 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file,
}
// We failed to find any cached object files in the container
// plug-ins, so lets read the first 512 bytes and try again below...
- data_sp = archive_file.ReadFileContents(file_offset, 512);
+ data_sp = DataBufferLLVM::CreateSliceFromPath(archive_file.GetPath(),
+ 512, file_offset);
}
}
}
@@ -203,7 +208,7 @@ size_t ObjectFile::GetModuleSpecifications(const FileSpec &file,
lldb::offset_t file_offset,
lldb::offset_t file_size,
ModuleSpecList &specs) {
- DataBufferSP data_sp(file.ReadFileContents(file_offset, 512));
+ DataBufferSP data_sp = DataBufferLLVM::CreateSliceFromPath(file.GetPath(), 512, file_offset);
if (data_sp) {
if (file_size == 0) {
const lldb::offset_t actual_file_size = file.GetByteSize();
@@ -648,3 +653,40 @@ ConstString ObjectFile::GetNextSyntheticSymbolName() {
file_name.GetCString());
return ConstString(ss.GetString());
}
+
+Error ObjectFile::LoadInMemory(Target &target, bool set_pc) {
+ Error error;
+ ProcessSP process = target.CalculateProcess();
+ if (!process)
+ return Error("No Process");
+ if (set_pc && !GetEntryPointAddress().IsValid())
+ return Error("No entry address in object file");
+
+ SectionList *section_list = GetSectionList();
+ if (!section_list)
+ return Error("No section in object file");
+ size_t section_count = section_list->GetNumSections(0);
+ for (size_t i = 0; i < section_count; ++i) {
+ SectionSP section_sp = section_list->GetSectionAtIndex(i);
+ addr_t addr = target.GetSectionLoadList().GetSectionLoadAddress(section_sp);
+ if (addr != LLDB_INVALID_ADDRESS) {
+ DataExtractor section_data;
+ // We can skip sections like bss
+ if (section_sp->GetFileSize() == 0)
+ continue;
+ section_sp->GetSectionData(section_data);
+ lldb::offset_t written = process->WriteMemory(
+ addr, section_data.GetDataStart(), section_data.GetByteSize(), error);
+ if (written != section_data.GetByteSize())
+ return error;
+ }
+ }
+ if (set_pc) {
+ ThreadList &thread_list = process->GetThreadList();
+ ThreadSP curr_thread(thread_list.GetSelectedThread());
+ RegisterContextSP reg_context(curr_thread->GetRegisterContext());
+ Address file_entry = GetEntryPointAddress();
+ reg_context->SetPC(file_entry.GetLoadAddress(&target));
+ }
+ return error;
+}
diff --git a/source/Symbol/Symbol.cpp b/source/Symbol/Symbol.cpp
index d24365720f56..ab297ef330f2 100644
--- a/source/Symbol/Symbol.cpp
+++ b/source/Symbol/Symbol.cpp
@@ -12,13 +12,13 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Symtab.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/source/Symbol/SymbolContext.cpp b/source/Symbol/SymbolContext.cpp
index e43a70f78e42..d99bfc609261 100644
--- a/source/Symbol/SymbolContext.cpp
+++ b/source/Symbol/SymbolContext.cpp
@@ -9,7 +9,6 @@
#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Host/Host.h"
@@ -23,6 +22,7 @@
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Symbol/SymbolFile.cpp b/source/Symbol/SymbolFile.cpp
index 8d8b606b5729..d7898919f45e 100644
--- a/source/Symbol/SymbolFile.cpp
+++ b/source/Symbol/SymbolFile.cpp
@@ -9,14 +9,14 @@
#include "lldb/Symbol/SymbolFile.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/VariableList.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
#include "lldb/lldb-private.h"
using namespace lldb_private;
diff --git a/source/Symbol/SymbolVendor.cpp b/source/Symbol/SymbolVendor.cpp
index a0a40efd0c06..f5a08739f24d 100644
--- a/source/Symbol/SymbolVendor.cpp
+++ b/source/Symbol/SymbolVendor.cpp
@@ -15,10 +15,10 @@
// Project includes
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index 09cfd8ead88c..427029802634 100644
--- a/source/Symbol/Symtab.cpp
+++ b/source/Symbol/Symtab.cpp
@@ -13,14 +13,15 @@
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Core/STLUtils.h"
#include "lldb/Core/Timer.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Symtab.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
@@ -328,6 +329,11 @@ void Symtab::InitNameIndexes() {
} else {
// No context for this function so this has to be a basename
m_basename_to_index.Append(entry);
+ // If there is no context (no namespaces or class scopes that
+ // come before the function name) then this also could be a
+ // fullname.
+ if (cxx_method.GetContext().empty())
+ m_name_to_index.Append(entry);
}
}
}
diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp
index 80d08bf742fc..89fc9f974c67 100644
--- a/source/Symbol/Type.cpp
+++ b/source/Symbol/Type.cpp
@@ -13,11 +13,11 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Scalar.h"
-#include "lldb/Core/StreamString.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/StreamString.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/ObjectFile.h"
diff --git a/source/Symbol/UnwindPlan.cpp b/source/Symbol/UnwindPlan.cpp
index 8a20ef8cce27..4c0014348c42 100644
--- a/source/Symbol/UnwindPlan.cpp
+++ b/source/Symbol/UnwindPlan.cpp
@@ -9,11 +9,11 @@
#include "lldb/Symbol/UnwindPlan.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/Log.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index e17685e83e2a..0d1db1cdeac0 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -10,8 +10,6 @@
#include "lldb/Symbol/Variable.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/RegularExpression.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Symbol/Block.h"
@@ -30,6 +28,8 @@
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Stream.h"
#include "llvm/ADT/Twine.h"
diff --git a/source/Symbol/VariableList.cpp b/source/Symbol/VariableList.cpp
index a81b95b7937f..e7a482e158b1 100644
--- a/source/Symbol/VariableList.cpp
+++ b/source/Symbol/VariableList.cpp
@@ -9,10 +9,10 @@
#include "lldb/Symbol/VariableList.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
+#include "lldb/Utility/RegularExpression.h"
using namespace lldb;
using namespace lldb_private;