Online / 5 & 6 February 2022

visit

Enhanced debuggability support in LLVM for various Fortran language features

Fortran debuggabiliy support in LLVM


The aim of this abstract is to showcase the enhanced debuggability support added in LLVM for the Fortran language features. LLVM being emerging compiler framework, there was some gap to be bridged w.r.t. Fortran language debug info generation. This is because Fortran language has few features which are very powerful, as compared to other languages.

Fortran dynamic arrays are one such powerful language feature. There are variety of arrays like adjustable array, assumed shape, assumed size, assumed rank, allocatable and pointer arrays. LLVM generated debug info was not sufficient to debug these many variety of arrays with GDB/LLDB. The LLVM was lacking support for multiple DWARF operators (DWOPpushobject address, DWOPover), DWARF attributes (DWATdatalocation, DWATallocated, DWATassociated, DWATrank) and a DWARF TAGs (DWTAGgeneric_subrange). Other than these, existing support for DISubrange was not sufficient to handle Fortran arrays. The same was true for Fortran strings which is not mere pointer to character type and needed more support from LLVM. Other features which needed similar LLVM support for debugging were Fortran modules, namelist and signed constants etc.

All these enhancements made in LLVM are as per DWARF4 or DWARF5 specification for the Fortran language. These enhanced debug info are used by GDB/LLDB and user debugging experience is improved now while handling these Fortran features with GDB/LLDB. In order to make use of these enhanced debug info emitted by LLVM, GDB/LLDB is also enhanced in cases where required. With these enhancements added now in LLVM, Fortran program debugging experience with the clang/flang emitted programs are on par with gcc/gfortran emitted programs and in some cases it’s even better than gcc/gfortran.

Speakers

Alok Sharma
Bhuvanendra Kumar N

Attachments

Links