mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-09 01:29:52 +00:00
[AppleObjCRuntimeV2] Force lazily allocated class names to be resolved.
Fixes a couple of tests on new versions of the Obj-C runtime.
This commit is contained in:
parent
40fc80a023
commit
6385c2ab8f
@ -1175,6 +1175,28 @@ AppleObjCRuntimeV2::GetClassDescriptorFromISA(ObjCISA isa) {
|
||||
return class_descriptor_sp;
|
||||
}
|
||||
|
||||
static std::pair<bool, ConstString> ObjCGetClassNameRaw(
|
||||
AppleObjCRuntime::ObjCISA isa,
|
||||
Process *process) {
|
||||
StreamString expr_string;
|
||||
std::string input = std::to_string(isa);
|
||||
expr_string.Printf("(const char *)objc_debug_class_getNameRaw(%s)",
|
||||
input.c_str());
|
||||
|
||||
ValueObjectSP result_sp;
|
||||
EvaluateExpressionOptions eval_options;
|
||||
eval_options.SetLanguage(lldb::eLanguageTypeObjC);
|
||||
eval_options.SetResultIsInternal(true);
|
||||
eval_options.SetGenerateDebugInfo(true);
|
||||
eval_options.SetTimeout(process->GetUtilityExpressionTimeout());
|
||||
auto eval_result = process->GetTarget().EvaluateExpression(
|
||||
expr_string.GetData(),
|
||||
process->GetThreadList().GetSelectedThread()->GetSelectedFrame().get(),
|
||||
result_sp, eval_options);
|
||||
ConstString type_name(result_sp->GetSummaryAsCString());
|
||||
return std::make_pair(eval_result == eExpressionCompleted, type_name);
|
||||
}
|
||||
|
||||
ObjCLanguageRuntime::ClassDescriptorSP
|
||||
AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {
|
||||
ClassDescriptorSP objc_class_sp;
|
||||
@ -1210,7 +1232,10 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {
|
||||
return objc_class_sp;
|
||||
|
||||
objc_class_sp = GetClassDescriptorFromISA(isa);
|
||||
if (isa && !objc_class_sp) {
|
||||
|
||||
if (objc_class_sp)
|
||||
return objc_class_sp;
|
||||
else {
|
||||
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS |
|
||||
LIBLLDB_LOG_TYPES));
|
||||
LLDB_LOGF(log,
|
||||
@ -1219,6 +1244,13 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {
|
||||
"not in class descriptor cache 0x%" PRIx64,
|
||||
isa_pointer, isa);
|
||||
}
|
||||
|
||||
ClassDescriptorSP descriptor_sp(new ClassDescriptorV2(*this, isa, nullptr));
|
||||
auto resolved = ObjCGetClassNameRaw(isa, process);
|
||||
if (resolved.first == true) {
|
||||
AddClass(isa, descriptor_sp, resolved.second.AsCString());
|
||||
objc_class_sp = descriptor_sp;
|
||||
}
|
||||
return objc_class_sp;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ run
|
||||
thread step-over
|
||||
# Stepping inside of the stop hook range
|
||||
# CHECK: (lldb) thread step-over
|
||||
# CHECK-NEXT: (void *) $1 = 0x
|
||||
# CHECK-NEXT: (void *) $2 = 0x
|
||||
# CHECK: ->{{.*}} // We should stop here after stepping.
|
||||
|
||||
process continue
|
||||
|
Loading…
Reference in New Issue
Block a user