For years now lldb has been unable to print Alamofire's *Response type in completion handlers, even when other values in other completion handlers are okay. Naturally this makes debugging while developing Alamofire quite frustrating. I'd like some help narrowing down the cause so I can either make a better bug report to get it fixed or look into fixing it myself.
The issues is trivially reproducible. Clone Alamofire, place a break point in a completion handler of one of our tests, and run the test. Attempting to print the response will produce this error:
error: Couldn't materialize: can't get size of type
error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression
Of course I can frame variable or ex debugPrint(response) to see the value, but this affects both po and the variable view, so it would be much more convenient to actually be able to print.
I've tried all of the workaround I could find online, including:
Ensuring optimizations are turned off.
Turning optimizations on just to see.
Setting the Debug Information Format to DWARF or DWARF with dSYM file.
Toggling various combinations of sanitizers and other settings in the scheme.
Nothing has made any difference, so what are my next steps to try and debug this?
I'm motivated to help you fixing this, as I understand your frustration. Ideally a smaller, self contained testcase would help. As in, something I can run myself from the command line that reproduces this bug. Can you try?
Can you provide the definition of Response and Request?
I would like to see if there's anything particular with them [e.g. resilient types]. Other than that, I guess I should just try to find the time to sit down and debug this.
I was never able to reproduce this in a small sample, but my testing in Xcode 12 seems to indicate the issue may have been fixed by the enhancements to lldb in that version. For the first time in literally years I can use the debugger in Alamofire's completion handlers!
Hi @Jon_Shier I was super excited to see this message, installed Xcode 12 to test it with our project target but for us debug is completely broken. Could you please let me know how you've been able to confirm that the Alamofire debugging issues have been fixed on Xcode 12?
I only tested that debugging Alamofire itself from within its test cases works. If you're still having trouble debugging Alamofire while its integrated into your project, you should report that issue to Apple. I'll do some additional testing to confirm.