script gdb commands
Page 1 of 1

Author:  kaganis [ Thu Oct 29, 2009 9:41 am ]
Post subject:  script gdb commands

I am a scripting newbie. I have created a script to gether crash information for one of our programs. I would like to also gather the trace for the core within the bash script.
What I have done so far is this:


gdb $PATH/MyProgram $CORE
bt >> /tmp/trace.output

What happens is that this launches gdb and passes in the core file properly, but when it gets to the gdb prompt, it will not pass in the 'bt' command.

How would I pass the bt command into gdb and capture the output into the trace.output file?

Thank you.

Author:  DarthWavy [ Fri Oct 30, 2009 4:46 am ]
Post subject:  Re: script gdb commands

I have never used gdb but I checked the man page and it seems to indicate that commands to gdb can be specified in a file that is pointed to via the -x option.

Author:  kaganis [ Fri Oct 30, 2009 9:01 am ]
Post subject:  Re: script gdb commands

That worked great. Thank you. I missed the -x in man pages.

Page 1 of 1 All times are UTC - 6 hours
© 2000, 2002, 2005, 2007 phpBB Group •