[Lldb-commits] [lldb] 6385c2a - [AppleObjCRuntimeV2] Force lazily allocated class names to be resolved.
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 20 13:48:50 PDT 2020
Yes, I’m working on a fix.
Can you use regular expressions or globs in FileCheck matching? It means if you ever add a test that makes an expression above this test in the file, you have to go renumber everything. That's kind of annoying even if the numbering was still working, and you aren’t testing the expression results numbering here anyway…
Jim
> On Mar 20, 2020, at 1:44 PM, Davidino Italiano via lldb-commits <lldb-commits at lists.llvm.org> wrote:
>
>
>
>> On Mar 20, 2020, at 1:43 PM, Davide Italiano via lldb-commits <lldb-commits at lists.llvm.org> wrote:
>>
>>
>> Author: Davide Italiano
>> Date: 2020-03-20T13:43:08-07:00
>> New Revision: 6385c2ab8ff8304eafa822012c40934690bde124
>>
>> URL: https://github.com/llvm/llvm-project/commit/6385c2ab8ff8304eafa822012c40934690bde124
>> DIFF: https://github.com/llvm/llvm-project/commit/6385c2ab8ff8304eafa822012c40934690bde124.diff
>>
>> LOG: [AppleObjCRuntimeV2] Force lazily allocated class names to be resolved.
>>
>> Fixes a couple of tests on new versions of the Obj-C runtime.
>>
>> Added:
>>
>>
>> Modified:
>> lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>> lldb/test/Shell/ExecControl/StopHook/stop-hook.test
>>
>> Removed:
>>
>>
>>
>> ################################################################################
>> diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>> index 9fea9a217dce..4a07c792eebb 100644
>> --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>> +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
>> @@ -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;
>> }
>>
>>
>> diff --git a/lldb/test/Shell/ExecControl/StopHook/stop-hook.test b/lldb/test/Shell/ExecControl/StopHook/stop-hook.test
>> index a06de6634ea1..7e5b37b63854 100644
>> --- a/lldb/test/Shell/ExecControl/StopHook/stop-hook.test
>> +++ b/lldb/test/Shell/ExecControl/StopHook/stop-hook.test
>> @@ -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.
>
> This is an unfortunate side effect of SetResultInternal not working in the expression parser.
> Jim Ingham is fixing this, to the best of my knowledge.
>
> —
> Davide
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
More information about the lldb-commits
mailing list