Tried with 7.2 for debian, but seems is not possible to step into c++0x lambdas.
I was able to step into a lambda in a very simple program (ubuntu 10.04, gdb-7.1, gcc-4.6 with -g
flag).
#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);
}
And here's a session transcript.
(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 }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With