Register
It is currently Wed Apr 23, 2014 4:19 am

script gdb commands


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Thu Oct 29, 2009 9:41 am   

Joined: Thu Oct 29, 2009 9:22 am
Posts: 2
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:

PATH=/program/src/Debug/Source
CORE=core.2492

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.


Top
 Profile  
 PostPosted: Fri Oct 30, 2009 4:46 am   
Moderator
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 224
Location: London - UK
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.


Top
 Profile  
 PostPosted: Fri Oct 30, 2009 9:01 am   

Joined: Thu Oct 29, 2009 9:22 am
Posts: 2
That worked great. Thank you. I missed the -x in man pages.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP