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
0 Replies
80 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
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
by
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
by
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
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
by
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
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
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
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
by
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
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
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
by
Post not yet marked as solved
0 Replies
281 Views
Facing issues with running debug server for go land and visual studio code. Up on checking the console.app i found the below log line. error: failed to launch process /Library/Developer/CommandLineTools/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/debugserver: failed to get the task for process 11168 go version go1.17.6 darwin/amd64. Delve Debugger Version: 1.8.0 Build: $Id: 6a6c9c332d5354ddf1f8a2da3cc477bd18d2be53 $ mac os monterey 21.1 command line tools 13 All the mentioned tools above are installed in my local
Posted
by
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
Post not yet marked as solved
0 Replies
289 Views
This is what I am getting every time I close the app. Please suggest alternatives for Xcode 13 dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/sarthaks/Library/Developer/Xcode/DerivedData/Dicee-iOS13-bwfmsdtnysirovgrfszwvnzssntm/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/sarthaks/Library/Developer/Xcode/DerivedData/Dicee-iOS13-bwfmsdtnysirovgrfszwvnzssntm/Build/Products/Debug-iphonesimulator CoreSimulator 776.4 - Device: iPhone 13 (282367A5-90FC-4D78-85A7-8D400EC8C281) - Runtime: iOS 15.0 (19A339) - DeviceType: iPhone 13 (lldb)
Posted
by
Post not yet marked as solved
0 Replies
484 Views
I'm getting the error: ** "Warning: Error creating LLDB target at path '/Users/tantan/Library/Developer/Xcode/DerivedData/Videe-bpukzfmjaxewiuaiolulcqllukjg/Build/Products/Debug-iphonesimulator/[AppName].app'- using an empty LLDB target which can cause slow memory reads from remote devices."** Is there anyone who can explain to me what the reason is and how can fix it? Thanks,
Posted
by
Post marked as solved
1 Replies
461 Views
This seems like a very basic question but I couldn't find an answer to this yet: I have a simple C++ command-line application which has its main() thread and from this it forks a service pthread (BSD thread). This service thread performs the I/O on the console. When I just let it run, it works as expected. The question is: I would like to pause and single-step only the main() thread while the service thread continues to run free in the background, but so far the Xcode debugger insists on always pausing or resuming all threads at the same time, apparently (regardless whether the pause was due to clicking the pause icon or hitting a breakpoint in either thread). Have I overlooked something or is it in fact impossible in Xcode to pause and single-step only one of the threads in a Mac application? (I'm not questioning that in most cases the observed behaviour is the desired and most practical one, I'd just need single-thread debugging right now.)
Posted
by
Post not yet marked as solved
3 Replies
400 Views
In Xcode, I want to do something when ctrl + c is pressed, but it looks like lldb doesn't catch SIGINT signal. I also tried the solution: process handle SIGINT -s false process handle SIGINT -p true Still, it does nothing. What am I doing wrong?
Posted
by
Post not yet marked as solved
2 Replies
426 Views
I am getting regular kernel panics. I have a Kern*.panic file, and a .contents.panic These files now contain a 'macOSProcessedStackshotData' and so are encoded. I'm a dev, but not familiar with Apple Kernel debugging (though I've done this before on windows/aix/linux). How can I get some simple info from the panic, such as kernel backtrace, loaded drivers etc? Ideally I'm looking for a few points to specific drivers (maybe I can unplug a device) or situations I can avoid
Posted
by