It did that pretty well. One of the key features of gcc was that:
$ gcc -g ..
$ gcc -O ..
were not complimentary options. You could do optimise and debug at the
same time, and it worked nicely.
Nowadays with todays advanced optimisation selections, this is broken.
If you compile with -O and -g, you get stuff like this:
2386 int n1 = MIN(sizeof tbuf - addr - addr1, len);
(gdb) p/x w0
$2 = <optimized out>
What use is that? I want to see the value of w0, but now I resort to my
trusty friend "printf".
What went wrong?