Gdb print to file instead of stdout

后端 未结 8 2007
醉话见心
醉话见心 2020-11-29 17:15

I am running gdb and want to examine one of those unfortunate god objects. It takes many pages (and I have a 24\" monitor turned sideways!) to see the whole thing. For eas

8条回答
  •  情书的邮戳
    2020-11-29 17:59

    Extending on @qubodup's answer

    gdb core.3599 -ex bt -ex quit |& tee backtrace.log
    

    the -ex switch runs a gdb command. So the above loads the core file, runs bt command, then quit command. Output is written to backtrace.log and also on the screen.

    Another useful gdb invocation (giving stacktrace with local variables from all threads) is

    gdb core.3599 -ex 'thread apply all bt full' -ex quit
    

提交回复
热议问题