【问题标题】:In Xcode, how to step into lambda function?在 Xcode 中,如何进入 lambda 函数?
【发布时间】:2016-06-24 08:32:50
【问题描述】:

调试时,在函数call(mFunction(1))处有断点,我按step into,但调试器没有进入lambda函数。

#include <iostream>
int main(int argc, const char * argv[]) {

    std::function<void(int)> mFunction;

    mFunction = [](int a ){
        a = 2;
    };
    mFunction(1); //breakpoint at this line
    return 0;
}

解决方案 1:

(lldb)settings set target.process.thread.step-avoid-regexp ""

我已经试过了,它可以工作,但你再也不想调试了。

【问题讨论】:

    标签: xcode lambda


    【解决方案1】:

    据我所知,您的解决方案是正确的。完成后,您可以将正则表达式更改回其原始值,以使其余的调试更加愉快。例如:

    (lldb) settings show target.process.thread.step-avoid-regexp
    target.process.thread.step-avoid-regexp (regex) = ^std::
    (lldb) settings set target.process.thread.step-avoid-regexp ""
    ... debug ...
    (lldb) settings set target.process.thread.step-avoid-regexp "^std::"
    

    来源:https://gist.github.com/hotwatermorning/1c13149705ccf6d3233a043012d0d164

    【讨论】:

      猜你喜欢
      • 2018-11-25
      • 2018-09-06
      • 1970-01-01
      • 1970-01-01
      • 2021-04-11
      • 1970-01-01
      • 1970-01-01
      • 2020-01-25
      • 2019-03-30
      相关资源
      最近更新 更多