On Wed, Jun 04, 2008 at 08:35:38AM -0400, john q public wrote:
> Hello all,
> 
> I've asked about IDEs in the past and there are a lot to choose from so 
> for now I've put that off and just edit source
> without anything else. BUT now I'm running into segfaults and such 
> (worse theyre sporadic so sometimes things mostly work other times 
> everything grinds to a halt). I saw no mention of gdb in either the LFS 
> or BLFS book. Is it
> not a good thing to use?

 It's mentioned on the "other tools" page at the end of chapter 12
in BLFS.
> I'll check hints and see if I find something 
> there. My REAL question is does anyone have advice on when its better to 
> comb the source versus chasing problems with the debugger? I know 
> there's no "right" answer on that but I'd really appreciate some 
> commentary. In actuality I've been a programmer for years and this has 
> always been a tough choice. I did embedded for a while and was it 
> amazing to plug in an ICE in place of the CPU and find right away that 
> something on the board itself was defective. You'd never find something 
> like that on your own because the code is written assuming a board with 
> all the right values for the CPU. Chasing something caused by a faulty 
> component can really leave you haunted. :-)
 Yes, random faults can be *interesting* to track down.  I'm assuming
you are talking about problems with common packages in BLFS.  If your
box has recently started to segfault, consider if the power supply
has become defective (if you are able, try swapping it with a
different one), or perhaps you've added things and the power drain
is now too much for the supply.  If that doesn't sound familiar, at
least try running memtest86+ (for old boxes, memtest86 is probably
adequate) for a few hours to see if the memory is flakey.  Of course,
if you recently tweaked any settings in the bios, you might need to
untweak them.

 If the segfaults also occur in packages which are part of LFS,
maybe you've applied excessive "optimisations" to the system.

 As to using gdb, it depends on what you are trying to debug -
trying to use it on the Xserver is nasty and "left as an exercise for
the reader", but using it on a simple program should at least let you
know _where_ it is failing.  Of course, if you stripped the
libraries like the LFS book suggests, you've already made things
hard :-(

 Other things you haven't mentioned - using strace (not the obvious
tool for segfaults, but it might mention some odd results from
calls, which could explain why something is taking an unexpected
path through the code), and the various bug-tracking tools
(bugzilla or whatever at freedesktop.org and the major distros) may
help.

 In general, you need to get an insight into where it is blowing up,
and then use whatever is available to either find out why, or to find
an existing workaround.  Gdb is often the best way to find 'where',
but learning to use it productively is a task in itself.

ĸen
-- 
das eine Mal als Tragödie, das andere Mal als Farce
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to