A command file can be used to run gdb. Why would you want to use a command line to run gdb?
Well, lets say you run a regression on 25,000 test cases and there are 1,300 tests which fail. 200
of the failures are caused by asserts. Now you want to know how many unique bugs are causing
the 200 failures so that you can determine the amount of work it will take the programming team
to fix the bugs. Well, you can write a post processing script to find all asserts, run gdb on the
testcases with backtrace, run a Perl script on the gdb output and sort the results to find the unique
set of bugs. The 200 asserts might be caused by 15 bugs in 4 different components. Now you know
the scope of the problem.
Below is a command file t.
File: t
run ../../../csl_new_bug/memory_map_invalid/2_regs_mmap.csl
backtrace
We cat the file t and pipe it to gdb which executes the commands and writes the stderr/stdout to log
$ cat t | gdb cslc &> log
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries ........ done
(gdb) Starting program: /opt/he_fpl_svn/fpl_repo/cslc/trunk/build/linux/x86_32/cslc/cslc ../../../csl_new_bug/memory_map_
invalid/2_regs_mmap.csl
Reading symbols for shared libraries +++++++....................... done
DEBUG:You are running CSLC without RLM; you'd better be offline...
Fastpath Logic™ License Agreement
Please read and accept the license below to continue.
IMPORTANT - read carefully before DOWNLOADING, ACCESSING or USING the
Chip Specification Language Compiler(cslc) (collectivelly, "SOFTWARE"
of Fastpath Logic, INC.
Your use of the SOFTWARE is expressly conditioned upon and subject to
your agreement to these terms and conditions. If you do not agree to
these terms and conditions, do not DOWNLOAD, ACCESS or USE the SOFTWARE
(refer to license.txt documents for more information).
Assertion failed: (px != 0), function operator->, file /opt/local/include/boost/shared_ptr.hpp, line 315.
Program received signal SIGABRT, Aborted.
0x91c74e42 in __kill ()
(gdb) #0 0x91c74e42 in __kill ()
#1 0x91c74e34 in kill$UNIX2003 ()
#2 0x91ce723a in raise ()
#3 0x91cf3679 in abort ()
#4 0x91ce83db in __assert_rtn ()
#5 0x00bf5bc0 in boost::shared_ptr
::operator-> (this=0xbfffb818) at shared_ptr.hpp:315
#6 0x009ea36a in NSCSLOm::CSLOmMemoryMapPage::add (this=0x1cd8230, addrObj=@0xbfffbb30, name=@0xbfffbb28, baseAddress=@0
xbfffbb10) at /opt/he_fpl_svn/fpl_repo/cslc/trunk/src/cslom/CSLOM_MemoryMap.cpp:487
#7 0x009b3d31 in NSCSLOm::CSLOmCmdAdd::execute (lineNumber=30, fileName=@0xbfffbbe8, parent=@0xbfffbbe0, scope=@0xbfffbb
d8, params=@0xbfffbbd0) at /opt/he_fpl_svn/fpl_repo/cslc/trunk/src/cslom/CSLOM_cmd1.cpp:3123
#8 0x009b6b9a in NSCSLOm::CSLOmCmdAdd::build (lineNumber=30, fileName=@0xbfffc830, parent=@0xbfffc828, scope=@0xbfffc820
, params=@0xbfffc818) at /opt/he_fpl_svn/fpl_repo/cslc/trunk/src/cslom/CSLOM_cmd1.cpp:2913
#9 0x00a82180 in NSCSLOm::CSLOmSetCommand::build (lineNumber=30, fileName=@0xbfffcd14, parent=@0xbfffcd0c, scope=@0xbfff
cd04, keyword=NSCSLOm::TYPE_CMD_ADD, params=@0xbfffccfc) at /opt/he_fpl_svn/fpl_repo/cslc/trunk/src/cslom/CSLOM_cmd.cpp:4
53
#10 0x008d3da8 in CslTreeWalker::command_add (this=0x1ccb7b0, _t=@0xbfffcd90) at csl.walker.g:2516
#11 0x008d8922 in CslTreeWalker::csl_command (this=0x1ccb7b0, _t=@0xbfffcfc0) at CslTreeWalker.cpp:200
log 39%