Get line number for lambda using gdb

We have a backtrace for segfault that quotes the name created by the compiler for lambda:

(gdb) bt
#0  std::_Function_handler<std::function<bool()>(), bold::AdHocOptionTreeBuilder::buildTree(bold::Agent*)::__lambda59>::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/4.8/functional:2057
#1  0x08146d2c in operator() (this=<optimized out>) at /usr/include/c++/4.8/functional:2464
...

Name assigned bold::AdHocOptionTreeBuilder::buildTree(bold::Agent*)::__lambda59. However, as you can tell, this file has a lot of lambda! Is there a way to match this generated function name with the line number in the source code? We have line numbers for other functions, but here it is quoted only as a type parameter for std::_Function_handler<>.

+4
source share
1 answer

-Map mapfile , , , . nm --line-numbers , -g.

, , set print symbol-filename on GDB, &bold::AdHocOptionTreeBuilder::buildTree(bold::Agent*)::__lambda59

+1

Source: https://habr.com/ru/post/1524494/


All Articles