【发布时间】:2017-02-22 11:31:56
【问题描述】:
刚刚切换到 lldb,我正在尝试做与 gdb 的 watch i 等效的操作,因为我在代码中的 for 循环中。
(lldb) f
frame #0: 0x0000000100000664 a.out`MaxPairwiseProduct(numbers=size=5) + 4 at max_pairwise_product.cpp:19 [opt]
16 // Find max value in vector
17
18 for (int i=1; i<numbers.size(); i++) {
-> 19 if (numbers[i] > numbers[i-1]) {
20 second_max = max;
21 max = numbers[i];
22 if (numbers[i] < max && numbers[i] > second_max)
(lldb)
正如你在上面看到的,int i 已经被声明了。
检查我有哪些观察点产生了
(lldb) watchpoint list -b
Number of supported hardware watchpoints: 4
No watchpoints currently set.
(lldb)
现在尝试为 i 设置观察点(根据 lldb reference)我得到了
(lldb) wa s v i
error: Watchpoint creation failed (addr=0xffffffffffffffff, size=0, variable expression='i').
error: cannot set a watchpoint with watch_size of 0
(lldb)
我不明白为什么会这样,因为变量已被声明。谷歌搜索错误并没有多大帮助,因为大多数问题似乎与达到最大观察点数有关,这不是我的情况,如上所示。任何帮助将不胜感激!
【问题讨论】: