[flang-dev] Question WRT to debug info in flang.

Sourabh Singh Tomar via flang-dev flang-dev at lists.llvm.org
Tue Mar 24 12:28:45 PDT 2020


Hello Everyone,

For a typical Fortran program compiled with flang with -g(debuginfo
enabled), I'm noticing *DW_TAG_lexical_block* is getting created as child
of the *DW_TAG_subprogram*.
As a consequence of this debuggers like GDB  is not able to show the
arguments of the subprogram.
Program snippet -
subroutine sub(foo)
        integer, value :: foo
        print*,foo
      end subroutine
program main
      interface
        subroutine sub(a)
              integer, value :: a
         end subroutine
      end interface
             call sub(11)
 end program
--------------------------------
Snippet from GDB --
Breakpoint 1, sub () at test.f90:1
1             subroutine sub(foo)
(gdb) info args
No arguments.
-----------------------------------
Furthermore, *DW_TAG_formal_parameter* is created as a child of this
*DW_TAG_lexical_scope*. Hence GDB is showing arguments of the subprogram as
locals variables.
Snippet DWARF--
0x0000002f:   DW_TAG_subprogram
DW_AT_name      ("sub")
 DW_AT_low_pc    (0x00000000004011b0)
 DW_AT_high_pc   (0x0000000000401245
.....
0x00000049:     DW_TAG_lexical_block
 DW_AT_low_pc    (0x00000000004011b0)
 DW_AT_high_pc   (0x0000000000401245
 ....
0x0000005a:       DW_TAG_formal_parameter
  DW_AT_name      ("foo")
0x0000005a:       DW_TAG_variable
  DW_AT_name      ("foo")
...
---------------------------------------
Is this behavior intended ?

Anyone working on this area, Please share your understanding on this!

*Please note here that same hierarchy of debug info is also present at LLVM
IR level, hence the final DWARF is shared here.

Thank You,
Sourabh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20200325/d72c4543/attachment.html>


More information about the flang-dev mailing list