summaryrefslogtreecommitdiff
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/ClangASTContext.cpp286
-rw-r--r--source/Symbol/ClangExternalASTSourceCommon.cpp16
-rw-r--r--source/Symbol/CompactUnwindInfo.cpp10
-rw-r--r--source/Symbol/CompilerType.cpp21
-rw-r--r--source/Symbol/DWARFCallFrameInfo.cpp9
-rw-r--r--source/Symbol/JavaASTContext.cpp25
-rw-r--r--source/Symbol/ObjectFile.cpp33
-rw-r--r--source/Symbol/Symtab.cpp29
-rw-r--r--source/Symbol/Type.cpp2
-rw-r--r--source/Symbol/TypeSystem.cpp40
-rw-r--r--source/Symbol/Variable.cpp8
12 files changed, 215 insertions, 266 deletions
diff --git a/source/Symbol/ArmUnwindInfo.cpp b/source/Symbol/ArmUnwindInfo.cpp
index 742c057e10e39..4da307bf0c326 100644
--- a/source/Symbol/ArmUnwindInfo.cpp
+++ b/source/Symbol/ArmUnwindInfo.cpp
@@ -46,7 +46,7 @@ bool ArmUnwindInfo::ArmExidxEntry::operator<(const ArmExidxEntry &other) const {
return address < other.address;
}
-ArmUnwindInfo::ArmUnwindInfo(const ObjectFile &objfile, SectionSP &arm_exidx,
+ArmUnwindInfo::ArmUnwindInfo(ObjectFile &objfile, SectionSP &arm_exidx,
SectionSP &arm_extab)
: m_byte_order(objfile.GetByteOrder()), m_arm_exidx_sp(arm_exidx),
m_arm_extab_sp(arm_extab) {
diff --git a/source/Symbol/ClangASTContext.cpp b/source/Symbol/ClangASTContext.cpp
index c8738e6e55026..673124cc0de5f 100644
--- a/source/Symbol/ClangASTContext.cpp
+++ b/source/Symbol/ClangASTContext.cpp
@@ -70,7 +70,7 @@
#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/Utility/ArchSpec.h"
#include "lldb/Utility/Flags.h"
#include "lldb/Core/DumpDataExtractor.h"
@@ -435,75 +435,12 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
// OpenCL and C++ both have bool, true, false keywords.
Opts.Bool = Opts.OpenCL || Opts.CPlusPlus;
- // if (Opts.CPlusPlus)
- // Opts.CXXOperatorNames = !Args.hasArg(OPT_fno_operator_names);
- //
- // if (Args.hasArg(OPT_fobjc_gc_only))
- // Opts.setGCMode(LangOptions::GCOnly);
- // else if (Args.hasArg(OPT_fobjc_gc))
- // Opts.setGCMode(LangOptions::HybridGC);
- //
- // if (Args.hasArg(OPT_print_ivar_layout))
- // Opts.ObjCGCBitmapPrint = 1;
- //
- // if (Args.hasArg(OPT_faltivec))
- // Opts.AltiVec = 1;
- //
- // if (Args.hasArg(OPT_pthread))
- // Opts.POSIXThreads = 1;
- //
- // llvm::StringRef Vis = getLastArgValue(Args, OPT_fvisibility,
- // "default");
- // if (Vis == "default")
Opts.setValueVisibilityMode(DefaultVisibility);
- // else if (Vis == "hidden")
- // Opts.setVisibilityMode(LangOptions::Hidden);
- // else if (Vis == "protected")
- // Opts.setVisibilityMode(LangOptions::Protected);
- // else
- // Diags.Report(diag::err_drv_invalid_value)
- // << Args.getLastArg(OPT_fvisibility)->getAsString(Args) << Vis;
-
- // Opts.OverflowChecking = Args.hasArg(OPT_ftrapv);
// Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs
// is specified, or -std is set to a conforming mode.
Opts.Trigraphs = !Opts.GNUMode;
- // if (Args.hasArg(OPT_trigraphs))
- // Opts.Trigraphs = 1;
- //
- // Opts.DollarIdents = Args.hasFlag(OPT_fdollars_in_identifiers,
- // OPT_fno_dollars_in_identifiers,
- // !Opts.AsmPreprocessor);
- // Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings);
- // Opts.Microsoft = Args.hasArg(OPT_fms_extensions);
- // Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);
- // if (Args.hasArg(OPT_fno_lax_vector_conversions))
- // Opts.LaxVectorConversions = 0;
- // Opts.Exceptions = Args.hasArg(OPT_fexceptions);
- // Opts.RTTI = !Args.hasArg(OPT_fno_rtti);
- // Opts.Blocks = Args.hasArg(OPT_fblocks);
Opts.CharIsSigned = ArchSpec(triple).CharIsSignedByDefault();
- // Opts.ShortWChar = Args.hasArg(OPT_fshort_wchar);
- // Opts.Freestanding = Args.hasArg(OPT_ffreestanding);
- // Opts.NoBuiltin = Args.hasArg(OPT_fno_builtin) || Opts.Freestanding;
- // Opts.AssumeSaneOperatorNew =
- // !Args.hasArg(OPT_fno_assume_sane_operator_new);
- // Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
- // Opts.AccessControl = Args.hasArg(OPT_faccess_control);
- // Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
- // Opts.MathErrno = !Args.hasArg(OPT_fno_math_errno);
- // Opts.InstantiationDepth = getLastArgIntValue(Args, OPT_ftemplate_depth,
- // 99,
- // Diags);
- // Opts.NeXTRuntime = !Args.hasArg(OPT_fgnu_runtime);
- // Opts.ObjCConstantStringClass = getLastArgValue(Args,
- // OPT_fconstant_string_class);
- // Opts.ObjCNonFragileABI = Args.hasArg(OPT_fobjc_nonfragile_abi);
- // Opts.CatchUndefined = Args.hasArg(OPT_fcatch_undefined_behavior);
- // Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
- // Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);
- // Opts.Static = Args.hasArg(OPT_static_define);
Opts.OptimizeSize = 0;
// FIXME: Eliminate this dependency.
@@ -518,18 +455,6 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) {
//
// FIXME: This is affected by other options (-fno-inline).
Opts.NoInlineDefine = !Opt;
-
- // unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags);
- // switch (SSP) {
- // default:
- // Diags.Report(diag::err_drv_invalid_value)
- // << Args.getLastArg(OPT_stack_protector)->getAsString(Args) <<
- // SSP;
- // break;
- // case 0: Opts.setStackProtectorMode(LangOptions::SSPOff); break;
- // case 1: Opts.setStackProtectorMode(LangOptions::SSPOn); break;
- // case 2: Opts.setStackProtectorMode(LangOptions::SSPReq); break;
- // }
}
ClangASTContext::ClangASTContext(const char *target_triple)
@@ -596,8 +521,9 @@ lldb::TypeSystemSP ClangASTContext::CreateInstance(lldb::LanguageType language,
ast_sp->SetArchitecture(fixed_arch);
ast_sp->m_scratch_ast_source_ap.reset(
new ClangASTSource(target->shared_from_this()));
+ lldbassert(ast_sp->getFileManager());
ast_sp->m_scratch_ast_source_ap->InstallASTContext(
- ast_sp->getASTContext());
+ *ast_sp->getASTContext(), *ast_sp->getFileManager(), true);
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> proxy_ast_source(
ast_sp->m_scratch_ast_source_ap->CreateProxy());
ast_sp->SetExternalSource(proxy_ast_source);
@@ -1430,7 +1356,7 @@ static TemplateParameterList *CreateTemplateParameterList(
is_typename, parameter_pack));
}
}
-
+
if (template_param_infos.packed_args &&
template_param_infos.packed_args->args.size()) {
IdentifierInfo *identifier_info = nullptr;
@@ -2168,21 +2094,21 @@ CompilerType ClangASTContext::GetOrCreateStructForIdentifier(
CompilerType
ClangASTContext::CreateEnumerationType(const char *name, DeclContext *decl_ctx,
const Declaration &decl,
- const CompilerType &integer_clang_type) {
+ const CompilerType &integer_clang_type,
+ bool is_scoped) {
// TODO: Do something intelligent with the Declaration object passed in
// like maybe filling in the SourceLocation with it...
ASTContext *ast = getASTContext();
// TODO: ask about these...
- // const bool IsScoped = false;
// const bool IsFixed = false;
EnumDecl *enum_decl = EnumDecl::Create(
*ast, decl_ctx, SourceLocation(), SourceLocation(),
name && name[0] ? &ast->Idents.get(name) : nullptr, nullptr,
- false, // IsScoped
- false, // IsScopedUsingClassTag
- false); // IsFixed
+ is_scoped, // IsScoped
+ is_scoped, // IsScopedUsingClassTag
+ false); // IsFixed
if (enum_decl) {
// TODO: check if we should be setting the promotion type too?
@@ -4350,6 +4276,9 @@ ClangASTContext::GetTypeClass(lldb::opaque_compiler_type_t type) {
break;
case clang::Type::ObjCTypeParam:
break;
+
+ case clang::Type::DependentAddressSpace:
+ break;
}
// We don't know hot to display this type...
return lldb::eTypeClassOther;
@@ -5009,6 +4938,7 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type,
case clang::BuiltinType::Half:
case clang::BuiltinType::Float:
+ case clang::BuiltinType::Float16:
case clang::BuiltinType::Float128:
case clang::BuiltinType::Double:
case clang::BuiltinType::LongDouble:
@@ -5159,6 +5089,9 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type,
break;
case clang::Type::ObjCTypeParam:
break;
+
+ case clang::Type::DependentAddressSpace:
+ break;
}
count = 0;
return lldb::eEncodingInvalid;
@@ -5309,6 +5242,9 @@ lldb::Format ClangASTContext::GetFormat(lldb::opaque_compiler_type_t type) {
break;
case clang::Type::ObjCTypeParam:
break;
+
+ case clang::Type::DependentAddressSpace:
+ break;
}
// We don't know hot to display this type...
return lldb::eFormatBytes;
@@ -7538,99 +7474,122 @@ ClangASTContext::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) {
return 0;
}
-CompilerType
-ClangASTContext::GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t arg_idx,
- lldb::TemplateArgumentKind &kind) {
+const clang::ClassTemplateSpecializationDecl *
+ClangASTContext::GetAsTemplateSpecialization(
+ lldb::opaque_compiler_type_t type) {
if (!type)
- return CompilerType();
+ return nullptr;
clang::QualType qual_type(GetCanonicalQualType(type));
const clang::Type::TypeClass type_class = qual_type->getTypeClass();
switch (type_class) {
- case clang::Type::Record:
- if (GetCompleteType(type)) {
- const clang::CXXRecordDecl *cxx_record_decl =
- qual_type->getAsCXXRecordDecl();
- if (cxx_record_decl) {
- const clang::ClassTemplateSpecializationDecl *template_decl =
- llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(
- cxx_record_decl);
- if (template_decl &&
- arg_idx < template_decl->getTemplateArgs().size()) {
- const clang::TemplateArgument &template_arg =
- template_decl->getTemplateArgs()[arg_idx];
- switch (template_arg.getKind()) {
- case clang::TemplateArgument::Null:
- kind = eTemplateArgumentKindNull;
- return CompilerType();
-
- case clang::TemplateArgument::Type:
- kind = eTemplateArgumentKindType;
- return CompilerType(getASTContext(), template_arg.getAsType());
-
- case clang::TemplateArgument::Declaration:
- kind = eTemplateArgumentKindDeclaration;
- return CompilerType();
-
- case clang::TemplateArgument::Integral:
- kind = eTemplateArgumentKindIntegral;
- return CompilerType(getASTContext(),
- template_arg.getIntegralType());
-
- case clang::TemplateArgument::Template:
- kind = eTemplateArgumentKindTemplate;
- return CompilerType();
-
- case clang::TemplateArgument::TemplateExpansion:
- kind = eTemplateArgumentKindTemplateExpansion;
- return CompilerType();
-
- case clang::TemplateArgument::Expression:
- kind = eTemplateArgumentKindExpression;
- return CompilerType();
-
- case clang::TemplateArgument::Pack:
- kind = eTemplateArgumentKindPack;
- return CompilerType();
-
- default:
- llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind");
- }
- }
- }
- }
- break;
+ case clang::Type::Record: {
+ if (! GetCompleteType(type))
+ return nullptr;
+ const clang::CXXRecordDecl *cxx_record_decl =
+ qual_type->getAsCXXRecordDecl();
+ if (!cxx_record_decl)
+ return nullptr;
+ return llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(
+ cxx_record_decl);
+ }
case clang::Type::Typedef:
- return (CompilerType(getASTContext(),
- llvm::cast<clang::TypedefType>(qual_type)
- ->getDecl()
- ->getUnderlyingType()))
- .GetTemplateArgument(arg_idx, kind);
+ return GetAsTemplateSpecialization(llvm::cast<clang::TypedefType>(qual_type)
+ ->getDecl()
+ ->getUnderlyingType()
+ .getAsOpaquePtr());
case clang::Type::Auto:
- return (CompilerType(
- getASTContext(),
- llvm::cast<clang::AutoType>(qual_type)->getDeducedType()))
- .GetTemplateArgument(arg_idx, kind);
+ return GetAsTemplateSpecialization(llvm::cast<clang::AutoType>(qual_type)
+ ->getDeducedType()
+ .getAsOpaquePtr());
case clang::Type::Elaborated:
- return (CompilerType(
- getASTContext(),
- llvm::cast<clang::ElaboratedType>(qual_type)->getNamedType()))
- .GetTemplateArgument(arg_idx, kind);
+ return GetAsTemplateSpecialization(
+ llvm::cast<clang::ElaboratedType>(qual_type)
+ ->getNamedType()
+ .getAsOpaquePtr());
case clang::Type::Paren:
- return (CompilerType(getASTContext(),
- llvm::cast<clang::ParenType>(qual_type)->desugar()))
- .GetTemplateArgument(arg_idx, kind);
+ return GetAsTemplateSpecialization(
+ llvm::cast<clang::ParenType>(qual_type)->desugar().getAsOpaquePtr());
default:
- break;
+ return nullptr;
}
- kind = eTemplateArgumentKindNull;
- return CompilerType();
+}
+
+lldb::TemplateArgumentKind
+ClangASTContext::GetTemplateArgumentKind(lldb::opaque_compiler_type_t type,
+ size_t arg_idx) {
+ const clang::ClassTemplateSpecializationDecl *template_decl =
+ GetAsTemplateSpecialization(type);
+ if (! template_decl || arg_idx >= template_decl->getTemplateArgs().size())
+ return eTemplateArgumentKindNull;
+
+ switch (template_decl->getTemplateArgs()[arg_idx].getKind()) {
+ case clang::TemplateArgument::Null:
+ return eTemplateArgumentKindNull;
+
+ case clang::TemplateArgument::NullPtr:
+ return eTemplateArgumentKindNullPtr;
+
+ case clang::TemplateArgument::Type:
+ return eTemplateArgumentKindType;
+
+ case clang::TemplateArgument::Declaration:
+ return eTemplateArgumentKindDeclaration;
+
+ case clang::TemplateArgument::Integral:
+ return eTemplateArgumentKindIntegral;
+
+ case clang::TemplateArgument::Template:
+ return eTemplateArgumentKindTemplate;
+
+ case clang::TemplateArgument::TemplateExpansion:
+ return eTemplateArgumentKindTemplateExpansion;
+
+ case clang::TemplateArgument::Expression:
+ return eTemplateArgumentKindExpression;
+
+ case clang::TemplateArgument::Pack:
+ return eTemplateArgumentKindPack;
+ }
+ llvm_unreachable("Unhandled clang::TemplateArgument::ArgKind");
+}
+
+CompilerType
+ClangASTContext::GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx) {
+ const clang::ClassTemplateSpecializationDecl *template_decl =
+ GetAsTemplateSpecialization(type);
+ if (!template_decl || idx >= template_decl->getTemplateArgs().size())
+ return CompilerType();
+
+ const clang::TemplateArgument &template_arg =
+ template_decl->getTemplateArgs()[idx];
+ if (template_arg.getKind() != clang::TemplateArgument::Type)
+ return CompilerType();
+
+ return CompilerType(getASTContext(), template_arg.getAsType());
+}
+
+llvm::Optional<CompilerType::IntegralTemplateArgument>
+ClangASTContext::GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx) {
+ const clang::ClassTemplateSpecializationDecl *template_decl =
+ GetAsTemplateSpecialization(type);
+ if (! template_decl || idx >= template_decl->getTemplateArgs().size())
+ return llvm::None;
+
+ const clang::TemplateArgument &template_arg =
+ template_decl->getTemplateArgs()[idx];
+ if (template_arg.getKind() != clang::TemplateArgument::Integral)
+ return llvm::None;
+
+ return {{template_arg.getAsIntegral(),
+ CompilerType(getASTContext(), template_arg.getIntegralType())}};
}
CompilerType ClangASTContext::GetTypeForFormatters(void *type) {
@@ -10121,3 +10080,10 @@ PersistentExpressionState *
ClangASTContextForExpressions::GetPersistentExpressionState() {
return m_persistent_variables.get();
}
+
+clang::ExternalASTMerger &
+ClangASTContextForExpressions::GetMergerUnchecked() {
+ lldbassert(m_scratch_ast_source_ap != nullptr);
+ return m_scratch_ast_source_ap->GetMergerUnchecked();
+}
+
diff --git a/source/Symbol/ClangExternalASTSourceCommon.cpp b/source/Symbol/ClangExternalASTSourceCommon.cpp
index 7a1a0f23a7ce0..992a76352d927 100644
--- a/source/Symbol/ClangExternalASTSourceCommon.cpp
+++ b/source/Symbol/ClangExternalASTSourceCommon.cpp
@@ -10,6 +10,8 @@
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
#include "lldb/Utility/Stream.h"
+#include <mutex>
+
using namespace lldb_private;
uint64_t g_TotalSizeOfMetadata = 0;
@@ -18,15 +20,19 @@ typedef llvm::DenseMap<clang::ExternalASTSource *,
ClangExternalASTSourceCommon *>
ASTSourceMap;
-static ASTSourceMap &GetSourceMap() {
+static ASTSourceMap &GetSourceMap(std::unique_lock<std::mutex> &guard) {
// Intentionally leaked to avoid problems with global destructors.
static ASTSourceMap *s_source_map = new ASTSourceMap;
+ static std::mutex s_mutex;
+ std::unique_lock<std::mutex> locked_guard(s_mutex);
+ guard.swap(locked_guard);
return *s_source_map;
}
ClangExternalASTSourceCommon *
ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) {
- ASTSourceMap &source_map = GetSourceMap();
+ std::unique_lock<std::mutex> guard;
+ ASTSourceMap &source_map = GetSourceMap(guard);
ASTSourceMap::iterator iter = source_map.find(source);
@@ -40,11 +46,13 @@ ClangExternalASTSourceCommon::Lookup(clang::ExternalASTSource *source) {
ClangExternalASTSourceCommon::ClangExternalASTSourceCommon()
: clang::ExternalASTSource() {
g_TotalSizeOfMetadata += m_metadata.size();
- GetSourceMap()[this] = this;
+ std::unique_lock<std::mutex> guard;
+ GetSourceMap(guard)[this] = this;
}
ClangExternalASTSourceCommon::~ClangExternalASTSourceCommon() {
- GetSourceMap().erase(this);
+ std::unique_lock<std::mutex> guard;
+ GetSourceMap(guard).erase(this);
g_TotalSizeOfMetadata -= m_metadata.size();
}
diff --git a/source/Symbol/CompactUnwindInfo.cpp b/source/Symbol/CompactUnwindInfo.cpp
index bc367496003e8..df71b17c09d0c 100644
--- a/source/Symbol/CompactUnwindInfo.cpp
+++ b/source/Symbol/CompactUnwindInfo.cpp
@@ -7,22 +7,18 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-#include <algorithm>
-
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Symbol/CompactUnwindInfo.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
-#include "lldb/Core/Section.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/ArchSpec.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/StreamString.h"
+#include <algorithm>
#include "llvm/Support/MathExtras.h"
diff --git a/source/Symbol/CompilerType.cpp b/source/Symbol/CompilerType.cpp
index e3880af27f22e..5d845361b03ce 100644
--- a/source/Symbol/CompilerType.cpp
+++ b/source/Symbol/CompilerType.cpp
@@ -690,15 +690,26 @@ size_t CompilerType::GetNumTemplateArguments() const {
return 0;
}
-CompilerType
-CompilerType::GetTemplateArgument(size_t idx,
- lldb::TemplateArgumentKind &kind) const {
+TemplateArgumentKind CompilerType::GetTemplateArgumentKind(size_t idx) const {
+ if (IsValid())
+ return m_type_system->GetTemplateArgumentKind(m_type, idx);
+ return eTemplateArgumentKindNull;
+}
+
+CompilerType CompilerType::GetTypeTemplateArgument(size_t idx) const {
if (IsValid()) {
- return m_type_system->GetTemplateArgument(m_type, idx, kind);
+ return m_type_system->GetTypeTemplateArgument(m_type, idx);
}
return CompilerType();
}
+llvm::Optional<CompilerType::IntegralTemplateArgument>
+CompilerType::GetIntegralTemplateArgument(size_t idx) const {
+ if (IsValid())
+ return m_type_system->GetIntegralTemplateArgument(m_type, idx);
+ return llvm::None;
+}
+
CompilerType CompilerType::GetTypeForFormatters() const {
if (IsValid())
return m_type_system->GetTypeForFormatters(m_type);
@@ -997,7 +1008,7 @@ bool CompilerType::ReadFromMemory(lldb_private::ExecutionContext *exe_ctx,
if (addr == 0)
return false;
// The address is an address in this process, so just copy it
- memcpy(dst, (uint8_t *)nullptr + addr, byte_size);
+ memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
return true;
} else {
Process *process = nullptr;
diff --git a/source/Symbol/DWARFCallFrameInfo.cpp b/source/Symbol/DWARFCallFrameInfo.cpp
index 9b1f8c694ccfe..572648d05f09b 100644
--- a/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/source/Symbol/DWARFCallFrameInfo.cpp
@@ -7,22 +7,19 @@
//
//===----------------------------------------------------------------------===//
-// C Includes
-// C++ Includes
-#include <list>
-
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Symbol/DWARFCallFrameInfo.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.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/ArchSpec.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/Timer.h"
+#include <list>
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Symbol/JavaASTContext.cpp b/source/Symbol/JavaASTContext.cpp
index ae4e9d5134b56..ff317eb19e97c 100644
--- a/source/Symbol/JavaASTContext.cpp
+++ b/source/Symbol/JavaASTContext.cpp
@@ -7,9 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include <sstream>
-
-#include "lldb/Core/ArchSpec.h"
+#include "lldb/Symbol/JavaASTContext.h"
#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
@@ -17,11 +15,12 @@
#include "lldb/Core/ValueObject.h"
#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Symbol/CompilerType.h"
-#include "lldb/Symbol/JavaASTContext.h"
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Target/Target.h"
+#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Stream.h"
+#include <sstream>
#include "Plugins/SymbolFile/DWARF/DWARFASTParserJava.h"
@@ -134,9 +133,9 @@ public:
obj_load_address.SetValueType(Value::eValueTypeLoadAddress);
Value result;
- if (m_dynamic_type_id.Evaluate(exe_ctx->GetBestExecutionContextScope(),
- nullptr, nullptr, 0, &obj_load_address,
- nullptr, result, nullptr)) {
+ if (m_dynamic_type_id.Evaluate(exe_ctx->GetBestExecutionContextScope(), 0,
+ &obj_load_address, nullptr, result,
+ nullptr)) {
Status error;
lldb::addr_t type_id_addr = result.GetScalar().UInt();
@@ -315,9 +314,8 @@ public:
ExecutionContextScope *exec_ctx_scope = value_obj->GetExecutionContextRef()
.Lock(true)
.GetBestExecutionContextScope();
- if (m_length_expression.Evaluate(exec_ctx_scope, nullptr, nullptr, 0,
- nullptr, &obj_load_address, result,
- nullptr))
+ if (m_length_expression.Evaluate(exec_ctx_scope, 0, nullptr,
+ &obj_load_address, result, nullptr))
return result.GetScalar().UInt();
return UINT32_MAX;
@@ -885,13 +883,6 @@ JavaASTContext::GetNumTemplateArguments(lldb::opaque_compiler_type_t type) {
return 0;
}
-CompilerType
-JavaASTContext::GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx,
- lldb::TemplateArgumentKind &kind) {
- return CompilerType();
-}
-
uint32_t JavaASTContext::GetNumFields(lldb::opaque_compiler_type_t type) {
if (JavaObjectType *obj =
llvm::dyn_cast<JavaObjectType>(static_cast<JavaType *>(type))) {
diff --git a/source/Symbol/ObjectFile.cpp b/source/Symbol/ObjectFile.cpp
index fd4180862c15b..7d73cb19d5083 100644
--- a/source/Symbol/ObjectFile.cpp
+++ b/source/Symbol/ObjectFile.cpp
@@ -348,6 +348,7 @@ AddressClass ObjectFile::GetAddressClass(addr_t file_addr) {
case eSectionTypeDWARFDebugAbbrev:
case eSectionTypeDWARFDebugAddr:
case eSectionTypeDWARFDebugAranges:
+ case eSectionTypeDWARFDebugCuIndex:
case eSectionTypeDWARFDebugFrame:
case eSectionTypeDWARFDebugInfo:
case eSectionTypeDWARFDebugLine:
@@ -482,9 +483,9 @@ size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length,
return m_data.CopyData(offset, length, dst);
}
-size_t ObjectFile::ReadSectionData(const Section *section,
+size_t ObjectFile::ReadSectionData(Section *section,
lldb::offset_t section_offset, void *dst,
- size_t dst_len) const {
+ size_t dst_len) {
assert(section);
section_offset *= section->GetTargetByteSize();
@@ -504,6 +505,9 @@ size_t ObjectFile::ReadSectionData(const Section *section,
dst_len, error);
}
} else {
+ if (!section->IsRelocated())
+ RelocateSection(section);
+
const lldb::offset_t section_file_size = section->GetFileSize();
if (section_offset < section_file_size) {
const size_t section_bytes_left = section_file_size - section_offset;
@@ -530,8 +534,8 @@ size_t ObjectFile::ReadSectionData(const Section *section,
//----------------------------------------------------------------------
// Get the section data the file on disk
//----------------------------------------------------------------------
-size_t ObjectFile::ReadSectionData(const Section *section,
- DataExtractor &section_data) const {
+size_t ObjectFile::ReadSectionData(Section *section,
+ DataExtractor &section_data) {
// If some other objectfile owns this data, pass this to them.
if (section->GetObjectFile() != this)
return section->GetObjectFile()->ReadSectionData(section, section_data);
@@ -557,22 +561,9 @@ size_t ObjectFile::ReadSectionData(const Section *section,
} else {
// The object file now contains a full mmap'ed copy of the object file data,
// so just use this
- return MemoryMapSectionData(section, section_data);
- }
-}
-
-size_t ObjectFile::MemoryMapSectionData(const Section *section,
- DataExtractor &section_data) const {
- // If some other objectfile owns this data, pass this to them.
- if (section->GetObjectFile() != this)
- return section->GetObjectFile()->MemoryMapSectionData(section,
- section_data);
+ if (!section->IsRelocated())
+ RelocateSection(section);
- if (IsInMemory()) {
- return ReadSectionData(section, section_data);
- } else {
- // The object file now contains a full mmap'ed copy of the object file data,
- // so just use this
return GetData(section->GetFileOffset(), section->GetFileSize(),
section_data);
}
@@ -693,3 +684,7 @@ Status ObjectFile::LoadInMemory(Target &target, bool set_pc) {
}
return error;
}
+
+void ObjectFile::RelocateSection(lldb_private::Section *section)
+{
+}
diff --git a/source/Symbol/Symtab.cpp b/source/Symbol/Symtab.cpp
index 3e2c965509d3c..4ac30649110fc 100644
--- a/source/Symbol/Symtab.cpp
+++ b/source/Symbol/Symtab.cpp
@@ -399,29 +399,6 @@ void Symtab::InitNameIndexes() {
m_basename_to_index.SizeToFit();
m_method_to_index.Sort();
m_method_to_index.SizeToFit();
-
- // static StreamFile a ("/tmp/a.txt");
- //
- // count = m_basename_to_index.GetSize();
- // if (count)
- // {
- // for (size_t i=0; i<count; ++i)
- // {
- // if (m_basename_to_index.GetValueAtIndex(i, entry.value))
- // a.Printf ("%s BASENAME\n",
- // m_symbols[entry.value].GetMangled().GetName().GetCString());
- // }
- // }
- // count = m_method_to_index.GetSize();
- // if (count)
- // {
- // for (size_t i=0; i<count; ++i)
- // {
- // if (m_method_to_index.GetValueAtIndex(i, entry.value))
- // a.Printf ("%s METHOD\n",
- // m_symbols[entry.value].GetMangled().GetName().GetCString());
- // }
- // }
}
}
@@ -616,8 +593,10 @@ void Symtab::SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
std::stable_sort(indexes.begin(), indexes.end(), comparator);
// Remove any duplicates if requested
- if (remove_duplicates)
- std::unique(indexes.begin(), indexes.end());
+ if (remove_duplicates) {
+ auto last = std::unique(indexes.begin(), indexes.end());
+ indexes.erase(last, indexes.end());
+ }
}
uint32_t Symtab::AppendSymbolIndexesWithName(const ConstString &symbol_name,
diff --git a/source/Symbol/Type.cpp b/source/Symbol/Type.cpp
index 53d9c5cc96a92..53bf3e8500558 100644
--- a/source/Symbol/Type.cpp
+++ b/source/Symbol/Type.cpp
@@ -404,7 +404,7 @@ bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
// The address is an address in this process, so just copy it
if (addr == 0)
return false;
- memcpy(dst, (uint8_t *)nullptr + addr, byte_size);
+ memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
return true;
} else {
if (exe_ctx) {
diff --git a/source/Symbol/TypeSystem.cpp b/source/Symbol/TypeSystem.cpp
index fa5e0bc7da6ed..b99f21e1e3471 100644
--- a/source/Symbol/TypeSystem.cpp
+++ b/source/Symbol/TypeSystem.cpp
@@ -23,19 +23,20 @@
#include "lldb/Symbol/CompilerType.h"
using namespace lldb_private;
+using namespace lldb;
TypeSystem::TypeSystem(LLVMCastKind kind) : m_kind(kind), m_sym_file(nullptr) {}
TypeSystem::~TypeSystem() {}
-lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
- Module *module) {
+static lldb::TypeSystemSP CreateInstanceHelper(lldb::LanguageType language,
+ Module *module, Target *target) {
uint32_t i = 0;
TypeSystemCreateInstance create_callback;
while ((create_callback = PluginManager::GetTypeSystemCreateCallbackAtIndex(
i++)) != nullptr) {
lldb::TypeSystemSP type_system_sp =
- create_callback(language, module, nullptr);
+ create_callback(language, module, target);
if (type_system_sp)
return type_system_sp;
}
@@ -44,18 +45,13 @@ lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
}
lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
- Target *target) {
- uint32_t i = 0;
- TypeSystemCreateInstance create_callback;
- while ((create_callback = PluginManager::GetTypeSystemCreateCallbackAtIndex(
- i++)) != nullptr) {
- lldb::TypeSystemSP type_system_sp =
- create_callback(language, nullptr, target);
- if (type_system_sp)
- return type_system_sp;
- }
+ Module *module) {
+ return CreateInstanceHelper(language, module, nullptr);
+}
- return lldb::TypeSystemSP();
+lldb::TypeSystemSP TypeSystem::CreateInstance(lldb::LanguageType language,
+ Target *target) {
+ return CreateInstanceHelper(language, nullptr, target);
}
bool TypeSystem::IsAnonymousType(lldb::opaque_compiler_type_t type) {
@@ -105,6 +101,22 @@ CompilerType TypeSystem::GetTypeForFormatters(void *type) {
return CompilerType(this, type);
}
+TemplateArgumentKind
+TypeSystem::GetTemplateArgumentKind(opaque_compiler_type_t type, size_t idx) {
+ return eTemplateArgumentKindNull;
+}
+
+CompilerType TypeSystem::GetTypeTemplateArgument(opaque_compiler_type_t type,
+ size_t idx) {
+ return CompilerType();
+}
+
+llvm::Optional<CompilerType::IntegralTemplateArgument>
+TypeSystem::GetIntegralTemplateArgument(opaque_compiler_type_t type,
+ size_t idx) {
+ return llvm::None;
+}
+
LazyBool TypeSystem::ShouldPrintAsOneLiner(void *type, ValueObject *valobj) {
return eLazyBoolCalculate;
}
diff --git a/source/Symbol/Variable.cpp b/source/Symbol/Variable.cpp
index ff32aa7314657..1957bcef1f3a0 100644
--- a/source/Symbol/Variable.cpp
+++ b/source/Symbol/Variable.cpp
@@ -425,14 +425,8 @@ Status Variable::GetValuesForVariableExpressionPath(
llvm::StringRef variable_sub_expr_path =
variable_expr_path.drop_front(variable_name.size());
if (!variable_sub_expr_path.empty()) {
- ValueObject::ExpressionPathScanEndReason reason_to_stop;
- ValueObject::ExpressionPathEndResultType final_value_type;
- ValueObject::GetValueForExpressionPathOptions options;
- ValueObject::ExpressionPathAftermath final_task_on_target;
-
valobj_sp = variable_valobj_sp->GetValueForExpressionPath(
- variable_sub_expr_path, &reason_to_stop, &final_value_type, options,
- &final_task_on_target);
+ variable_sub_expr_path);
if (!valobj_sp) {
error.SetErrorStringWithFormat(
"invalid expression path '%s' for variable '%s'",