How to redirect gdb backtrace to a text file’ ‘How to redirect gdb backtrace to a text file
1 – Problem Description
Redirecting gdb backtrace (bt) output to a text file for parsing or other uses.
2 – Solution
- Create a text file, i.e. gdbCommands.txt, with the following commands
**bt 10**, indicates the number of lines (function calls) we need from the backtrace, in our example is 10 lines.
- Execute gdb using the following command, assuming a core dump file core.2345
Open my_log_file and inspect backtrace!