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

Posts under LLDB tag

30 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

lldb issue: 'self cannot be reconstructed'
everything works fine in Xcode15, but in Xcode16 it break down. when I add breakpoint, I start po variable , the lldb shows error: type for self cannot be reconstructed: type for typename "$s8XYRouter8RegistryOXMtD" was not found (cached) error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work. how can I fix the issues!!!. it really mattttttes, and it cause cant developing as normally. pls, save the child.
1
0
43
19h
Attach lldb debugger to the compiled program's executable when the main executable is not the compiled program
I am building an MPI C project in Xcode. In order to do run it, I had to: Specify /path/to/mpiexec in Edit Scheme -> Run -> Info -> Executable, instead of the "default" one, say myprogram if my target is called myprogram. Specify the following arguments in Edit Scheme -> Run -> Arguments -> Arguments Passed On Launch: -np 4, ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_NAME} This is clearly analogous to a mpiexec -np 4 a.out command launched on terminal. The problem is, when I want to debug my application, the execution doesn't "stop" on the breakpoints. I instantly thought that it is because of the check box Debug Executable in Edit Scheme -> Run -> Info -> Executable. Indeed (as I have just said), the Executable specified in there is mpiexec and not myprogram. Thus, is there an option or some command I could set in Xcode to attach the lldb to myprogram?
2
0
265
Oct ’24
Breakpoint issue: 'self cannot be reconstructed'
Hello! We're working on a large app with over 400 modules in both Swift and Objective-C, totaling more than 3 million lines of code. Since the release of Xcode 15 and 16 this summer, we’ve been experiencing issues with LLDB that have made debugging practically impossible. Here are some of the problems we’re facing: The first breakpoint takes a very long time to hit. When using 'po self', we encounter the following error: error: type for self cannot be reconstructed: type for typename "$s5MyModule10PlayerViewCD" was not found (cached) error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work. We get numerous log messages like this: Debugging will be degraded due to missing types. Rebuilding the project will regenerate the needed module files.warning: (arm64) /Users/egormerkushev/Library/Developer/Xcode/DerivedData/App-enhtbwiyebmjsffoqkqhhpshsfia/Build/Products/Debug-iphoneos/MyModule.framework/MyModule(UploadConfiguration.o) 0x000000000000079d: unable to locate module needed for external types: /Users/builder/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/169D1N0MIKBUI/Security-3BRN4UPIIGHME.pcm error: '/Users/builder/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/169D1N0MIKBUI/Security-3BRN4UPIIGHME.pcm' does not exist In the Derived Data folder, we find files with hash-like names, such as: Security-3JM2E93YFDLZNYHWPPIMWNENB.d Security-3JM2E93YFDLZNYHWPPIMWNENB.dia Security-3JM2E93YFDLZNYHWPPIMWNENB.pcm Security-3JM2E93YFDLZNYHWPPIMWNENB.scan Security-3NAAT3MGN7XY96KVJW529HR41.d Security-3NAAT3MGN7XY96KVJW529HR41.dia Security-3NAAT3MGN7XY96KVJW529HR41.pcm Security-3NAAT3MGN7XY96KVJW529HR41.scan Security-3RJH8STJC01N1KKN7JCY1WK7F.d Security-3RJH8STJC01N1KKN7JCY1WK7F.dia Security-3RJH8STJC01N1KKN7JCY1WK7F.pcm Security-3RJH8STJC01N1KKN7JCY1WK7F.scan Security-3TILE9XTY0B8UV9VYL7Y0MJN.d Security-3TILE9XTY0B8UV9VYL7Y0MJN.dia Security-3TILE9XTY0B8UV9VYL7Y0MJN.pcm Security-3TILE9XTY0B8UV9VYL7Y0MJN.scan Security-3ZE8O6ZPHE4L52UZGL0PCBA59.d Security-3ZE8O6ZPHE4L52UZGL0PCBA59.dia ... When enabling LLDB logs with: log enable -f /tmp/lldb.log lldb all we end up with a 1.5GB log file containing hundreds of thousands of error messages. Finally, the LLDB console output in Xcode ends with errors like: error: Assertion failed: (byte_size > 0 && byte_size <= 8 && "GetMaxU64 invalid byte_size!"), function GetMaxU64, file DataExtractor.cpp, line 527 Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 LLDB 0x0000000116ccfe1c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56 1 LLDB 0x000000011682fdcc lldb_private::lldb_assert(bool, char const*, char const*, char const*, unsigned int) + 148 2 LLDB 0x000000011682944c lldb_private::DataExtractor::GetMaxU64(unsigned long long*, unsigned long) const + 72 3 LLDB 0x00000001167335a8 lldb_private::CompilerType::GetValueAsScalar(lldb_private::DataExtractor const&, unsigned long long, unsigned long, lldb_private::Scalar&, lldb_private::ExecutionContextScope*) const + 304 4 LLDB 0x000000011666f0f4 lldb_private::Value::ResolveValue(lldb_private::ExecutionContext*, lldb_private::Module*) + 388 5 LLDB 0x0000000116671e94 lldb_private::ValueObject::ResolveValue(lldb_private::Scalar&) + 104 6 LLDB 0x0000000116674d6c lldb_private::ValueObject::GetValueAsSigned(long long, bool*) + 140 7 LLDB 0x000000011650510c lldb::SBValue::GetValueAsSigned(long long) + 160 8 lldb-rpc-server 0x00000001025ebe70 rpc_server::_ZN4lldb7SBValue16GetValueAsSignedEx::HandleRPCCall(rpc_common::Connection&, rpc_common::RPCStream&, rpc_common::RPCStream&) + 92 ... 13 libsystem_pthread.dylib 0x00000001917fb2e4 _pthread_start + 136 14 libsystem_pthread.dylib 0x00000001917f60fc thread_start + 8 Please file a bug report against lldb reporting this failure log, and as many details as possibleerror: Assertion failed: (byte_size > 0 && byte_size <= 8 && "GetMaxU64 invalid byte_size!"), function GetMaxU64, file DataExtractor.cpp, line 527 Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 LLDB 0x0000000116ccfe1c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56 1 LLDB 0x000000011682fdcc lldb_private::lldb_assert(bool, char const*, char const*, char const*, unsigned int) + 148 2 LLDB 0x000000011682944c lldb_private::DataExtractor::GetMaxU64(unsigned long long*, unsigned long) const + 72 3 LLDB 0x00000001167335a8 lldb_private::CompilerType::GetValueAsScalar(lldb_private::DataExtractor const&, unsigned long long, unsigned long, lldb_private::Scalar&, lldb_private::ExecutionContextScope*) const + 304 4 LLDB 0x000000011666f0f4 lldb_private::Value::ResolveValue(lldb_private::ExecutionContext*, lldb_private::Module*) + 388 5 LLDB 0x0000000116671e94 lldb_private::ValueObject::ResolveValue(lldb_private::Scalar&) + 104 6 LLDB 0x0000000116674c44 lldb_private::ValueObject::GetValueAsUnsigned(unsigned long long, bool*) + 140 7 LLDB 0x0000000116505224 lldb::SBValue::GetValueAsUnsigned(unsigned long long) + 160 8 lldb-rpc-server 0x00000001025ebf18 rpc_server::_ZN4lldb7SBValue18GetValueAsUnsignedEy::HandleRPCCall(rpc_common::Connection&, rpc_common::RPCStream&, rpc_common::RPCStream&) + 92 9 lldb-rpc-server 0x00000001025f62b8 rpc_common::Connection::PrivateHandleRPCPacket(rpc_common::RPCPacket&, rpc_common::RPCPacket&, bool&) + 628 10 lldb-rpc-server 0x00000001025f9e8c Packets::ProcessPackets() + 564 11 lldb-rpc-server 0x00000001025f9bf4 Packets::ReadThread() + 276 12 lldb-rpc-server 0x00000001025f9ad4 Packets::RunReadThread(void*) + 12 13 libsystem_pthread.dylib 0x00000001917fb2e4 _pthread_start + 136 14 libsystem_pthread.dylib 0x00000001917f60fc thread_start + 8 Please file a bug report against lldb reporting this failure log, and as many details as possiblePrinting description of self: error: type for self cannot be reconstructed: type for typename "$s5MyModule10PlayerViewCD" was not found (cached) error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work. In short, our debugger is completely unusable at this point, which is severely impacting our team's ability to develop effectively. Do you have any suggestions on how we can resolve these issues? We would really appreciate your help. Thank you!
8
26
1.5k
Nov ’24
Kernel sends SIGKILL to process which is subscribed on ES_EVENT_TYPE_AUTH_OPEN
The kernel sends SIGKILL to application if it handles ES_EVENT_TYPE_AUTH_OPEN and lldb is attached to this process. App: int main(int /*argc*/, char** /*argv*/) { es_client_t *pEpClient = nullptr; es_new_client_result_t result = es_new_client(&pEpClient, ^(es_client_t *pClient, const es_message_t *pMessage) { switch (pMessage->event_type) { case ES_EVENT_TYPE_AUTH_OPEN: { uint32_t authorizedFlags = pMessage->event.open.fflag; if ((authorizedFlags & FREAD) || (authorizedFlags & FWRITE)) { std::filesystem::path filePath = std::string(pMessage->event.open.file->path.data, pMessage->event.open.file->path.length); std::string fileName = filePath.filename(); if (fileName == "test.txt") { std::cout << "blocked fileName: " << filePath.filename() << std::endl; authorizedFlags &= ~FWRITE; authorizedFlags &= ~FREAD; } } if (es_respond_flags_result(pClient, pMessage, authorizedFlags, false) != ES_RESPOND_RESULT_SUCCESS) { std::cout << "es_respond_flags_result() failed with error " << std::endl; } } break; default: break; } }); if (result != ES_NEW_CLIENT_RESULT_SUCCESS) { std::cout << "es_new_client() failed." << std::endl; return 1; } es_event_type_t eventsList[] = { ES_EVENT_TYPE_AUTH_OPEN }; if (es_subscribe(pEpClient, eventsList, 1) == ES_RETURN_ERROR) { std::cout << "es_subscribe() failed." << std::endl; } // wait int i = 0; std::cin >> i; if (es_delete_client(pEpClient) == ES_RETURN_ERROR) { std::cout << "es_delete_client() failed." << std::endl; } return 0; } (lldb) process attach --pid 61127 .... (lldb) c Process 61127 resuming Process 61127 exited with status = 9 (0x00000009) Terminated due to signal 9 System log: Allowing set_exception_ports from [debugserver] on [ep_sample] for entitled process/debugger Client did not respond in appropriate amount of time (client pid: 61127), sent SIGKILL
2
0
314
Oct ’24
error: type for self cannot be reconstructed: type for typename
Hi, i have met error below when i tried to po one attributes of an instance in my Xcode lldb: error: type for self cannot be reconstructed: type for typename "$xxxxx" was not found (cached) error: Couldn't realize Swift AST type of self. Hint: using `v` to directly inspect variables and fields may still work. Is there anybody met the same error before? I urgently want to know why this happen and how to fix this issue. My macOS Version is Sequoia v15.0.1, Xcode16.0. This problem showed after i upgraded my macOS and Xcode version.
13
28
2.1k
2w
Debugger messages not showing
I've downloaded xcode beta and from then I'm not able to see any messages in the debugger console. I only see the: "Message from debugger: killed" after stopping it. I tried downgrading it but since I'm using Sequoia Beta, "normal" xcode won't be compatible with this MacOs version. This is what I have: xcode Version 16.1 beta (16B5001e) Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4) Target: x86_64-apple-darwin24.0.0 lldb-1500.0.404.7 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4) xcode-select version 2409. package-id: com.apple.pkg.CLTools_Executables version: 15.3.0.0.1.1708646388 volume: / location: / install-time: 1725364937 It can be a mess as I tried so many ways to make this work. Thanks in advance. Regards.
1
1
416
Sep ’24
APPUL OS X LION 10.7 kernel debug kit problems (10.7.{0,4}) + 11G63 unavailable
i'm trying to get firefox running in 10.7 but the kernel is crashing. i have it working/running/looking great on 10.8 and higher. something is happening in 10.7 that is causing the panic. i need the right kit. someone asked a similar question for 10.11: https://forums.developer.apple.com/forums/thread/108732 but feedback assistant doesn't seem like the right answer. i need this kit to move forward. right now using either the 10.7.0 or 10.7.4 kernel debug kit causes a panic on reboot; something to do with AVX and the fpu. i am hoping APPUL had enough foresight to see this would be an issue (even one year later) for people on newer architectures debugging for older, supported (until 2014) targets: this use-case definitely falls within the parameters.
0
0
396
Jul ’24
Not able to use devicectl usage to run ui tests
Hello, I have a test bundle in my application and one of the strong request of our project is to run ui tests from command line having just application build. How to run unit tests on .app file that has a test target? What we tried xcrun devicectl device install app --device <device-identifier> <UITestBundle-Runner.app> xcrun devicectl device process launch --device <device-identifier> --start-stopped <com.apptestbundle-Runner.xcrun> It launches and is waiting pid to be attached. In lldb: device select <device-identifier> device process list Seeing process 'UITestBundle-Runner' pid. device process --pid 'pid id' It attaches and I can see 'debugserver' in the pid list, but it does not start testing and I need tests to start and run. Thanks!
0
0
509
Jul ’24
Error attaching to the pid
Hi 👋 I need assistance in attaching the to the pid in terminal. In lldb mode I am connecting to the pid using device process attach --pid <pid-id> which gives me an error Process 505 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP frame #0: 0x00000001d505c808 libsystem_kernel.dylib`mach_msg2_trap + 8 libsystem_kernel.dylib`mach_msg2_trap: -> 0x1d505c808 <+8>: ret Thanks
1
0
689
Jul ’24
Not able to deploy apps to simulator using XCode 15.0 and 15.4
I am getting error after XCode build completes in the simulator. Not able to install app in any simulator. Getting a popup with title LLDB provided no error string. and on tapping more details getting below error Domain: IDEDebugSessionErrorDomain Code: 3 Failure Reason: LLDB provided no error string. User Info: { DVTErrorCreationDateKey = "2024-06-24 09:28:54 +0000"; DVTRadarComponentKey = 855031; IDERunOperationFailingWorker = DBGLLDBLauncher; RawUnderlyingErrorMessage = "LLDB provided no error string."; } -- Could not launch &lt;AppName&gt; Domain: IDEDebugSessionErrorDomain Code: 3 Failure Reason: LLDB provided no error string. User Info: { DVTRadarComponentKey = 855031; IDERunOperationFailingWorker = DBGLLDBLauncher; RawUnderlyingErrorMessage = "LLDB provided no error string."; } -- Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : { "device_model" = "iPhone14,6"; "device_osBuild" = "17.5 (21F79)"; "device_platform" = "com.apple.platform.iphonesimulator"; "dvt_coredevice_version" = "355.28"; "dvt_mobiledevice_version" = "1643.100.60"; "launchSession_schemeCommand" = Run; "launchSession_state" = 1; "launchSession_targetArch" = arm64; "operation_duration_ms" = 7177; "operation_errorCode" = 3; "operation_errorDomain" = IDEDebugSessionErrorDomain; "operation_errorWorker" = DBGLLDBLauncher; "operation_name" = IDERunOperationWorkerGroup; "param_debugger_attachToExtensions" = 0; "param_debugger_attachToXPC" = 1; "param_debugger_type" = 3; "param_destination_isProxy" = 0; "param_destination_platform" = "com.apple.platform.iphonesimulator"; "param_diag_MainThreadChecker_stopOnIssue" = 0; "param_diag_MallocStackLogging_enableDuringAttach" = 0; "param_diag_MallocStackLogging_enableForXPC" = 1; "param_diag_allowLocationSimulation" = 1; "param_diag_checker_tpc_enable" = 0; "param_diag_gpu_frameCapture_enable" = 0; "param_diag_gpu_shaderValidation_enable" = 0; "param_diag_gpu_validation_enable" = 0; "param_diag_memoryGraphOnResourceException" = 0; "param_diag_queueDebugging_enable" = 1; "param_diag_runtimeProfile_generate" = 0; "param_diag_sanitizer_asan_enable" = 0; "param_diag_sanitizer_tsan_enable" = 0; "param_diag_sanitizer_tsan_stopOnIssue" = 0; "param_diag_sanitizer_ubsan_stopOnIssue" = 0; "param_diag_showNonLocalizedStrings" = 0; "param_diag_viewDebugging_enabled" = 1; "param_diag_viewDebugging_insertDylibOnLaunch" = 1; "param_install_style" = 0; "param_launcher_UID" = 2; "param_launcher_allowDeviceSensorReplayData" = 0; "param_launcher_kind" = 0; "param_launcher_style" = 0; "param_launcher_substyle" = 0; "param_runnable_appExtensionHostRunMode" = 0; "param_runnable_productType" = "com.apple.product-type.application"; "param_structuredConsoleMode" = 1; "param_testing_launchedForTesting" = 0; "param_testing_suppressSimulatorApp" = 0; "param_testing_usingCLI" = 0; "sdk_canonicalName" = "iphonesimulator17.5"; "sdk_osVersion" = "17.5"; "sdk_variant" = iphonesimulator; } -- System Information macOS Version 14.4.1 (Build 23E224) Xcode 15.4 (22622) (Build 15F31d) Timestamp: 2024-06-24T14:58:54+05:30
1
0
507
Jun ’24
Xcode 15.4 - SwiftUI Publishing changes warning is not coming as a purple warning in the file
As I trying to check "Publishing changes from within view updates is not allowed, this will cause undefined behavior." within the app in Xcode 15.4 , but unable to see that in the specific file but is getting logged in the Xcode , even I tried adding debugger for "All runtime issues" , its not working. Console like Opposed to this I am expecting this to be visible in the file as Anyone can pls help me in there!! Thanks!!
1
0
631
Jun ’24
Unable to Debug macOS Action Extension: "Attach failed" Error
Hello everyone, I'm encountering an issue while trying to debug a macOS Action Extension. I created a completely fresh project with an Action Extension target. When I select the Action Extension scheme and run it, choosing Finder as the host app (app to launch it in), I receive the following error: Attach failed: Could not attach to pid : “647”. (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.) This is in Console.app: macOSTaskPolicy: (com.apple.debugserver) may not get the task control port of (Finder) (pid: 647): (Finder) is hardened, (Finder) doesn't have get-task-allow, (com.apple.debugserver) is a declared debugger(com.apple.debugserver) is not a declared read-only debugger. I am pretty sure it worked before on my project that I am developing. It stopped working and now it doesn't even work on a fresh new project. Any ideas? I tried cleaning derived data, restarting my mac, nothing helps. As per the documentation it should work normally using the Build & Run button.
12
0
1.5k
Jul ’24
How do I see the actual leaked bytes Instruments has identified for me?
I am using the Leaks instrument, and it has identified a bunch of 32 and 48 byte "Malloc" leaks. I would like to see a hex dump of some (or all) of those areas. I think if I can see what is in them I can get a better idea about what is triggering the leak. I'm pretty sure it is a real leak. What is the easy way to do this? Can it be done inside instruments, or do I need to run my app under instruments and also attach via lldb and hexdump from lldb? (can I attach lldb and instruments at the same time?) If it matters I'm debugging an iPadOS app, and it is written in Swift plus ObjC, plus ObjC++, oh, and some straight C++.
2
0
902
Mar ’24
segmentation error caused by libGL.dylib`(glViewport)
OS: Sonoma 14.2.1 (23C71), I am porting a linux code (that uses C++, QT) to mac OS. after compiling the code on mac, I get segmentation error due to libGL.dylib. My question is how to avoid the segmentation error. debug messages when I run it using lldb: 2024-03-21 13:13:17.957964+0530 EdgeMarker[10094:150997] SecTaskCopyDebugDescription: EdgeMarker[10094]/0#-1 LF=0 2024-03-21 13:13:18.962117+0530 EdgeMarker[10094:150997] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=10094 2024-03-21 13:13:18.962246+0530 EdgeMarker[10094:150997] SecTaskCopyDebugDescription: EdgeMarker[10094]/0#-1 LF=0 Process 10094 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa80) frame #0: 0x00007ffa1c1295a4 libGL.dylib`glViewport + 22 libGL.dylib`glViewport: -> 0x7ffa1c1295a4 <+22>: movq 0xa80(%rax), %r9 0x7ffa1c1295ab <+29>: movq (%rax), %rdi 0x7ffa1c1295ae <+32>: popq %rbp 0x7ffa1c1295af <+33>: jmpq *%r9 Target 0: (EdgeMarker) stopped. Backtrace snippet: * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0xa80) * frame #0: 0x00007ffa1c1295a4 libGL.dylib`glViewport + 22 frame #1: 0x000000010000c427 EdgeMarker`MyGLCanvas::initializeGL(this=0x00007f8e4f857710) at MyGLCanvas.cpp:33:2 The error occurs when initializing an opengl window: void MyGLCanvas::initializeGL() { m_width = this->frameGeometry().width(); m_height = this->frameGeometry().height(); m_initialized = true; m_Eye[0] = 0.0f; m_Eye[1] = 0.0f; m_Eye[2] = -2.0f; //Actual code m_PerspectiveAngleDegrees = 45.0f; m_NearPlane = 0.01f; m_FarPlaneOffset = 100.0f; glViewport(0, 0, (GLint)m_width, (GLint)m_height); Before calling MyGLcanvas::initializeGL() there is a call to setFocus() function. SetFocus is a function used in GUI programming to give focus to a specific window or control within a window. My second question : Is setFocus valid is mac OS or is there an equivalent?
0
0
586
Mar ’24
Xcode console swallows blank lines when printing string variables
After upgrading from Xcode 14.3 to Xcode 15.2, I am observing unexpected behaviour in Xcode when printing string variables to the console. Specifically, blank lines do not show up (they previously did, as expected, with Xcode 14.3). Steps to reproduce: Put this multiline (Swift) string literal in some Swift file (two lines with one blank line in between) let test = """ line1 line3 """ let Xcode hit a breakpoint in the file with the string print the string value to Xcode console: (lldb) po test "line1\n\nline3" print the same string, cast to NSString, to Xcode console: (lldb) po test as NSString line1 line3 Observed: The blank line is missing in the "po test as NSString" output Expected: There should be a blank line between line1 and line3 I'm running macOS 13.6 (22G120) and Xcode 15.2 (15C500b)
2
0
666
Feb ’24