作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
为 debian 尝试了 7.2,但似乎无法进入 c++0x lambdas。
最佳答案
我能够在一个非常简单的程序(带有 -g
标志的 ubuntu 10.04、gdb-7.1、gcc-4.6)中进入 lambda。
#include <iostream>
void sayhello()
{
std::cout << "Hello world" << std::endl;
}
int main ()
{
std::cout << "=========" << std::endl;
([](void (*f)()) {
std::cout << "---------" << std::endl;
f();
std::cout << "---------" << std::endl;
})(sayhello);
}
(gdb) br main
Breakpoint 1 at 0x804869e: file hello.C, line 10.
(gdb) r
Starting program: /tmp/hello
Breakpoint 1, main () at hello.C:10
10 std::cout << "=========" << std::endl;
(gdb) n
=========
15 })(sayhello);
(gdb) s
operator() (this=0xbffff24f, f=0x8048614 <sayhello()>) at hello.C:12
12 std::cout << "---------" << std::endl;
(gdb) n
---------
13 f();
(gdb) s
sayhello () at hello.C:5
5 std::cout << "Hello world" << std::endl;
(gdb) n
Hello world
6 }
(gdb) s
operator() (this=0xbffff24f, f=0x8048614 <sayhello()>) at hello.C:14
14 std::cout << "---------" << std::endl;
(gdb) n
---------
15 })(sayhello);
(gdb) n
main () at hello.C:16
16 }
关于lambda - 使用 gdb 调试 lambdas 有什么好运气吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6418035/
我是一名优秀的程序员,十分优秀!