我在界面中声明了一个全局数组/字典,如下所示。
@interface ViewController ()
{
NSDictionary *dictionary;
NSArray *array;
}
我正在执行API调用,并将值存储在这些数组和字典中。我想在运行时在LLDB中打印数组/字典的内容。
当我试图打印这些全局变量时,它会给出以下错误。
(lldb) po assigneeArr
error: warning: Stopped in a context claiming to capture an Objective-C object pointer, but
如何在控制台窗口中打印出UITables indexPath.row。我不想到处添加NSLogs。
我一直收到“不是成员”或“属性”的提示。
(lldb) expr (int) printf("%d \n",self.lastChangedIndexPath->_row)
error: 'NSIndexPath' does not have a member named '_row'
(lldb) print self.lastChangedIndexPath->_row
error: 'NSIndexPath'
我有一个C程序,其中使用了一个名为class的变量。
我试图用LLDB调试它,但遇到了以下问题:
(lldb) print class
error: warning: declaration does not declare anything
error: declaration of anonymous class must be a definition
error: 1 errors parsing expression
我认为出现这个问题是因为class是C++中的保留关键字,LLDB将传递给print的代码解释为C++。还有办法打印我的变量的内容吗?
(请不要建议我重命名这个变量,如
有时(相当频繁地)当我尝试从iPad应用程序调试崩溃时,LLDB决定不提供太多帮助,并且打印变量(堆栈或类成员)失败。
如果我右击(或CTRL+click)左侧调试窗口中的一个变量,然后"Print description“,我会得到如下错误消息:
Printing description of error:
(NSURLError *) error = <register sp is not available>
或
Printing description of error:
(NSURLError *) error = <register ebp is not
为什么有时当我尝试在控制台中打印时如下所示:
po trip.id
我得到了:
error: <EXPR>:1:11: error: use of undeclared type '$__lldb_context'
extension $__lldb_context {
^~~~~~~~~~~~~~~
<EXPR>:16:5: error: use of unresolved identifier '$__lldb_injected_self'
$__l
我想在Python中创建一个LLDB别名/宏,其中包含要传递给未来进程的设置和环境变量。如何做到这一点? 如果仅仅是Python,我会更新os.environ。然而,lldb的script不会将其从Python传播回target.env-vars,所以我没有得到期望的结果: (lldb) settings show target.env-vars
target.env-vars (dictionary of strings) =
(lldb) settings set target.env-vars TEST1='this is test1'
(lldb) settings
我这样声明一个二维数组:
char arr[10][10];
arr[0][0] = 'X';
现在我在调试器中打印;
(lldb) po arr[0][0]
'X'
太棒了!!没问题。
现在我这样声明一个二维数组:
int col = 10;
int row = 10;
char arr[row][col];
arr[0][0] = 'X';
现在我在调试器中打印;
(lldb) po arr[0][0]
error: subscript of pointer to incomplete type 'char []'
error
我定义一个lldb用户变量如下(没有由lldb报告的错误):
(lldb) expression -l swift -- let $servicesButton = unsafeBitCast(0x127979670, to: UIButton.self)
当我尝试使用变量时,我得到:
(lldb) po $servicesButton
error: use of undeclared identifier '$servicesButton'
(lldb) po $servicesButton.isEnabled
error: use of undeclared
我想定义一个LLDB函数,它同时运行2个命令(例如,打印变量值并转到下一行)。使用GDB调试C代码--我会这样做:
(gdb) def f
Type commands for definition of "f".
End with a line saying just "end".
>p i
>n
>end
(gdb) f
但是对LLDB做同样的尝试是行不通的:
(lldb) def f
error: 'def' is not a valid command.
error: Unrecognized command 'd
我正在尝试编写一个函数来将内容附加到一个值数组中,然后将它们打印出来,但是当我调用我的函数后打印出来时,它返回了__lldb_expr_444.taste?!下面是我的代码:
// Playground - noun: a place where people can play
import UIKit
struct taste {
var TheName = "blankName"
var TheDesc = "blankDesc"
}
var data = [taste]()
func addFruit(name:String,desc
好的,这听起来像是一个愚蠢的问题,但我还是被困住了:在lldb调试会话期间,我很难读取变量的值(gdb的情况很好)。
我找到了其他人的帖子,他们遇到了和我一样的错误信息,但区别在于,我甚至不知道如何打印出最简单的变量形式的值。
为了更好地表达我的问题,我将在这里考虑一个非常简单的例子。我们有一个文件"main.c“,其中包含以下代码:
#include <stdlib.h>
#include <stdio.h>
int main(void) {
int a = 1;
int b = 2;
int c = 0;
c = a + b;
c =
代码示例:
class IA
{
public:
virtual int getA() = 0;
};
class A:public IA
{
public:
int getA() override
{
return m_a;
}
private:
int m_a = 10;
};
void main()
{
A* a = new A();
IA* ia = a;
}
在使用set print object on的GDB中,我可以使用ia指针轻松地打印a对象内容。
//with print object on
p *i
表示:
使用Xamarin.iOS对调试C#和其他托管语言代码的本地调试支持,并在需要调试可能与Xamarin.iOS项目链接的C、C++或目标C代码时使用LLDB。
但是,我找不到任何关于如何使用LLDB来调试Xamarin应用程序的文档。如果我在iPhone模拟器中运行我的应用程序并尝试使用LLDB附加到它,我会得到以下错误:
(lldb) attach --pid 37993
Process 37993 exited with status = -1 (0xffffffff) lost connection
error: attach failed: lost connecti
我想使用lldb输出传递给函数调用的参数。
使用AndroidStudio lldb NDK
int aaaaaa(int a, int b) {
int rrr = a + b;
return rrr;
}
int x = 111;
int y = 222;
int eee = aaaaaa(x,y);
// I know that print x can output the correct result, but I want to
// output the result of x through the register, what sh
我有一个带有以下行的测试用例:
XCTAssert(testVal == value)
value和testVal都是小数。在大多数情况下,等价测试给出了预期的结果,但并不总是这样。例如
let value = Decimal(0xFFFF)
... do stuff that generates testVal
XCTAssert(testVal == value) // evaluates false
但是,当我看价值和testVal时,它们似乎是一样的。
(lldb) print testVal == value
(Bool) $R0 = false // the condition c
我试图使用python提供的“跟踪”函数,使用下面的代码查找一些日志信息。
tracer = trace.Trace(
ignoredirs=[sys.prefix, sys.exec_prefix],
trace=False,
countfuncs = True,
count=False,
timing = True)
tracer.run('exec(script, variables, variables)')
# make a report, placing output in the current directory
r = tracer.results()
r.