Re: gcc compiler - debuging
On Oct 26, 5:56 pm, jacob navia <ja...@nospam.org> wrote:
Jorgen Grahn a =E9crit :
On Sun, 2009-10-25, Maxim Yegorushkin wrote:
On 25/10/09 14:51, t wrote:
How to debuge programc in gcc
You need to use a debugger, such as gdb. Google for "gdb tutorial".
Well, he doesn't actually need a debugger to debug.
Debugging is to me the activity of fixing bugs in general.
You can do that by reading the code, inserting printf()s,
writing unit tests, running it under strace/valgrind/etc,
provoking it in various ways ... or stepping around in a
symbolic debugger.
Personally I never learned to enjoy that last kind of
debugging, not even in C with its usually simpler call
chains. (Although naturally I use gdb for post-mortem
debugging of core dumps -- I'm not stupid).
You never learned to use a debugger?
If you would have learned, then you would need to do post
mortem debugging less often...
More likely, you're confusing cause and effect. He's never
learned to use a debugger because he hasn't needed it: some of
the ways he has enumerated (code review, detailed unit tests)
are more effective than a debugger in finding an eliminating
bugs. I know that in situations where good code review and
extensive unit tests are required, almost no one ends up using
the debugger, and in general, I feel that if I need a debugger,
I'm doing something wrong: programming too carelessly, for
example, or not writing detailed enough unit tests. (Typically,
I'll use one once or twice a year, at the most, and I've done
whole projects without one.)
--
James Kanze