public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/22497] Unable to access base type of derived types
       [not found] <bug-22497-4717@http.sourceware.org/bugzilla/>
@ 2022-04-08 14:14 ` nils-christian.kempke at intel dot com
  2022-04-08 14:24 ` nils-christian.kempke at intel dot com
  2023-03-07 14:20 ` tromey at sourceware dot org
  2 siblings, 0 replies; 3+ messages in thread
From: nils-christian.kempke at intel dot com @ 2022-04-08 14:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=22497

Kempke, Nils-Christian <nils-christian.kempke at intel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nils-christian.kempke@intel
                   |                            |.com

--- Comment #1 from Kempke, Nils-Christian <nils-christian.kempke at intel dot com> ---
I can confirm that this was a bug in GDB but now actually only is one in
gfortran. I recently pushed 

87e10e9c288c2f6c933f235b623522c8d9a2d727

and

110aae55a8b7e19fa5f04998851968e48822605f

which fixed this problem on GDB's side. The problem with gfortran is, that it
is not emitting the correct DWARF OOP Fortran tags.

This is a known issue here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49475

Compiling the example with the ifort or ifx compiler I can get the following
out of gdb (breaking at line 17):

=================================================================
(gdb) p foo
$1 = ( my_int = 0 )
(gdb) p bar
$2 = ( my_type = ( my_int = 1 ) )
(gdb) ptype foo
type = Type my_type
    INTEGER*4 :: my_int
End Type my_type
(gdb) ptype bar
type = Type, extends(my_type) :: extended_type
    Type my_type :: my_type
End Type extended_type
(gdb) p bar%my_type
$3 = ( my_int = 1 )
(gdb) p bar%my_int
$4 = 1
(gdb) p bar%my_type%my_int
$5 = 1
(gdb)
=================================================================

The types emitted by gfortran (GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04)
9.3.0) do not provide any inheritance information:

=================================================================
 <1><53>: Abbrev Number: 2 (DW_TAG_structure_type)
    <54>   DW_AT_name        : (indirect string, offset: 0x8): extended_type
    <58>   DW_AT_byte_size   : 4
    <59>   DW_AT_decl_file   : 1
    <5a>   DW_AT_decl_line   : 1
    <5b>   DW_AT_sibling     : <0x6c>
 <2><5f>: Abbrev Number: 3 (DW_TAG_member)
    <60>   DW_AT_name        : (indirect string, offset: 0x0): my_type
    <64>   DW_AT_decl_file   : 1
    <65>   DW_AT_decl_line   : 8
    <66>   DW_AT_type        : <0x2e>
    <6a>   DW_AT_data_member_location: 0
 <2><6b>: Abbrev Number: 0
=================================================================

while ifx/ifort emit
=================================================================
 <2><5c>: Abbrev Number: 4 (DW_TAG_structure_type)
    <5d>   DW_AT_name        : (indirect string, offset: 0x3b): extended_type
    <61>   DW_AT_byte_size   : 4
    <62>   DW_AT_decl_file   : 1
    <63>   DW_AT_decl_line   : 8
 <3><64>: Abbrev Number: 5 (DW_TAG_inheritance)
    <65>   DW_AT_type        : <0x83>
 <3><69>: Abbrev Number: 0
...
 <2><83>: Abbrev Number: 4 (DW_TAG_structure_type)
    <84>   DW_AT_name        : (indirect string, offset: 0x68): my_type
    <88>   DW_AT_byte_size   : 4
    <89>   DW_AT_decl_file   : 1
    <8a>   DW_AT_decl_line   : 4
 <3><8b>: Abbrev Number: 6 (DW_TAG_member)
    <8c>   DW_AT_name        : (indirect string, offset: 0x57): my_int
    <90>   DW_AT_type        : <0x9a>
    <94>   DW_AT_decl_file   : 1
    <95>   DW_AT_decl_line   : 4
    <96>   DW_AT_data_member_location: 0
    <97>   DW_AT_accessibility: 1       (public)
 <3><98>: Abbrev Number: 0
=================================================================

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/22497] Unable to access base type of derived types
       [not found] <bug-22497-4717@http.sourceware.org/bugzilla/>
  2022-04-08 14:14 ` [Bug fortran/22497] Unable to access base type of derived types nils-christian.kempke at intel dot com
@ 2022-04-08 14:24 ` nils-christian.kempke at intel dot com
  2023-03-07 14:20 ` tromey at sourceware dot org
  2 siblings, 0 replies; 3+ messages in thread
From: nils-christian.kempke at intel dot com @ 2022-04-08 14:24 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=22497

--- Comment #2 from Kempke, Nils-Christian <nils-christian.kempke at intel dot com> ---
I forgot to mention that also for gfortran the bugfix did something:

I can now do

=================================================================
Breakpoint 1, mvce () at ./f.f90:17
17        print*, foo, bar
(gdb) p foo
$1 = ( my_int = 0 )
(gdb) p bar
$2 = ( my_type = ( my_int = 1 ) )
(gdb) p bar%my_int
There is no member named my_int.
(gdb) p bar%my_type
$3 = ( my_int = 1 )
(gdb) p bar%my_type%my_int
$4 = 1
(gdb)
=================================================================

Note, that since the inheritance info is missing GDB has no way of knowing that
"p bar%my_int" is legal and one has to go the way via accessing the member
variable first.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug fortran/22497] Unable to access base type of derived types
       [not found] <bug-22497-4717@http.sourceware.org/bugzilla/>
  2022-04-08 14:14 ` [Bug fortran/22497] Unable to access base type of derived types nils-christian.kempke at intel dot com
  2022-04-08 14:24 ` nils-christian.kempke at intel dot com
@ 2023-03-07 14:20 ` tromey at sourceware dot org
  2 siblings, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2023-03-07 14:20 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=22497

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |tromey at sourceware dot org
         Resolution|---                         |FIXED

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Since the gdb side of this is fixed, I'm closing this.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-07 14:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-22497-4717@http.sourceware.org/bugzilla/>
2022-04-08 14:14 ` [Bug fortran/22497] Unable to access base type of derived types nils-christian.kempke at intel dot com
2022-04-08 14:24 ` nils-christian.kempke at intel dot com
2023-03-07 14:20 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).