On Wed, Jan 26, 2005 at 06:39:30AM +1000, Badai Aqrandista wrote:
but i can't get argp to show a list of available options because it gives
me segfault when i use the option to show them... i think it's the argp
library that segfault... how do i know where the segfault comes from and
how do i fix it?
To figure out where a segfault is coming from:
$ gdb monotone
(gdb) set args <args you want to pass to monotone, e.g. --help>
(gdb) run
<program runs for a bit, then gdb tells you that it has segfaulted
and gives you a prompt>
(gdb) bt
<gdb prints out the stack at the time the error occurred>
You can also use gdb to do things like examine the values of various
variables when the segfault occurred, etc.; there are a number of gdb
tutorials out there...
The biggest thing is that for gdb to be very useful, you first have to
compile monotone with the "-g" switch to gcc. The best way to do this
is:
$ ./configure CXXFLAGS="-O0 -g" CFLAGS="-O0 -g"
(which means, compile both C++ and C unoptimized, with debugging
support); as a bonus, compiling without optimization will go an order
of magnitude faster...
-- Nathaniel