C++ support in libcc1: A comprehensive update

GDB relies on libcc1‘s GCC and GDB plugins to implement the “compile code” feature, now extended to support the C++ language.

The Compile and Execute machinery enables GDB users to compile and execute code snippets within the context of an existing process. This allows users to perform inspection and modification of the program state using the target language well beyond the feature set historically exposed by symbolic debuggers. Almost anything that can be expressed in C, and now also in C++, can be compiled, loaded into the running program, and executed on the spot! It is envisioned that this machinery may also be used in the future to speed up conditional breakpoints, and as a foundation for more advanced features such as “Edit and Continue”.

The libcc1 module offers plugins for GDB and GCC that allow GDB to start GCC to compile a user-supplied code snippet. The plugins combine GDB and GCC into a single multi-process program. Through the plugins, GCC can query GDB about the meaning, in the target program, of names encountered in the snippet, and GDB can incrementally inform GCC about variables, functions, types and other constructs present in the program.

Continue reading “C++ support in libcc1: A comprehensive update”

Share

Inter-variable Out-of-SSA Coalescing in GCC

It was little more than a decade ago that GCC was dragged, kicking and screaming (as Richard T. Henderson put it), into adopting the SSA form for part of the compilation process. RTL remains in use for the later compilation passes, and the conversion out of SSA takes place exactly at the translation from the GIMPLE SSA form to RTL.

As usual, during this translation, we partition and coalesce SSA versions so as to reduce the number of allocated registers and stack slots and of copy instructions.

Continue reading “Inter-variable Out-of-SSA Coalescing in GCC”

Share

Multi-Thread, Async-Signal and Async-Cancel Safety Docs in GNU libc

POSIX specifies which of the interfaces it defines are safe to call in multi-threaded (MT) programs, in asynchronous signal (AS) handlers, and when asynchronous thread cancellation (AC) is enabled. But to what extent does GNU libc comply with POSIX, or even strive to? In this article we will dig into this topic and look at a recent project Red Hat has completed together with the upstream community.

gnu logo

Continue reading “Multi-Thread, Async-Signal and Async-Cancel Safety Docs in GNU libc”

Share