Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lldb: Unchecked Expected<T> contained error: invalid type #9183

Open
rjmansfield opened this issue Aug 26, 2024 · 0 comments
Open

lldb: Unchecked Expected<T> contained error: invalid type #9183

rjmansfield opened this issue Aug 26, 2024 · 0 comments

Comments

@rjmansfield
Copy link

rjmansfield commented Aug 26, 2024

~/swift-DEVELOPMENT-SNAPSHOT-2024-07-03-a-ubuntu22.04/usr/bin/lldb  ~/date 
(lldb) target create "/home/ryan_mansfield/date"
Current executable set to '/home/ryan_mansfield/date' (x86_64).
(lldb) b LockedState.swift:115
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) r
Process 1592276 launched: '/home/ryan_mansfield/date' (x86_64)
2 locations added to breakpoint 1
Process 1592276 stopped
* thread #1, name = 'date', stop reason = breakpoint 1.1
    frame #0: 0x00007ffff719ada5 libFoundationEssentials.so`LockedState.withLock<A>(_:) [inlined] closure #1 (state=<unavailable>, lock=0x555555570cc0, body=0x00007ffff722dee0 libFoundationEssentials.so`closure #1 @Sendable (inout Swift.Optional<FoundationEssentials._CalendarProtocol>) -> Swift.Optional<FoundationEssentials._CalendarProtocol> in FoundationEssentials.CalendarCache.current.getter : FoundationEssentials._CalendarProtocol at Calendar_Cache.swift:51) throws -> τ_1_0 in FoundationEssentials.LockedState.withLockUnchecked<τ_0_0>((inout τ_0_0) throws -> τ_1_0) throws -> τ_1_0 at LockedState.swift:117:24 [opt]
   114 	        try _buffer.withUnsafeMutablePointers { state, lock in
   115 	            _Lock.lock(lock)
   116 	            defer { _Lock.unlock(lock) }
-> 117 	            return try body(&state.pointee)
   118 	        }
   119 	    }
   120 	
Target 1: (date) stopped.
warning: libFoundationEssentials.so was compiled with optimization - stepping may behave oddly; variables may not be available.
error: ld-linux-x86-64.so.2 0x00001c42: DW_TAG_member '__size' refers to type 0x0000000000001c5b which extends beyond the bounds of 0x00001c2d
(lldb) s
Process 1592276 stopped
* thread #1, name = 'date', stop reason = step in
    frame #0: 0x00007ffff722def5 libFoundationEssentials.so`closure #1 in CalendarCache.current.getter($0=<unavailable>) at Calendar_Cache.swift:51:48 [opt]
   48  	    }
   49  	    
   50  	    var current: any _CalendarProtocol {
-> 51  	        if let result = _current.withLock({ $0 }) {
   52  	            return result
   53  	        }
   54  	                        
Target 1: (date) stopped.
(lldb) s
Process 1592276 stopped
* thread #1, name = 'date', stop reason = step in
    frame #0: 0x00007ffff719adb3 libFoundationEssentials.so`LockedState.withLock<A>(_:) [inlined] closure #1 (state=<unavailable>, lock=0x555555570cc0, body=0x00007ffff722dee0 libFoundationEssentials.so`closure #1 @Sendable (inout Swift.Optional<FoundationEssentials._CalendarProtocol>) -> Swift.Optional<FoundationEssentials._CalendarProtocol> in FoundationEssentials.CalendarCache.current.getter : FoundationEssentials._CalendarProtocol at Calendar_Cache.swift:51) throws -> τ_1_0 in FoundationEssentials.LockedState.withLockUnchecked<τ_0_0>((inout τ_0_0) throws -> τ_1_0) throws -> τ_1_0 at LockedState.swift:117:24 [opt]
   114 	        try _buffer.withUnsafeMutablePointers { state, lock in
   115 	            _Lock.lock(lock)
   116 	            defer { _Lock.unlock(lock) }
-> 117 	            return try body(&state.pointee)
   118 	        }
   119 	    }
   120 	
Target 1: (date) stopped.
(lldb) s
Process 1592276 stopped
* thread #1, name = 'date', stop reason = step in
    frame #0: 0x00007ffff719adb6 libFoundationEssentials.so`LockedState.withLock<A>(_:) [inlined] $defer<τ_0_0><τ_1_0>(lock=<unavailable>) -> () at LockedState.swift:116:27 [opt]
   113 	    package func withLockUnchecked<T>(_ body: (inout State) throws -> T) rethrows -> T {
   114 	        try _buffer.withUnsafeMutablePointers { state, lock in
   115 	            _Lock.lock(lock)
-> 116 	            defer { _Lock.unlock(lock) }
   117 	            return try body(&state.pointee)
   118 	        }
   119 	    }
Target 1: (date) stopped.
(lldb) s
Expected<T> must be checked before access or destruction.
Unchecked Expected<T> contained error:
invalid typeLLDB diagnostics will be written to /tmp/diagnostics-c6f34b
Please include the directory content when filing a bug report
Aborted (core dumped)
$ cat /tmp/diagnostics-c6f34b/diagnostics.log 
libFoundationEssentials.so was compiled with optimization - stepping may behave oddly; variables may not be available.ld-linux-x86-64.so.2 0x00001c42: DW_TAG_member '__size' refers to type 0x0000000000001c5b which extends beyond the bounds of 0x00001c2d
(lldb) log enable lldb formatters 
(lldb) s
dbg.evt-handler  [platformLock 0x7fca14082970] checking for FormatManager revisions. ValueObject rev: 0 - Global rev: 316
dbg.evt-handler  

[format] Looking into cache for type FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock
dbg.evt-handler  [format] Cache search failed. Going normal route
dbg.evt-handler  [Get] candidate match = FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock no-strip-pointers no-strip-reference no-strip-typedef
dbg.evt-handler  [Get] candidate match = Swift.UnsafeMutablePointer<FoundationEssentials.LockedState<τ_0_0>._Lock.Primitive> no-strip-pointers no-strip-reference strip-typedef
dbg.evt-handler  [Get] candidate match = UnsafeMutablePointer<FoundationEssentials.LockedState<τ_0_0>._Lock.Primitive> no-strip-pointers no-strip-reference strip-typedef
dbg.evt-handler  [Get] Trying to use category default
dbg.evt-handler  [Get] Trying to use category VectorTypes
dbg.evt-handler  [Get] Trying to use category runtime-synthetics
dbg.evt-handler  [Get] Trying to use category system
dbg.evt-handler  [Get] nothing found - returning empty SP
dbg.evt-handler  [format] Caching (nil) for type FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock
dbg.evt-handler  [format] Search failed. Giving language a chance.
dbg.evt-handler  [format] Language search success. Returning.
dbg.evt-handler  

[summary] Looking into cache for type FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock
dbg.evt-handler  [summary] Cache search failed. Going normal route
dbg.evt-handler  [Get] candidate match = FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock no-strip-pointers no-strip-reference no-strip-typedef
dbg.evt-handler  [Get] candidate match = Swift.UnsafeMutablePointer<FoundationEssentials.LockedState<τ_0_0>._Lock.Primitive> no-strip-pointers no-strip-reference strip-typedef
dbg.evt-handler  [Get] candidate match = UnsafeMutablePointer<FoundationEssentials.LockedState<τ_0_0>._Lock.Primitive> no-strip-pointers no-strip-reference strip-typedef
dbg.evt-handler  [Get] Trying to use category default
dbg.evt-handler  [Get] Trying to use category VectorTypes
dbg.evt-handler  [Get] Trying to use category runtime-synthetics
dbg.evt-handler  [Get] Trying to use category system
dbg.evt-handler  [Get] nothing found - returning empty SP
dbg.evt-handler  [summary] Caching (nil) for type FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock
dbg.evt-handler  [summary] Search failed. Giving language a chance.
dbg.evt-handler  [summary] Language search success. Returning.
dbg.evt-handler  

[synthetic] Looking into cache for type FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock
dbg.evt-handler  [synthetic] Cache search failed. Going normal route
dbg.evt-handler  [Get] candidate match = FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock no-strip-pointers no-strip-reference no-strip-typedef
dbg.evt-handler  [Get] candidate match = Swift.UnsafeMutablePointer<FoundationEssentials.LockedState<τ_0_0>._Lock.Primitive> no-strip-pointers no-strip-reference strip-typedef
dbg.evt-handler  [Get] candidate match = UnsafeMutablePointer<FoundationEssentials.LockedState<τ_0_0>._Lock.Primitive> no-strip-pointers no-strip-reference strip-typedef
dbg.evt-handler  [Get] Trying to use category default
dbg.evt-handler  [Get] Trying to use category VectorTypes
dbg.evt-handler  [Get] Trying to use category runtime-synthetics
dbg.evt-handler  [Get] Trying to use category system
dbg.evt-handler  [Get] nothing found - returning empty SP
dbg.evt-handler  [synthetic] Caching (nil) for type FoundationEssentials.LockedState<τ_0_0>._Lock.PlatformLock
dbg.evt-handler  [synthetic] Search failed. Giving language a chance.
dbg.evt-handler  [synthetic] Language search success. Returning.
dbg.evt-handler  [platformLock 0x7fca14082970] checking for FormatManager revisions. ValueObject rev: 316 - Global rev: 316
dbg.evt-handler  [platformLock 0x7fca14082970] checking for FormatManager revisions. ValueObject rev: 316 - Global rev: 316
Expected<T> must be checked before access or destruction.
Unchecked Expected<T> contained error:
invalid typeLLDB diagnostics will be written to /tmp/diagnostics-a1e448
Please include the directory content when filing a bug report
Aborted (core dumped)

Originally observed on

Ubuntun 22.04 x86_64-linux-gnu

with:

lldb version 17.0.0 (https://github.com/apple/llvm-project.git revision 834570a)
Swift version 6.1-dev (LLVM 834570a, Swift ad0006307b78d0e)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@rjmansfield and others