1

I am making a simple coredump analyzer. I have a core file and symbols. Now I want to create a utility so these 2 files can be uploaded, and it shows the stacktrace (bt). I execute a shell script which does:

gzip -d coredump.gz
tar xvf symbols.tar.gz
gdb program
#Now at this point I want to send gdb commands one at a time. Like:
core-file corefile
echo bt

I want to save the output of "bt" to a file. How can I do that?

1

1 Answer 1

2

You want:

rm -f gdb.txt
gdb -ex 'set logging on' -ex 'where' program corefile
# GDB output is now in gdb.txt
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, that works if I add it to the shell script. But if I call it from php shell_exec, it doesn't work. I asked another seperate question: stackoverflow.com/questions/48715364/…. Thanks for your help!
I called disassemble fn using the method, above. But it seems that when there are multiple function with the same name in the binary file, only one is disassembled. Is it possible to disassemble all of them or I should disassemble them based on raw address?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.