9#include "clang/AST/DeclCXX.h"
13#include "llvm/Support/ErrorExtras.h"
43 if (type_flags.
AllClear(eTypeHasValue)) {
52 size_t ptr_size = process_sp->GetAddressByteSize();
55 auto name = process_sp->ReadPointerFromMemory(ptr + 1 * ptr_size,
error);
58 auto reason = process_sp->ReadPointerFromMemory(ptr + 2 * ptr_size,
error);
61 auto userinfo = process_sp->ReadPointerFromMemory(ptr + 3 * ptr_size,
error);
64 auto reserved = process_sp->ReadPointerFromMemory(ptr + 4 * ptr_size,
error);
81 ByteOrder byte_order = process_sp->GetByteOrder();
89 name, data_source.GetAsData(byte_order), exe_ref, voidstar);
92 name, data_source.GetAsData(byte_order), exe_ref, voidstar);
95 set_sp(
"name", name_isw, name_sp);
96 set_sp(
"reason", reason_isw, reason_sp);
97 set_sp(
"userInfo", userinfo_isw, userinfo_sp);
98 set_sp(
"reserved", reserved_isw, reserved_sp);
106 if (!
ExtractFields(valobj,
nullptr, &reason_sp,
nullptr,
nullptr,
111 stream.
Printf(
"No reason");
117 !reason_str_summary.
Empty()) {
167 if (name == g_name)
return 0;
168 if (name == g_reason)
return 1;
169 if (name == g_userInfo)
return 2;
170 if (name == g_reserved)
return 3;
171 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
194 if (!descriptor.get() || !descriptor->IsValid())
197 const char *class_name = descriptor->GetClassName().GetCString();
199 if (!class_name || !*class_name)
202 if (!strcmp(class_name,
"NSException"))
204 else if (!strcmp(class_name,
"NSCFException"))
206 else if (!strcmp(class_name,
"__NSCFException"))
static llvm::raw_ostream & error(Stream &strm)
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