9#include "clang/AST/DeclCXX.h"
13#include "llvm/Support/ErrorExtras.h"
45 if (type_flags.
AllClear(eTypeHasValue)) {
54 size_t ptr_size = process_sp->GetAddressByteSize();
58 auto read_field = [&](
size_t slot) {
59 return llvm::expectedToOptional(
60 process_sp->ReadPointerFromMemory(ptr + slot * ptr_size));
63 std::optional<lldb::addr_t> name = read_field(1);
66 std::optional<lldb::addr_t> reason = read_field(2);
69 std::optional<lldb::addr_t> userinfo = read_field(3);
72 std::optional<lldb::addr_t> reserved = read_field(4);
89 ByteOrder byte_order = process_sp->GetByteOrder();
97 name, data_source.GetAsData(byte_order), exe_ref, voidstar);
100 name, data_source.GetAsData(byte_order), exe_ref, voidstar);
103 set_sp(
"name", name_isw, name_sp);
104 set_sp(
"reason", reason_isw, reason_sp);
105 set_sp(
"userInfo", userinfo_isw, userinfo_sp);
106 set_sp(
"reserved", reserved_isw, reserved_sp);
114 if (!
ExtractFields(valobj,
nullptr, &reason_sp,
nullptr,
nullptr,
119 stream.
Printf(
"No reason");
125 !reason_str_summary.
Empty()) {
171 static constexpr llvm::StringLiteral g_name(
"name");
172 static constexpr llvm::StringLiteral g_reason(
"reason");
173 static constexpr llvm::StringLiteral g_userInfo(
"userInfo");
174 static constexpr llvm::StringLiteral g_reserved(
"reserved");
175 if (name == g_name)
return 0;
176 if (name == g_reason)
return 1;
177 if (name == g_userInfo)
return 2;
178 if (name == g_reserved)
return 3;
179 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
202 if (!descriptor.get() || !descriptor->IsValid())
205 const char *class_name = descriptor->GetClassName().GetCString();
207 if (!class_name || !*class_name)
210 if (!strcmp(class_name,
"NSException"))
212 else if (!strcmp(class_name,
"NSCFException"))
214 else if (!strcmp(class_name,
"__NSCFException"))
static bool ExtractFields(ValueObject &valobj, ValueObjectSP *name_sp, ValueObjectSP *reason_sp, ValueObjectSP *userinfo_sp, ValueObjectSP *reserved_sp, bool owned_by_valobj)
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
ValueObjectSP m_userinfo_sp
llvm::Expected< uint32_t > CalculateNumChildren() override
~NSExceptionSyntheticFrontEnd() override=default
ValueObjectSP m_reserved_sp
llvm::Expected< size_t > GetIndexOfChildWithName(ConstString name) override
Determine the index of a named child.
ValueObjectSP m_reason_sp
NSExceptionSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp)
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
Generic representation of a type in a programming language.
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
A uniqued constant string class.
Execution context objects refer to objects in the execution of the program that is being debugged.
bool AllClear(ValueType mask) const
Test if all bits in mask are clear.
std::shared_ptr< ClassDescriptor > ClassDescriptorSP
static ObjCLanguageRuntime * Get(Process &process)
virtual ClassDescriptorSP GetClassDescriptor(ValueObject &in_value)
static lldb::TypeSystemClangSP GetForTarget(Target &target, std::optional< IsolatedASTKind > ast_kind=DefaultAST, bool create_on_demand=true)
Returns the scratch TypeSystemClang for the given target.
const char * GetData() const
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
SyntheticChildrenFrontEnd(ValueObject &backend)
lldb::ProcessSP GetProcessSP() const
virtual uint64_t GetValueAsUnsigned(uint64_t fail_value, bool *success=nullptr)
virtual bool IsBaseClass()
CompilerType GetCompilerType()
virtual ValueObject * GetParent()
static lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type, ValueObject *parent=nullptr)
const ExecutionContextRef & GetExecutionContextRef() const
lldb::ValueObjectSP CreateChildValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
@ eRefetch
Children need to be recomputed dynamically.
@ eReuse
Children did not change and don't need to be recomputed; re-use what we computed the last time we cal...
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::shared_ptr< lldb_private::Process > ProcessSP
ByteOrder
Byte ordering definitions.
std::shared_ptr< lldb_private::TypeSystemClang > TypeSystemClangSP