13#include "clang/AST/Type.h"
52 class_type_or_name.
Clear();
56 if (class_descriptor && class_descriptor->IsValid() &&
57 class_descriptor->GetClassName()) {
60 class_type_or_name.
SetName(class_descriptor->GetClassName());
63 return !class_type_or_name.
IsEmpty();
98 bool catch_bp,
bool throw_bp) {
102 resolver_sp = std::make_shared<BreakpointResolverName>(
114llvm::Expected<std::unique_ptr<UtilityFunction>>
117 std::unique_ptr<BufStruct> buf(
new BufStruct);
120 snprintf(&buf->contents[0],
sizeof(buf->contents),
121 "struct __objc_class "
125 " struct __objc_class *isa; "
127 " struct __objc_class *super_class; "
129 " const char *name; "
131 " // rest of struct elided because unused "
137 "struct __objc_object "
141 " struct __objc_class *isa; "
149 "%s(void *$__lldb_arg_obj, void *$__lldb_arg_selector) "
153 " struct __objc_object *obj = (struct "
154 "__objc_object*)$__lldb_arg_obj; \n"
155 " if ($__lldb_arg_obj == (void *)0) "
157 " return; // nil is ok "
158 " (int)strlen(obj->isa->name); "
163 assert(strformatsize < (
int)
sizeof(buf->contents));
182 if (!isa || !process_sp) {
191 m_isa = process_sp->ReadPointerFromMemory(isa,
error);
198 uint32_t ptr_size = process_sp->GetAddressByteSize();
200 if (!IsPointerValid(m_isa, ptr_size)) {
205 m_parent_isa = process_sp->ReadPointerFromMemory(m_isa + ptr_size,
error);
212 if (!IsPointerValid(m_parent_isa, ptr_size,
true)) {
218 process_sp->ReadPointerFromMemory(m_isa + 2 * ptr_size,
error);
227 size_t count = process_sp->ReadCStringFromMemory(
228 name_ptr, (
char *)buffer_sp->GetBytes(), 1024,
error);
236 m_name =
ConstString(
reinterpret_cast<const char *
>(buffer_sp->GetBytes()));
240 m_instance_size = process_sp->ReadUnsignedIntegerFromMemory(
241 m_isa + 5 * ptr_size, ptr_size, 0,
error);
255 ProcessSP process_sp = m_process_wp.lock();
269 std::function<
bool(
const char *,
const char *)>
const &instance_method_func,
270 std::function<
bool(
const char *,
const char *)>
const &class_method_func,
271 std::function<
bool(
const char *,
const char *,
lldb::addr_t,
272 uint64_t)>
const &ivar_func)
const {
287 static ConstString g_objc_debug_class_hash(
"_objc_debug_class_hash");
289 const Symbol *symbol = objc_module_sp->FindFirstSymbolWithNameAndType(
302 if (objc_debug_class_hash_ptr != 0 &&
324 ProcessSP process_sp = process->shared_from_this();
352 const uint32_t count = data.
GetU32(&offset);
353 const uint32_t num_buckets = data.
GetU32(&offset);
358 const uint32_t data_size = num_buckets * 2 *
sizeof(uint32_t);
362 error) == data_size) {
365 for (uint32_t bucket_idx = 0; bucket_idx < num_buckets;
367 const uint32_t bucket_isa_count = data.
GetU32(&offset);
370 if (bucket_isa_count == 0)
374 if (bucket_isa_count == 1) {
385 "AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
386 " from _objc_debug_class_hash to "
387 "isa->descriptor cache",
396 addr_t isa_addr = bucket_data;
397 for (uint32_t isa_idx = 0; isa_idx < bucket_isa_count;
398 ++isa_idx, isa_addr += addr_size) {
409 "AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
410 " from _objc_debug_class_hash to isa->descriptor "
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOGF(log,...)
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
void SetRawAddress(lldb::addr_t addr)
void Initialize(ObjCISA isa, lldb::ProcessSP process_sp)
ClassDescriptorSP GetSuperclass() override
ClassDescriptorSP GetMetaclass() const override
bool Describe(std::function< void(ObjCLanguageRuntime::ObjCISA)> const &superclass_func, std::function< bool(const char *, const char *)> const &instance_method_func, std::function< bool(const char *, const char *)> const &class_method_func, std::function< bool(const char *, const char *, lldb::addr_t, uint64_t)> const &ivar_func) const override
ClassDescriptorV1(ValueObject &isa_pointer)
void UpdateSignature(uint32_t count, uint32_t num_buckets, lldb::addr_t buckets_ptr)
bool NeedsUpdate(uint32_t count, uint32_t num_buckets, lldb::addr_t buckets_ptr)
DeclVendor * GetDeclVendor() override
void UpdateISAToDescriptorMapIfNeeded() override
lldb::addr_t GetTaggedPointerObfuscator()
static llvm::StringRef GetPluginNameStatic()
lldb::BreakpointResolverSP CreateExceptionResolver(const lldb::BreakpointSP &bkpt, bool catch_bp, bool throw_bp) override
lldb::addr_t m_isa_hash_table_ptr
bool GetDynamicTypeAndAddress(ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_name, Address &address, Value::ValueType &value_type) override
llvm::Expected< std::unique_ptr< UtilityFunction > > CreateObjectChecker(std::string, ExecutionContext &exe_ctx) override
static lldb_private::LanguageRuntime * CreateInstance(Process *process, lldb::LanguageType language)
lldb::addr_t GetISAHashTablePointer()
HashTableSignature m_hash_signature
AppleObjCRuntimeV1(Process *process)
static std::tuple< FileSpec, ConstString > GetExceptionThrowLocation()
static ObjCRuntimeVersions GetObjCVersion(Process *process, lldb::ModuleSP &objc_module_sp)
lldb::ModuleSP GetObjCModule()
bool CouldHaveDynamicValue(ValueObject &in_value) override
A uniqued constant string class.
A subclass of DataBuffer that stores a data buffer on the heap.
lldb::offset_t GetByteSize() const override
Get the number of bytes in the data buffer.
lldb::offset_t SetByteSize(lldb::offset_t byte_size)
Set the number of bytes in the data buffer.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
uint32_t m_isa_to_descriptor_stop_id
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
bool AddClass(ObjCISA isa, const ClassDescriptorSP &descriptor_sp)
bool ISAIsCached(ObjCISA isa) const
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
static lldb::BreakpointPreconditionSP GetBreakpointExceptionPrecondition(lldb::LanguageType language, bool throw_bp)
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
A plug-in interface definition class for debugging a process.
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
lldb::ByteOrder GetByteOrder() const
lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Status &error)
uint32_t GetAddressByteSize() const
uint32_t GetStopID() const
Target & GetTarget()
Get the target object pointer for this module.
bool ValueIsAddress() const
Address & GetAddressRef()
llvm::Expected< std::unique_ptr< UtilityFunction > > CreateUtilityFunction(std::string expression, std::string name, lldb::LanguageType language, ExecutionContext &exe_ctx)
Creates and installs a UtilityFunction for the given language.
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
void SetName(ConstString type_name)
lldb::addr_t GetPointerValue(AddressType *address_type=nullptr)
lldb::ProcessSP GetProcessSP() const
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
ValueType
Type that describes Value::m_value.
@ Scalar
A raw scalar value.
uint8_t * GetBytes()
Get a pointer to the data.
#define UNUSED_IF_ASSERT_DISABLED(x)
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::BreakpointResolver > BreakpointResolverSP
LanguageType
Programming language type.
@ eLanguageTypeUnknown
Unknown or invalid language value.
@ eLanguageTypeC
Non-standardized C, such as K&R.
@ eLanguageTypeObjC
Objective-C.
std::shared_ptr< lldb_private::Breakpoint > BreakpointSP
std::shared_ptr< lldb_private::Process > ProcessSP
ByteOrder
Byte ordering definitions.
std::weak_ptr< lldb_private::Process > ProcessWP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
std::shared_ptr< lldb_private::Module > ModuleSP