Thursday 19 February 2015

Why is gcc/gdb so bad?

When gcc 0.x came out - it was so refreshing. A free C compiler.
GCC evolved over the years, got slower and used more memory. I used
to use gcc on a 4MB RAM system (no typo), and wished I had 5MB RAM.
Today, memory is cheap, and a few GB to compile code is acceptable.
(The worst I have seen is 30+GB to compile a C++ piece of code - not
mine!)

One of the powerful features of gcc was that "gcc -g" and "gcc -O"
were not exclusive. And gdb came about as a free debugger, complimenting
gcc.

Over recent years, gdb has become closer to useless. It is a powerful
and complex and featureful debugger. But I am fed up single stepping
my code, and watching the line of execution bounce back and forth
because the compiler emits strange debug info where we move back
and forth over lines of code and declarations.

Today, in debugging fcterm - my attempt to place a breakpoint
on a line of code, puts the breakpoint *miles* away from the place I
am trying to intercept. This renders "gcc -g" close to useless, unless
I turn off all optimisations, and pray the compiler isnt inlining code.

Shame on gcc. Maybe I should switch to clang/llvm.

Post created by CRiSP v12.0.3a-b6801


1 comment:

  1. (My understanding is that llvm equivalent of -g -O is apprx. as primitive as early gcc was.)

    ReplyDelete