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

Gary Klimowicz via flang-dev flang-dev at lists.llvm.org
Tue Mar 24 15:17:26 PDT 2020


Hi, Sourabh.

We've confirmed the bug. It can be worked around by removing the VALUE attribute.

Can you file an issue for us on the (current) Flang GitHub site?
https://github.com/flang-compiler/flang/issues

Thank you.


On 3/24/20, 12:52 PM, "flang-dev on behalf of Sourabh Singh Tomar via flang-dev" <flang-dev-bounces at lists.llvm.org<mailto:flang-dev-bounces at lists.llvm.org> on behalf of flang-dev at lists.llvm.org<mailto:flang-dev at lists.llvm.org>> wrote:

External email: Use caution opening links or attachments

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.

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20200324/14a35617/attachment.html>


More information about the flang-dev mailing list