The LLDB command-line debugger provides underlying debugging services for development on all Apple platforms.

Posts under LLDB tag

40 Posts
Sort by:
Post not yet marked as solved
19 Replies
2.5k Views
Hi, I have error messages when I try to print some values in debug like "po varname" or "po expression" I have messages: error: expression failed to parse: error: Couldn't realize type of self. I use Xcode without rosetta, 13.3 I tried to clear derived data and clean project, it helps but after relaunch Xcode I have the same problem again
Posted
by AlbertChb.
Last updated
.
Post not yet marked as solved
0 Replies
81 Views
In some particular situation, Xcode debugger or lldb cli cannot correctly extract some value that returned by a async throw function and handled by guard let try?. Here is the minimum example: import Dispatch func test() async throws -> [Int] {   return [369] } let group = DispatchGroup() group.enter() let task = Task {   guard let res = try? await test() else { return }   print(res)   group.leave() } group.wait() If added a break point at print(res), the debugger cannot show the value of res. Due to forum limitation, I cannot paste a screenshot here... if use p res or po res at lldb cli, it shows: (lldb) p res error: expression failed to parse: error: <EXPR>:3:1: error: cannot find 'res' in scope res ^~~ (lldb) po res error: expression failed to parse: error: <EXPR>:3:1: error: cannot find 'res' in scope res ^~~ If test() returns a dict, or a costom struct, the issue retains. But if returned a trivial value like Int, it acts normally. Also, if remove the guard statement, make res a optional value(use let res = try? await test()), debugger can extract the value. Above results are compiled and run in this environment: Swift 5.6.1 Xcode 13.4.1 (13F100) lldb-1316.0.9.46 macOS 12.4 x86_64 arch
Posted
by yh0x13f.
Last updated
.
Post not yet marked as solved
2 Replies
418 Views
I'm getting the error "Cannot create Swift scratch context (couldn't create a ClangImporter)" when running a Swift project in XCode 12.3 on Catalina when I try to use the debugger. There is a resolution of this problem described at https://forums.raywenderlich.com/t/entering-debugger-in-swift-project-couldnt-create-a-clangimporter/130829 but I don't understand the fix of "removing zsh customisations in dotfiles". Can anyone explain what the files to change are and how they have to be changed? (I'm new to Mac development)
Posted Last updated
.
Post not yet marked as solved
1 Replies
248 Views
build and run app not appear app, and not debug(like freeze app) finally, stop running appear this debugger message in debug area Message from debugger: Xcode has killed the LLDB RPC server to allow the debugger to detach from your process. You may need to manually terminate your process. how do i solve it?
Posted
by gpwl.
Last updated
.
Post not yet marked as solved
0 Replies
108 Views
I don’t have a fundamental background in Computer Science or Computing Engineering. I want to learn more about how to do code debugging, but within the bounds of how Xcode provides various debugging panes. I’ve seen a number of WWDC session videos about Xcode and debugging. However I really need to learn more about the fundamentals of using Xcode panes like the stack trace pane, the variables pane, and the debugging console. I would greatly appreciate any advice on tutorials, videos, WWDC sessions, etc. that go to the basic levels of what these panes show, how to interpret the content, and how to interact with the information in various Xcode debugging-related panes. Thank you.
Posted Last updated
.
Post not yet marked as solved
1 Replies
191 Views
We imported pure Swift XCFramework into Swift application. On setting the breaking point and trying the po command the following error is seen error: virtual filesystem overlay file '/Users/rakshitha/Library/Developer/Xcode/DerivedData/ABC-agkiherlqdmvaeakrqtfvsowceuq/Build/Intermediates.noindex/ArchiveIntermediates/ABCDE/IntermediateBuildFilesPath/ABC.build/Release-iphonesimulator/ABCDE.build/all-product-headers.yaml' not found error: virtual filesystem overlay file '/Users/rakshitha/Library/Developer/Xcode/DerivedData/ABC-agkiherlqdmvaeakrqtfvsowceuq/Build/Intermediates.noindex/ArchiveIntermediates/ABCDE/IntermediateBuildFilesPath/MoEngage.build/Release-iphonesimulator/ABCDE.build/all-product-headers.yaml' not found error: couldn't IRGen expression. Please check the above error messages for possible root causes. Solutions Tried: XCFramework was created with dsym and BCSymbolMaps XCFramework created without dsym and BCSymbolMaps Set the Other Swift Flags to -Xfrontend -no-serialize-debugging-options None of the above solutions worked Note: The XCFramework was generated in Xcode 13.4. The Swift version for generated XCFramework is Swift 5. XCFramework contains support for iOS and tvOS. The Sample application was tested in the same Xcode and swift version. Below is the script used to generate XCFramework XCFramework.sh
Posted Last updated
.
Post marked as solved
4 Replies
1.9k Views
similiar to Error when debugging: Cannot creat… | Apple Developer Forums - https://developer.apple.com/forums/thread/651375 Xcode 12 beta 1 po command in de… | Apple Developer Forums - https://developer.apple.com/forums/thread/651157 which do not resolve this issue that I am encountering Description of problem I am seeing an error which prevents using lldb debugger on Swift code/projects. It is seen on any Swift or SwiftUI project that I've tried. This is the error displayed in lldb console when first breakpoint is encountered: Cannot create Swift scratch context (couldn't create a ClangImporter)(lldb)  Xcode Version 12.3 (12C33) macOS Big Sur Intel M1 Troubleshooting I originally thought this was also working on an Intel Mac running Big Sur/Xcode 12.3, but was mistaken. Using my customized shell environment on the following setups, I encounter the same couldn't create a ClangImporter. M1 Mac mini, main account (an "Admin" account) same M1 Mac mini, new "dev" account (an "Admin" account) Intel MBP, main account They are all using an Intel Homebrew install, and my customized shell environment if that provides a clue? I captured some lldb debugging info by putting expr types in ~/.lldbinit but the outputs were basically identical (when discounting scratch file paaths and memory addresses) compared to the "working clean" account log (described below) log enable -f /tmp/lldb-log.txt lldb expr types works in a "clean" user account I created a new, uncustomized "Standard" testuser account on the M1 Mac mini, and launched the same system Xcode.app. There was no longer this error message, and was able to inspect variables at a swift program breakpoint in Swift context, including po symbol. Impact Effectively this makes the debugger in Swift on Xcode projects on my systems essentially unable to inspect Swift contexts' state.
Posted
by idcrook.
Last updated
.
Post not yet marked as solved
6 Replies
2.9k Views
Xcode 12.4 on Big Sur, a very basic attempt to launch and debug a process. Little-Net:host-osx minfrin$ lldb ./tmp_firefox/Library/Google/Chrome/NativeMessagingHosts/chrome-token-signing.app/Contents/MacOS/chrome-token-signing (lldb) target create "./tmp_firefox/Library/Google/Chrome/NativeMessagingHosts/chrome-token-signing.app/Contents/MacOS/chrome-token-signing" Current executable set to '/Users/minfrin/src/redwax/open-eid/chrome-token-signing-trunk/host-osx/tmp_firefox/Library/Google/Chrome/NativeMessagingHosts/chrome-token-signing.app/Contents/MacOS/chrome-token-signing' (x86_64). (lldb) process launch -i cert.native  error: process exited with status -1 (attach failed (Not allowed to attach to process.  Look in the console messages (Console.app), near the debugserver entries when the attached failed.  The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)) Why would lldb, running as my local user, be unable to launch a process also running as my local user? Is there any way to convince lldb to log error messages instead of referring me to the console, which contains a continuous stream of noise?
Posted
by minfrin.
Last updated
.
Post not yet marked as solved
37 Replies
7.4k Views
When I run my app from Xcode 12b1 and hit a break point, LLDB says "Cannot create Swift scratch context (couldn't load the Swift stdlib)" and any subsequent commands like "po" seem to do nothing. Who can I fix this?
Posted
by mhoeller.
Last updated
.
Post not yet marked as solved
0 Replies
219 Views
Hello! When I update my source code then build and run my app, the debugger fails to attach. Xcode says it is "Attaching to Bowtie on iPhone 8" while the simulator shows my app launch screen (Bowtie is the name of my app target). After about 30 seconds, Xcode says it "Finished running" my app and my debugger says "Message from debugger: Terminated due to signal 9". After this, the app instance continues its launch in the simulator, but Xcode is not connected to the running process, so I get no debugging tools whatsoever. If I then re-run the app it launches fine: this only occurs if the source code changes. Any ideas here?
Posted Last updated
.
Post marked as solved
4 Replies
445 Views
Following the instructions found here as well as around the Developer Forums, I've successfully managed to begin debugging my system extension on a virtual machine. Unfortunately, after archiving my system extension and copying over the .app file to my virtual machine, my .app loses access to the source code (on my host machine) and hitting any beak points via lldb yields me hard-to-read assembly code. How do I also get source code when attaching lldb to a system extension?
Posted
by jbicklebb.
Last updated
.
Post not yet marked as solved
2 Replies
594 Views
HI devs, help me please, i want to debug Big Sur kernel on inter-based macbook from Monterey on m1, i have installed KDK_11.6.4_20G417.kdk in Monterey system on m1 macmini, then launch lldb, have created target and got this message : WARNING! Python version 3 is not supported for xnu lldbmacros. (lldb) target create /Library/Developer/KDKs/KDK_11.6.4_20G417.kdk/System/Library/Kernels/kernel warning: 'kernel' contains a debug script. To run this script in this debug session:   command script import "/Library/Developer/KDKs/KDK_11.6.4_20G417.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/kernel.py" To run all discovered debug scripts in this session:   settings set target.load-script-from-symbol-file true Current executable set to '/Library/Developer/KDKs/KDK_11.6.4_20G417.kdk/System/Library/Kernels/kernel' (x86_64). (lldb) settings set target.load-script-from-symbol-file true ############################## WARNING! Python version 3 is not supported for xnu lldbmacros. Please restart your debugging session with the following workaround defaults write com.apple.dt.lldb DefaultPythonVersion 2 ############################## Loading kernel debugging from /Library/Developer/KDKs/KDK_11.6.4_20G417.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/kernel.py LLDB version lldb-1300.0.42.3 Swift version 5.5.2-dev settings set target.process.python-os-plugin-path "/Library/Developer/KDKs/KDK_11.6.4_20G417.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py" settings set target.trap-handler-names hndl_allintrs hndl_alltraps trap_from_kernel hndl_double_fault hndl_machine_check _fleh_prefabt _ExceptionVectorsBase _ExceptionVectorsTable _fleh_undef _fleh_dataabt _fleh_irq _fleh_decirq _fleh_fiq_generic _fleh_dec command script import "/Library/Developer/KDKs/KDK_11.6.4_20G417.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/xnu.py" error: module importing failed: Traceback (most recent call last):  File "<string>", line 1, in <module>  File "/Library/Developer/KDKs/KDK_11.6.4_20G417.kdk/System/Library/Kernels/kernel.dSYM/Contents/Resources/Python/lldbmacros/xnu.py", line 123   print "Execution interrupted by user"      ^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Execution interrupted by user")? settings set target.process.optimization-warnings false How can i solve this problem? lldb linked with python 3, but kdk uses python 2, also command line tools version 12.5.1 which uses python 2 i can not install on monterey too.
Posted Last updated
.
Post not yet marked as solved
0 Replies
308 Views
Invalid breakpoint debugging. Tried several versions of Xcode.The breakpoint before app startup can take effect, and the breakpoint after that will not take effect. What caused the problem? My colleagues also encountered the same problem and the same configuration
Posted
by Aimour.
Last updated
.
Post not yet marked as solved
0 Replies
309 Views
When I set breakpoints I keep getting Invalid expression for variables that are clearly set and there "in context". Furthermore lets say I have an object X with a property y I'm able to check object X with all of its properties but If i try to watch for X.y I get "Invalid expression" this doesnt make much sense... I even try to add watch directly from X.y in the watch section but then I got this error Details Failed to set watch point Domain: IDEDebugSessionErrorDomain Code: 2 Failure Reason: error: Watchpoint creation failed (addr=0x282efac68, size=8, variable expression='self.controller'). error: sending gdb watchpoint packet failed User Info: {   DVTRadarComponentKey = 855031; } -- System Information macOS Version 12.1 (Build 21C52) Xcode 13.2.1 (19586) (Build 13C100) Timestamp: 2022-03-02T15:45:33Z I've looked into my build options for the project and optimizations are set to None on Debug... Am I missing something?
Posted Last updated
.
Post not yet marked as solved
7 Replies
3.2k Views
I am using Xcode 13 on a Macbook Pro (Intel/2019) with macOS Big Sur 11.6 I am building and launching the app on a connecting iPhone X running iOS 15.0, I am also running a UI test suite based on XCUITest while I do that. The app takes extremely long to launch (2+ minutes), then it sits on the splash screen for another 2-3 minutes. Meanwhile, Xcode shows the alert attached: I have 2 questions: Is this a widespread Xcode 13 / iOS 15 issue? Can someone please explain what the message in the alert means "LLDB is likely reading from device memory to resolve symbols"? Is there anything I can do to reduce or avoid this wait?
Posted Last updated
.
Post marked as solved
1 Replies
402 Views
This is what my Xcode 13.2.1 console looks like: Basically, it has one single-char column and every input or output is wrapped to a new line for every typed/printed char. The only recent change on my mac was it being force-updated to Monterey by my company MDM solution, a couple of days ago. I happen to have Xcode 13.1 installed, and have the same result with it. My next step is to uninstall, download and reinstall the latest version. Does anyone know how to fix it?
Posted
by andredsp.
Last updated
.
Post not yet marked as solved
2 Replies
658 Views
Now more than ever, it would really help if it were S.O.P. for Apple was to simultaneously release each KDK with each system update. System volume sealing makes the work-arounds for missing KDKs quite painful.
Posted
by jlowe48.
Last updated
.
Post marked as solved
5 Replies
944 Views
We define an event handler for OpenURL NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager]; [appleEventManager setEventHandler:self andSelector:@selector(handleGetURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; And we handle it here: (void)handleGetURLEvent:(NSAppleEventDescriptor *)event            withReplyEvent:(NSAppleEventDescriptor *)replyEvent { // Handler type stuff } If I'm debugging in Xcode, I see a SIGCONT before the handler is called. When I continue from the SIGCONT, I enter the handler and everything is fine. This causes automated tests to break, and is generally a pain in the you-know-where. Outside of Xcode it's fine. How can I make it stop doing this? Is there some Xcode setting I've overlooked?
Posted
by kjbrock.
Last updated
.
Post not yet marked as solved
12 Replies
882 Views
The actual issue is that Xcode 13 does stop at breapoints, but using the debugger (po someObject) does not print but gives us an error: warning: Swift error in scratch context: error: /Path/To/OurApp/OurApp-Bridging-Header.h:14:9: error: 'SomeSucessfulyUsedDependency.h' file not found This issue happens on parts of our code, other parts work fine. This is reproducible. The same project works fine with Xcode 12 Starting with Xcode 13, when running our app in DEBUG config on sim or device (both iOS 15, but we have tested sims <iOS15 too), the first line in console is: error: invalid target, create a target using the 'target create' command It looks like Xcode 13 is unable to create a target in LLDB. But maybe the console output is misleading and unrelated. That obviously make debugging a none-nice process ... Any help appreciated.
Posted
by pEpee.
Last updated
.