Bug 15326 - Problem inspecting recursive Derived Data Type
Summary: Problem inspecting recursive Derived Data Type
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: fortran (show other bugs)
Version: 7.5
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-30 16:31 UTC by Phil M. Fischer
Modified: 2016-07-14 10:52 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Phil M. Fischer 2013-03-30 16:31:56 UTC
Hi all,

I am using GDB and GFortran within an Eclipse development environment. Right now, i have come across an issue concerning GDB. This issue makes it impossible for me to use GDB within Eclipse for the moment. So I tried to see if I can reproduce this issue. I am running Eclipse on a 32 bit Windows Vista Computer as well as on 64bit Windows 8 Machine. I am using GFortran and GDB with the latest MinGW installation. Both computers show the same issues. So here is what happens. 

Step 1: I have code that contains a Derived Type for a linked list:

1 : PROGRAM GDB_Fail
2 :
3 :    IMPLICIT NONE
4 :
5 :    TYPE :: Test_Node
6 :        TYPE(Test_Node), POINTER :: next => null()
7 :        INTEGER data
8 :    END TYPE
9 :
10:    TYPE(Test_Node) :: node_test
11:
12:    node_test%data = 4
13:
14: END PROGRAM GDB_Fail

Step 2: Setting a breakpoint at line 12
(gdb) br 12

Step 3: Run the program
Step 4: Inspect the node on its next item
(gdb) print node_test%next
PTR TO -> (     Type test_node
PTR TO -> (         Type test_node
PTR TO -> (             Type test_node
PTR TO -> (                 Type test_node
PTR TO -> (                     Type test_node
PTR TO -> (                         Type test_node
PTR TO -> (                             Type test_node
PTR TO -> (                                 Type test_node
PTR TO -> (                                     Type test_node
PTR TO -> (                                         Type test_node
PTR TO -> (                                             Type test_node
PTR TO -> (                                                 Type test_node
PTR TO -> (                                                     Type test_node

This is the point where it fails and GDB apparently tries to evaluate the next pointer of the next pointer of the next pointer. The only way to stop is Ctrl-C. The output is exactly what I get from within Eclipse as well.

The same program written in C can be debugged without any trouble. 

For me it looks like there is an issue with GDB inspecting recursive Derived Types. 

Cheers

Phil
Comment 1 Tom Tromey 2013-04-12 17:19:19 UTC
I feel like I have seen this bug before, but I can't find it now.

Can you say what ptype should actually print here?
That would help.
Comment 2 Bernhard Heckel 2016-07-14 10:52:21 UTC
Can you retry with GDB mainline. This should be solved latest by this patch:
2bbad2ea1102733a2a4143be4afe195caf730cd0 (Fortran, typeprint: Forward level of details to be printed for pointers)