Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28742 Discussions

GDB (intel) : print works but not info address

pDs
Beginner
685 Views

The tree is as follows

    module M
        type A
          real     , allocatable :: dd (:)
        end type A
        
        
        type B 
          type (A) , pointer :: aa
        end type B
        
        
        type C
         type(B) , pointer :: bb
        end type C
        
        type(C) , allocatable :: cc(:)
         
    end module M

In gdb:

    print M::cc(10) % bb % aa % dd(100) 
    $1 = 0

However, 

    info address M::cc(10) % bb % aa % dd (100) 

generates the error: No symbol "cc(10) % bb % aa% dd (100)" in current context.

    whatis address M::cc(10) % bb % aa% dd(100)

generates the error: Cannot access memory at address 0xa0

I see that the compiler flag "-g" has to be specified to access global variables but that didn't help.

The reason I need the address is to `watch M::cc(10) %bb % aa % dd (100)` with a software watchpoint so that I don't slow gdb drastically. I'm hoping that this would give me insight into the lines of code which change the value of `dd (100)`. 

One option that I've already explored is to just go ahead and set the watch point with: 

    watch c(10) % bb % aa % dd ( 100 ) 

But this results in several hundred watchpoints with Numbers 1.1 , 1.2, 1.3 .... 1.500! This is really slowing down the execution in gdb.

So how could I access the address? If that is not possible, what is the best alternative?

0 Kudos
2 Replies
Ron_Green
Moderator
685 Views

was this with the system gdb or the Intel provide gdb with fortran enhancements?   In other words, is this when using gdb-ia instead of gdb?

0 Kudos
pDs
Beginner
685 Views

Hey Ronald, 

This is gdb-ia.

In another module, I had 

module test

real            :: a, b, c

end module

and gdb-ia couldn't find them when I tried accessing by "print test::a". However, 

module test

real            :: a=0, b=0, c=0

end module

changes that and I'm able to "print test::a" to display the value (not necessary 0 as a is read form a file later). This led me to believe that gdb-ia is able to access statically allocated variables/arrays. For dynamic allocation, I seem to have trouble.

Best Regards,
Pranav

 

 

 

0 Kudos
Reply