Re: Code fails with Segmentation Fault
- From: "Tom St Denis" <tomstdenis@xxxxxxxxx>
- Date: 28 Nov 2006 10:24:10 -0800
santosh wrote:
I agree with you here. Above all, learning to use gdb [or similiar
tool] is very valuable. Learn to develop with it on a routine basis as
it will save your behind more often than not.
It's likely that a beginner is often put off by a complex program like
gdb. A graphical front-end like ddd might alleviate the learning curve.
Bah...
gcc -g3 myfirstfailure.c -o test
gdb test
runvim myfirstfailure.c
backtrace
quit
..... fix ...
gcc -g3 myfirstfailure.c -o test
gdb test
.... rinse and repeat ...
But for very small programs, such as those you write when you start
learning C, it might be better to mentally "run" the program, rather
than fire up a debugger at a hint of the least problem.
Bah, learn to use GDB early on (especially how to walk the stack, print
locals/arguments, etc) and it'll be with you throughout your career.
While it may be useless on a small program for a pro, it's a lesson
learned for the beginner (who won't have complicated programs until
it's too late and by then they should already know how to debug....)
Tom
.
- References:
- Code fails with Segmentation Fault
- From: Vlad Dogaru
- Re: Code fails with Segmentation Fault
- From: Bill Medland
- Re: Code fails with Segmentation Fault
- From: Tom St Denis
- Re: Code fails with Segmentation Fault
- From: santosh
- Code fails with Segmentation Fault
- Prev by Date: Re: Code fails with Segmentation Fault
- Next by Date: Re: Please Help ----------Free Downloadable Ebooks for C & C++ Language needed
- Previous by thread: Re: Code fails with Segmentation Fault
- Next by thread: Re: Code fails with Segmentation Fault
- Index(es):