我无法在UI测试中打印调试信息.配置:Xcode 10和SWIFT 4.2.
当我尝试在控制台中打印某些内容时,我只能看到错误:
"error: Couldn't IRGen expression, no additional error"
Run Code Online (Sandbox Code Playgroud)
我在早期版本的Xcode(8,9等)中没有任何问题,仅在Xcode 10中.我无法打印任何东西,当我放置断点并尝试打印例如应用程序po XCUIApplication()或类似的东西.
在我在控制台中编写的Xcode的早期版本中:
"po XCUIApplication.debugDescription()"我看到了我的应用程序的结构.
我们发现当外部框架添加到UI Tests Target时会出现问题.我们创建了一个包含RxSwift.framework的示例项目,可用于重现我们的问题:
https://drive.google.com/file/d/1BlByFVNaOdDqT4ED9Jwyi1kJ99PTRQen/view?usp=sharing
问候.
这是我的两行代码:
NSString *frontFilePath = [[NSBundle mainBundle] pathForResource:[self.bookendFileNames objectAtIndex:self.randomIndex] ofType:@"caf"];
NSLog(@"frontFilePath = %@", frontFilePath );
Run Code Online (Sandbox Code Playgroud)
我在第二行放了一个断点,当我在那里时,我尝试打印它:
(lldb) po frontFilePath
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
error: variable not available
Run Code Online (Sandbox Code Playgroud)
我很困惑,因为如果我跳过NSLog语句,变量确实打印到控制台.
为了它的价值,我正在尝试调试第一行,因为有时它会返回NULL,所以我不能,如现在,找出原因.
我正在尝试在我的iPhone应用程序中调试EXC_BAD_ACCESS.它正在崩溃一个方法调用,并在方法的行上EXC_BAD_ACCESS (code=1, address = xxx).
以前,我刚刚gdb info malloc-history <xxx>开始调试,但是我找不到并行命令LLDB.
我看到这个线程说要使用Instruments,但是当我这样做时,我仍然会遇到崩溃,但我无法弄清楚如何准确地告诉应用程序在Instruments中崩溃的位置.
我只需要弄清楚崩溃的这块内存指向的位置.使用LLDB或使用仪器的最佳方法是什么?
我做了一个错字调试我的项目并出现在lldb swift REPL现在我不知道如何退出它同时不退出我调试的程序.所以我输入了expr -r - myVariable而不是expr -R - myVariable.以下就是我所看到的.(如果你想亲自尝试我使用Xcode 6.1,C++代码项目,myVariable必须存在)
(lldb) expr -r -- record.mFileRecord.mVolumeName
(std::string) $19 = ""
1> help expr
/var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856
/repl433.swift:2:5: error: consecutive statements on a line must be
separated by ';'
1> quit
/var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856
/repl434.swift:2:1: error: use of unresolved identifier 'quit'
quit
1> exit
/var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856/repl435.swift:2:1: error: use of unresolved identifier 'exit'
exit
1> exit()
/var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856/repl436.swift:2:1: error: use of unresolved identifier 'exit'
exit()
^
1> quit()
/var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856/repl437.swift:2:1: error: use of unresolved identifier 'quit'
quit()
1> .quit
/var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856 …Run Code Online (Sandbox Code Playgroud) 有没有办法使用LLDB在Xcode中观察变量?或者这只适用于GDB吗?我正在尝试使用该命令,watchpoint set variable但我收到消息:
无效命令'watchpoint set'
在Xcode 4.3中,现在您可以使用LLDB作为iOS目标的调试器.

与使用旧的GDB相比,它有什么优势?GDB仍然可以与LLVM一起使用,我在"日常"调试任务中看不到任何明显的差异.
有没有办法像LDBB中的GDB那样设置反汇编的味道,以便它吐出英特尔风格的汇编而不是AT&T风格?
set disassembly-flavor intel # GDB
Run Code Online (Sandbox Code Playgroud)
但是对于LLDB.
我需要在我的iOS应用程序中显示HTML文本.我决定使用内置方法NSAttributedString,initWithData:options:documentAttributes:error:.实际的解析工作非常好,但是,我似乎遇到了一个非常奇怪的错误,如果我附加调试器,它似乎只会表现出来.
第一次调用此方法时,在运行iOS 7.0.4的iPhone 5S上运行时间不到1秒,在iPod Touch第5代上运行约1.5秒.这个怪癖也体现在模拟器上,但由于模拟器的绝对速度,它明显不那么引人注目.
后续呼叫只需要大约10-50毫秒,这比初始呼叫要快得多.
这似乎与输入字符串的缓存无关,因为我在我的"真实"应用程序中使用多个输入字符串对其进行了测试.
但是,当我在没有调试器的情况下运行程序时,它按预期运行,大约需要10-20ms,这是我希望HTML解析所采用的.
以下是相关的代码部分:
-(void) benchmarkMe:(id)sender {
NSData *data = [testString dataUsingEncoding:NSUTF8StringEncoding];
NSTimeInterval startTime = [[NSDate date] timeIntervalSinceReferenceDate];
// So the complier doesn't keep complaining at me.
__attribute__((unused))
NSAttributedString *parsed = [[NSAttributedString alloc] initWithData:data
options:@{
NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: @(NSUTF8StringEncoding)
}
documentAttributes:nil
error:nil];
NSTimeInterval endTime = [[NSDate date] timeIntervalSinceReferenceDate];
NSString *message = [NSString stringWithFormat:@"Took %lf seconds.", endTime - startTime];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Benchmark complete!"
message:message
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil]; …Run Code Online (Sandbox Code Playgroud) 是我还是lldb for mac os x(替换gdb)不允许你将文件传递给stdin,供被调试的进程使用?
阅读说明没有参考.
我已经完成并安装了gnu gdb,但是想利用我认为改进的lldb功能?
lldb ×10
debugging ×4
xcode ×4
gdb ×3
ios ×3
objective-c ×2
swift ×2
cocoa-touch ×1
iphone ×1
llvm ×1
return-value ×1
xcode10 ×1