Quantcast
Channel: LLDB - Swift Forums
Viewing all articles
Browse latest Browse all 40

LLDB Negative Cache

$
0
0

In Xcode, the LLDB variables view always beachballs for a bit when debugging a Swift file with type aliases referencing other typealiases.

Here’s the relevant source code:

open class SomeWorkflowStep<A, B> {}

public typealias SomeParameterType = Bool
public typealias SomeReferencingAliasV3 = SomeWorkflowStep<SomeParameterType, Bool>

class ReproV2 {
    let someReferencingAlias: SomeReferencingAliasV3?
    init(someReferencingAlias: SomeReferencingAliasV3? = nil) {
        self.someReferencingAlias = someReferencingAlias // breakpoint was added on this line.
    }
}

LLDB type logs show:

SwiftASTContextForModule("MyApplication")::SwiftDWARFImporterDelegate::lookupValue("SomeReferencingAliasV3")
TypeSystemSwiftTypeRef("MyApplication")::SwiftDWARFImporterForClangTypes::lookupValue("SomeReferencingAliasV3")
SwiftDWARFImporterDelegate::lookupValue() -- imported 0 types from debug info.
ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- not found
ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache

Since its not able to find the type, it does a global lookup which takes significant time in our setup given ours is a heavy application.

Couldn't compute size of type $s21MyApplicationMainLib22SomeReferencingAliasV3aSgD using SwiftLanguageRuntime.
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::GetBitSize() -- Input type is nullptr, bailing out.
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 Couldn't compute size of type $s21MyApplicationMainLib22SomeReferencingAliasV3aSgD using SwiftLanguageRuntime.
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::GetBitSize() -- Input type is nullptr, bailing out.
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 Couldn't compute size of type $s21MyApplicationMainLib22SomeReferencingAliasV3aSgD using SwiftLanguageRuntime.
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::GetBitSize() -- Input type is nullptr, bailing out.
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 TypeSystemSwiftTypeRefForExpressions::TypeSystemSwiftTypeRefForExpressions()
 returned project-wide scratch context
 returned project-wide scratch context
 returned project-wide scratch context
 dynamic type of instance_ptr 0x600000213620 is $s21MyApplicationMainLib7ReproV2CD
 [self 0x5cdf30e00] might have a dynamic type
 [self 0x5cdf30e00] has a new dynamic type MyApplicationMainLib.ReproV2
 returned project-wide scratch context
 dynamic type of instance_ptr 0x600000213620 is $s21MyApplicationMainLib7ReproV2CD
 dynamic type of instance_ptr 0x600000213620 is $s21MyApplicationMainLib7ReproV2CD
 dynamic type of instance_ptr 0x600000213620 is $s21MyApplicationMainLib7ReproV2CD
 dynamic type of instance_ptr 0x600000213620 is $s21MyApplicationMainLib7ReproV2CD
 dynamic type of instance_ptr 0x600000213620 is $s21MyApplicationMainLib7ReproV2CD
 dynamic type of instance_ptr 0x600000213620 is $s21MyApplicationMainLib7ReproV2CD
 returned project-wide scratch context
 returned project-wide scratch context
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache
 SwiftASTContextForModule("MyApplication")::ReconstructTypeImpl("$s21MyApplicationMainLib22SomeReferencingAliasV3aSgD") -- found in the negative cache

  1. -ast-paths are valid, and the module is found as per LLDB logs.
    • SwiftASTContextForModule("MyApplication")::GetASTBuffersFromModule() -- Found 1189 AST file data entries in .../../MyApplication
  2. When I replace the typealias refereing other typealias with a Bool, or a struct, class - it all works fine and there are no negative cache issues reported in the lldb logs. The beachballing issue resolves, and the variables view loads seamlessly without any noticeable delays.
  3. swift-healthcheck is all okay.
  4. I believe this might be specific to our project, but if anyone has any insights or suggestions, that would be super helpful.

8 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 40

Trending Articles