I am debugging a C++ program. Suppose I am sitting at a breakpoint in gdb and I do bt 50. This will generate the backtrace and show me the call stack with 50 functions that were run in the process of execution reaching where it is now.
Sometimes, I want to quickly examine the code for one of the functions in the backtrace call stack. I know how to do this on Visual Studio. Visual Studio maintains call stack similar to gdb backtrace. On Visual Studio, I can simply double-click a function in the call stack and Visual Studio takes me to the code for that function, even opening the file for me if not opened. Very convenient.
I was wondering if there was a gdb command to show code around a symbol name in backtrace. Currently, the only way I know is to manually find the file and open it in emacs, and then do a search in emacs to take me to the function. Please tell me if there is a better way so it becomes convenient like in Visual Studio.