寻找ldbb等效的gdb" directory "命令来添加搜索路径以查找缺少的源代码(或者xcode中可能的类似功能)?
提前致谢!
我想跟踪什么东西改变了self.view的大小.什么是正确的格式?
(lldb) po self.view
(UIView *) $1 = 0x0a8aba20 <UIView: 0xa8aba20; frame = (0 0; 480 864); autoresize = W+TM+BM; layer = <CALayer: 0xa8aba50>>
(lldb) watch set variable self.view.frame.size.width
error: "self" is a pointer and . was used to attempt to access "view". Did you mean "self->view.frame.size.width"?
(lldb) watch set variable self->view
error: "view" is not a member of "(PlayViewController *) self"
(lldb) watch set variable self->view.frame.size.width
error: "view" is not a member of "(PlayViewController *) self"
Run Code Online (Sandbox Code Playgroud)
我已经尝试了文档和其他lldb观察点问题,但找不到任何针对此特定情况的内容.
谢谢你的帮助.
我已经看到了很多关于这个问题的答案:
错误:无法附加到进程ID
作为switch to GDB.但没有人解决为什么会发生这种情况的原因?
附加适用于GDB调试器,但默认和推荐的项目设置是LLDB.
任何人都可以解释LLDB失败的原因吗?这是一个常见的错误还是我做错了什么?
或者,如何在创建新项目时手动更改GDB作为我的默认调试器?
系统信息:
OS: Lion
RAM: 5GB
XCode: Version 4.6 (4H127)
Device: Mac mini
Run Code Online (Sandbox Code Playgroud)
我的localhost设置:

在方案运行调试器弹出窗口中,它显示的是"无"和"GDB".这适用于使用LLVM构建的iPad 4.2模拟器.
我在调试Swift Strings时遇到问题
func stringTest() {
let test1:String = "test1";
let test2:NSString = "test2";
// <-- Breakpoint here
println(test1);
println(test2);
}
Run Code Online (Sandbox Code Playgroud)
如果我在这些行之后设置断点并尝试打印test1,则会出现以下错误:
po test1
error: <REPL>:1:1: error: use of unresolved identifier 'test1'
test1
^
Run Code Online (Sandbox Code Playgroud)
但我能够成功打印test2:
po test2
test2
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Xcode中的调试器来解决我的一个方法.该应用程序非常简单,只是此时的一个示例类.当我设置断点并运行时,LLDB调试器窗格将按预期在Xcode中打开.但是,如果我尝试在我的方法中执行打印命令,我会收到以下错误:
Error in auto-import:
Failed to load linked library Cocoa of module ExampleAppTests - errors:
Looking for "@rpath/Cocoa.framework/Cocoa", error: not a string object
Looking for "/Users/Elliot/Library/Developer/Xcode/DerivedData/ExampleApp-aqpflidffjffyzdxfjdfbjijvsxq/Build/Products/Debug/Cocoa.framework/Cocoa"
, error: not a string object
Looking for "/BinaryCache/arclite/arclite-49.1~7/Symbols/BuiltProducts/Cocoa.framework/Cocoa"
, error: not a string object
Looking for "/Applications/Xcode6-Beta6.app/Contents/Developer/Library/PrivateFrameworks/Cocoa.framework/Cocoa"
, error: not a string object
Looking for "/Applications/Xcode6-Beta6.app/Contents/Developer/Library/Frameworks/Cocoa.framework/Cocoa"
, error: not a string object
Looking for "/Applications/Xcode6-Beta6.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks/Cocoa.framework/Cocoa"
, error: not a string object
Looking for "/Applications/Xcode6-Beta6.app/Contents/SharedFrameworks/Cocoa.framework/Cocoa"
, error: not a string object
Run Code Online (Sandbox Code Playgroud)
如果我输入repl并执行命令,我会得到同样的错误.
我在配备 macOS Big Sur 11.6 的 Macbook Pro (Intel/2019) 上使用 Xcode 13
我正在运行 iOS 15.0 的连接 iPhone X 上构建并启动该应用程序,同时我还在运行基于 XCUITest 的 UI 测试套件。
该应用程序需要很长时间才能启动(2 分钟以上),然后它会在启动屏幕上再停留 2-3 分钟。同时,Xcode 显示附加的警报:
我有两个问题:
在Objective-C中,我有时会在LLDB中设置观察点,以便在实例变量发生变化时通知我.我也可以使用Swift属性吗?
现在,我能做到这一点的唯一方法是:
[setPropertyName:]但这仅在该类恰好支持Objective-C桥接时才有效我还有其他选择吗?
我突然变得无法在lldb中打印出对象属性或调用方法.唯一打印出来的是:
error: class '<ClassName>' has incompatible superclasses
note: inherits from superclass 'NSObject' here
Run Code Online (Sandbox Code Playgroud)
即使是最基本的对象类型也是如此,例如:NSArray,NSDictionary和NSString.这是一个具体的例子:
(lldb) po functie.length
error: class 'NSString' has incompatible superclasses
note: inherits from superclass 'NSObject' here
error: 1 errors parsing expression
Run Code Online (Sandbox Code Playgroud)
唯一可用的方法是NSObject中可用的方法,例如-class.从前一个示例扩展:
(lldb) po [functie class]
__NSCFString
Run Code Online (Sandbox Code Playgroud)
如果有人知道问题是什么,那么您的意见将非常感激.谢谢.
我正在为FFmpeg编写补丁,需要调试我的代码.我正在加载一个外部库,为了测试不同的库版本,我将它们放在不同的文件夹中.要选择我想要使用哪一个,我一直在使用DYLD_LIBRARY_PATH=/path/to/lib/dir ./ffmpeg,并且工作正常.但是当我在lldb里面尝试时,它崩溃说dyld: Library not loaded和Reason: image not found.这曾经在Xcode 7.1之前工作,但我刚刚升级并停止工作.
这是我的MVCE:
#include <stdio.h>
#include <stdlib.h>
int main() {
char* str = getenv("DYLD_LIBRARY_PATH");
if (str) puts(str);
else puts("(null)");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
按如下方式运行此程序会产生输出:
$ ./a.out
(null)
$ DYLD_LIBRARY_PATH=/tmp ./a.out
/tmp
Run Code Online (Sandbox Code Playgroud)
那看起来还不错.但是当我尝试使用lldb时它会失败:
$ DYLD_LIBRARY_PATH=/tmp lldb ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) run
Process 54255 launched: './a.out' (x86_64)
(null)
Process 54255 exited with status = 0 (0x00000000)
Run Code Online (Sandbox Code Playgroud)
试图在lldb中设置环境变量:
lldb ./a.out
(lldb) …Run Code Online (Sandbox Code Playgroud)