Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

backtrace - hide standard library and boost calls

Tags:

c++

debugging

gdb

I am looking at a backtrace in gdb, and it looks really cluttered because of all the calls made into the standard library and boost. Eg. I see boost::bind and std::allocator on the call stack, and several other similar calls into the standard library or Boost.

I think I would find it helpful to have backtrace show me just the functions explicitly defined in my program. Better yet, it would help further if I could quickly configure the backtrace command to show or hide std and boost calls as and when I need them.

Any idea how to hide boost from the call stack altogether or to configure backtrace to turn boost logging on and off?

like image 277
The Vivandiere Avatar asked Oct 19 '22 04:10

The Vivandiere


1 Answers

There is no built-in way to do this.

It can be done, though, by writing a Python "frame filter" that drops the frames that you don't care to see. This isn't particularly hard to do, but it requires writing a bit of Python code using the gdb Python API.

like image 161
Tom Tromey Avatar answered Oct 21 '22 05:10

Tom Tromey