12.10 Use of gdb to Debug the FPU Operations

The GNU debugger gdb is a very useful utility on Unix-like systems for debugging C, C++, assembly language and some other programs (with limitations). Our interest in it arises because we are using floating-point instructions to implement many of the constructs in miniC and gdb has good facility for monitoring the activity of the x86 FPU.

We do not plan to discuss here the full working of GNU gdb, but we demonstrate only its usefulness for checking and debugging the floating-point code generated by our compiler. We used gdb extensively while developing the action terms (attribute rules) in the miniC yacc grammar, the code generator and the assembly language built-in library. We shall demonstrate the ...

Get Compilers: Principles and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.