[flang-dev] GDB reporting Cannot access memory for formal arguments FLANG

Sourabh Singh Tomar via flang-dev flang-dev at lists.llvm.org
Thu Aug 8 04:01:44 PDT 2019


Hello Everyone,

I was working on issues with debug information in FLANG, struck in a issue
Test case:
 subroutine sub(a,b,c,d,e)
                integer a, e
                real b
                double precision c, a_s
                character (len=1) d
                a_s = b + e
                e = e + c
        end
        program main
                integer a
                real b
                double precision c
                character (len=1) d
                integer arr(4)
                arr(4) = 21
                a=789
                b=2.0
                c=3.d0
                d='S'
                call sub(a,b,c,d,arr(4))
        end

When, putting  a breakpoint at subroutine sub and running the program.  GDB
emits  --
Breakpoint 1, sub (a=<error reading variable: Cannot access memory at
address 0xffffe1d000000315>, b=<error reading variable: Cannot access
memory at address 0x31540000000>,
    c=<error reading variable: Cannot access memory at address
0x4008000000000000>, d=<error reading variable: Cannot access memory at
address 0x800000000000053>,
    e=<error reading variable: Cannot access memory at address 0x15>) at
test1.f90:1
1               subroutine sub(a,b,c,d,e)

GDB is not able access subroutine arguments.

.debug_loc section contents

    00000000 00000000002010f0 000000000020113c (DW_OP_breg5 (rdi): 0;
DW_OP_deref)
    00000015 <End of list>
    00000025 00000000002010f0 00000000002010fa (DW_OP_breg4 (rsi): 0;
DW_OP_deref)
    0000003a 00000000002010fa 000000000020113c (DW_OP_breg7 (rsp): -24;
DW_OP_deref; DW_OP_deref)
    00000050 <End of list>
    00000060 00000000002010f0 00000000002010ff (DW_OP_breg1 (rdx): 0;
DW_OP_deref)
    00000075 00000000002010ff 000000000020113c (DW_OP_breg7 (rsp): -32;
DW_OP_deref; DW_OP_deref)
    0000008b <End of list>
    0000009b 00000000002010f0 0000000000201112 (DW_OP_breg2 (rcx): 0;
DW_OP_deref)
    000000b0 <End of list>
    000000c0 00000000002010f0 0000000000201104 (DW_OP_breg8 (r8): 0;
DW_OP_deref)
    000000d5 0000000000201104 000000000020113c (DW_OP_breg7 (rsp): -40;
DW_OP_deref; DW_OP_deref)
    000000eb <End of list>

On analzsing the stack and memory using content of location list, it seems
arguments are their but location list description incorrect.

Can anybody help me with this.

Thanks in anticipation!
Sourabh Singh Tomar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/flang-dev/attachments/20190808/1c896180/attachment.html>


More information about the flang-dev mailing list