summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Target/ObjCLanguageRuntime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Target/ObjCLanguageRuntime.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Target/ObjCLanguageRuntime.cpp93
1 files changed, 91 insertions, 2 deletions
diff --git a/contrib/llvm/tools/lldb/source/Target/ObjCLanguageRuntime.cpp b/contrib/llvm/tools/lldb/source/Target/ObjCLanguageRuntime.cpp
index b182407..e54dd5b 100644
--- a/contrib/llvm/tools/lldb/source/Target/ObjCLanguageRuntime.cpp
+++ b/contrib/llvm/tools/lldb/source/Target/ObjCLanguageRuntime.cpp
@@ -15,6 +15,7 @@
#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
@@ -34,11 +35,15 @@ ObjCLanguageRuntime::~ObjCLanguageRuntime()
ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) :
LanguageRuntime (process),
+ m_impl_cache(),
m_has_new_literals_and_indexing (eLazyBoolCalculate),
m_isa_to_descriptor(),
- m_isa_to_descriptor_stop_id (UINT32_MAX)
+ m_hash_to_isa_map(),
+ m_type_size_cache(),
+ m_isa_to_descriptor_stop_id (UINT32_MAX),
+ m_complete_class_cache(),
+ m_negative_complete_class_cache()
{
-
}
bool
@@ -492,6 +497,18 @@ ObjCLanguageRuntime::GetDescriptorIterator (const ConstString &name)
return end;
}
+std::pair<ObjCLanguageRuntime::ISAToDescriptorIterator,ObjCLanguageRuntime::ISAToDescriptorIterator>
+ObjCLanguageRuntime::GetDescriptorIteratorPair (bool update_if_needed)
+{
+ if (update_if_needed)
+ UpdateISAToDescriptorMapIfNeeded();
+
+ return std::pair<ObjCLanguageRuntime::ISAToDescriptorIterator,
+ ObjCLanguageRuntime::ISAToDescriptorIterator>(
+ m_isa_to_descriptor.begin(),
+ m_isa_to_descriptor.end());
+}
+
ObjCLanguageRuntime::ObjCISA
ObjCLanguageRuntime::GetParentClass(ObjCLanguageRuntime::ObjCISA isa)
@@ -626,3 +643,75 @@ ObjCLanguageRuntime::GetEncodingToType ()
{
return nullptr;
}
+
+bool
+ObjCLanguageRuntime::GetTypeBitSize (const ClangASTType& clang_type,
+ uint64_t &size)
+{
+ void *opaque_ptr = clang_type.GetQualType().getAsOpaquePtr();
+ size = m_type_size_cache.Lookup(opaque_ptr);
+ // an ObjC object will at least have an ISA, so 0 is definitely not OK
+ if (size > 0)
+ return true;
+
+ ClassDescriptorSP class_descriptor_sp = GetClassDescriptorFromClassName(clang_type.GetTypeName());
+ if (!class_descriptor_sp)
+ return false;
+
+ int32_t max_offset = INT32_MIN;
+ uint64_t sizeof_max = 0;
+ bool found = false;
+
+ for (size_t idx = 0;
+ idx < class_descriptor_sp->GetNumIVars();
+ idx++)
+ {
+ const auto& ivar = class_descriptor_sp->GetIVarAtIndex(idx);
+ int32_t cur_offset = ivar.m_offset;
+ if (cur_offset > max_offset)
+ {
+ max_offset = cur_offset;
+ sizeof_max = ivar.m_size;
+ found = true;
+ }
+ }
+
+ size = 8 * (max_offset + sizeof_max);
+ if (found)
+ m_type_size_cache.Insert(opaque_ptr, size);
+
+ return found;
+}
+
+//------------------------------------------------------------------
+// Exception breakpoint Precondition class for ObjC:
+//------------------------------------------------------------------
+void
+ObjCLanguageRuntime::ObjCExceptionPrecondition::AddClassName(const char *class_name)
+{
+ m_class_names.insert(class_name);
+}
+
+ObjCLanguageRuntime::ObjCExceptionPrecondition::ObjCExceptionPrecondition()
+{
+}
+
+bool
+ObjCLanguageRuntime::ObjCExceptionPrecondition::EvaluatePrecondition(StoppointCallbackContext &context)
+{
+ return true;
+}
+
+void
+ObjCLanguageRuntime::ObjCExceptionPrecondition::DescribePrecondition(Stream &stream, lldb::DescriptionLevel level)
+{
+}
+
+Error
+ObjCLanguageRuntime::ObjCExceptionPrecondition::ConfigurePrecondition(Args &args)
+{
+ Error error;
+ if (args.GetArgumentCount() > 0)
+ error.SetErrorString("The ObjC Exception breakpoint doesn't support extra options.");
+ return error;
+}
OpenPOWER on IntegriCloud