diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:55:28 +0000 |
commit | e81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch) | |
tree | 9ed5e1a91f242e2cb5911577356e487a55c01b78 /source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI | |
parent | 85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff) | |
download | src-e81d9d49145e432d917eea3a70d2ae74dcad1d89.tar.gz src-e81d9d49145e432d917eea3a70d2ae74dcad1d89.zip |
Vendor import of stripped lldb trunk r256633:
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=292932
Diffstat (limited to 'source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI')
-rw-r--r-- | source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp | 49 | ||||
-rw-r--r-- | source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h | 83 |
2 files changed, 87 insertions, 45 deletions
diff --git a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 3a3878ef09a1..a5fa004493a2 100644 --- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -40,14 +40,15 @@ ItaniumABILanguageRuntime::CouldHaveDynamicValue (ValueObject &in_value) { const bool check_cxx = true; const bool check_objc = false; - return in_value.GetClangType().IsPossibleDynamicType (NULL, check_cxx, check_objc); + return in_value.GetCompilerType().IsPossibleDynamicType (NULL, check_cxx, check_objc); } bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, - Address &dynamic_address) + Address &dynamic_address, + Value::ValueType &value_type) { // For Itanium, if the type has a vtable pointer in the object, it will be at offset 0 // in the object. That will point to the "address point" within the vtable (not the beginning of the @@ -58,6 +59,7 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, // class_type_or_name.Clear(); + value_type = Value::ValueType::eValueTypeScalar; // Only a pointer or reference type can have a different dynamic and static type: if (CouldHaveDynamicValue (in_value)) @@ -189,7 +191,7 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, type_sp = class_types.GetTypeAtIndex(i); if (type_sp) { - if (type_sp->GetClangFullType().IsCXXClassType()) + if (ClangASTContext::IsCXXClassType(type_sp->GetFullCompilerType ())) { if (log) log->Printf ("0x%16.16" PRIx64 ": static-type = '%s' has multiple matching dynamic types, picking this one: uid={0x%" PRIx64 "}, type-name='%s'\n", @@ -221,8 +223,8 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, // the value we were handed. if (type_sp) { - if (ClangASTContext::AreTypesSame (in_value.GetClangType(), - type_sp->GetClangFullType())) + if (ClangASTContext::AreTypesSame (in_value.GetCompilerType(), + type_sp->GetFullCompilerType ())) { // The dynamic type we found was the same type, // so we don't have a dynamic type here... @@ -268,6 +270,42 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, return class_type_or_name.IsEmpty() == false; } +TypeAndOrName +ItaniumABILanguageRuntime::FixUpDynamicType(const TypeAndOrName& type_and_or_name, + ValueObject& static_value) +{ + CompilerType static_type(static_value.GetCompilerType()); + Flags static_type_flags(static_type.GetTypeInfo()); + + TypeAndOrName ret(type_and_or_name); + if (type_and_or_name.HasType()) + { + // The type will always be the type of the dynamic object. If our parent's type was a pointer, + // then our type should be a pointer to the type of the dynamic object. If a reference, then the original type + // should be okay... + CompilerType orig_type = type_and_or_name.GetCompilerType(); + CompilerType corrected_type = orig_type; + if (static_type_flags.AllSet(eTypeIsPointer)) + corrected_type = orig_type.GetPointerType (); + else if (static_type_flags.AllSet(eTypeIsReference)) + corrected_type = orig_type.GetLValueReferenceType(); + ret.SetCompilerType(corrected_type); + } + else + { + // If we are here we need to adjust our dynamic type name to include the correct & or * symbol + std::string corrected_name (type_and_or_name.GetName().GetCString()); + if (static_type_flags.AllSet(eTypeIsPointer)) + corrected_name.append(" *"); + else if (static_type_flags.AllSet(eTypeIsReference)) + corrected_name.append(" &"); + // the parent type should be a correctly pointer'ed or referenc'ed type + ret.SetCompilerType(static_type); + ret.SetName(corrected_name.c_str()); + } + return ret; +} + bool ItaniumABILanguageRuntime::IsVTableName (const char *name) { @@ -420,6 +458,7 @@ ItaniumABILanguageRuntime::CreateExceptionResolver (Breakpoint *bkpt, bool catch exception_names.data(), exception_names.size(), eFunctionNameTypeBase, + eLanguageTypeUnknown, eLazyBoolNo)); return resolver_sp; diff --git a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h index bc5d83be4bf5..519a3cee36d6 100644 --- a/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h +++ b/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h @@ -1,4 +1,4 @@ -//===-- ItaniumABILanguageRuntime.h ----------------------------------------*- C++ -*-===// +//===-- ItaniumABILanguageRuntime.h -----------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -12,6 +12,8 @@ // C Includes // C++ Includes +#include <vector> + // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" @@ -20,28 +22,13 @@ #include "lldb/Target/CPPLanguageRuntime.h" #include "lldb/Core/Value.h" -#include <map> -#include <vector> - namespace lldb_private { class ItaniumABILanguageRuntime : public lldb_private::CPPLanguageRuntime { public: - ~ItaniumABILanguageRuntime() { } - - virtual bool - IsVTableName (const char *name); - - virtual bool - GetDynamicTypeAndAddress (ValueObject &in_value, - lldb::DynamicValueType use_dynamic, - TypeAndOrName &class_type_or_name, - Address &address); - - virtual bool - CouldHaveDynamicValue (ValueObject &in_value); + ~ItaniumABILanguageRuntime() override = default; //------------------------------------------------------------------ // Static Functions @@ -58,38 +45,54 @@ namespace lldb_private { static lldb_private::ConstString GetPluginNameStatic(); - //------------------------------------------------------------------ - // PluginInterface protocol - //------------------------------------------------------------------ - virtual lldb_private::ConstString - GetPluginName(); + bool + IsVTableName(const char *name) override; - virtual uint32_t - GetPluginVersion(); + bool + GetDynamicTypeAndAddress(ValueObject &in_value, + lldb::DynamicValueType use_dynamic, + TypeAndOrName &class_type_or_name, + Address &address, + Value::ValueType &value_type) override; - virtual void - SetExceptionBreakpoints (); + TypeAndOrName + FixUpDynamicType(const TypeAndOrName& type_and_or_name, + ValueObject& static_value) override; - virtual void - ClearExceptionBreakpoints (); + bool + CouldHaveDynamicValue(ValueObject &in_value) override; - virtual bool - ExceptionBreakpointsAreSet (); + void + SetExceptionBreakpoints() override; - virtual bool - ExceptionBreakpointsExplainStop (lldb::StopInfoSP stop_reason); + void + ClearExceptionBreakpoints() override; + + bool + ExceptionBreakpointsAreSet() override; + + bool + ExceptionBreakpointsExplainStop(lldb::StopInfoSP stop_reason) override; - virtual lldb::BreakpointResolverSP - CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp); + lldb::BreakpointResolverSP + CreateExceptionResolver(Breakpoint *bkpt, bool catch_bp, bool throw_bp) override; - virtual lldb::SearchFilterSP - CreateExceptionSearchFilter (); + lldb::SearchFilterSP + CreateExceptionSearchFilter() override; - virtual size_t - GetAlternateManglings(const ConstString &mangled, std::vector<ConstString> &alternates); + size_t + GetAlternateManglings(const ConstString &mangled, std::vector<ConstString> &alternates) override; - protected: + //------------------------------------------------------------------ + // PluginInterface protocol + //------------------------------------------------------------------ + lldb_private::ConstString + GetPluginName() override; + + uint32_t + GetPluginVersion() override; + protected: lldb::BreakpointResolverSP CreateExceptionResolver (Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions); @@ -107,4 +110,4 @@ namespace lldb_private { } // namespace lldb_private -#endif // liblldb_ItaniumABILanguageRuntime_h_ +#endif // liblldb_ItaniumABILanguageRuntime_h_ |