public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/15209] New: ptype/whatis cannot resolve Fortran module name
@ 2013-02-27 14:02 sanimir.agovic at intel dot com
  2013-02-27 16:20 ` [Bug fortran/15209] " jan.kratochvil at redhat dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: sanimir.agovic at intel dot com @ 2013-02-27 14:02 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15209

             Bug #: 15209
           Summary: ptype/whatis cannot resolve Fortran module name
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned@sourceware.org
        ReportedBy: sanimir.agovic@intel.com
    Classification: Unclassified


Created attachment 6906
  --> http://sourceware.org/bugzilla/attachment.cgi?id=6906
[PATCH/RFC] fortran: add module names to the symbol table

Compile the reproducer with "gfortran -g -o mod mod.f90"

ptype/whatis on a Fortran module name yield the following message:
% gdb mod -batch -ex "ptype mod1"
No symbol "mod1" in current context.

Expected is something like:
type = module mod1


## Uncomplete patch
The attached patch adds Fortran module names to the symbol table and thus
produces the expected result. Jan Kratochvil pointed out that this patch
introduces a regression, reproduced by:
gdb mod -batch -ex 'b 13' -ex r -ex 'p mod2' -ex 'ptype mod2'
[...]
Attempt to use a type name as an expression
type = module mod2

Whereas the correct output is:
[...]
$1 = 50
type = integer(kind=4)

## References
http://sourceware.org/ml/gdb-patches/2013-02/msg00643.html

## Reproducer
module mod1
        integer :: var_i = 1
        integer :: mod2 = 50
end module mod1

module mod2
        integer :: var_i = 2
end module mod2

        subroutine sub1
        use mod1
        mod2 = 51
        end

        program module
        call sub1
end

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug fortran/15209] ptype/whatis cannot resolve Fortran module name
  2013-02-27 14:02 [Bug fortran/15209] New: ptype/whatis cannot resolve Fortran module name sanimir.agovic at intel dot com
@ 2013-02-27 16:20 ` jan.kratochvil at redhat dot com
  2013-12-19 12:18 ` cvs-commit at gcc dot gnu.org
  2022-02-25 17:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: jan.kratochvil at redhat dot com @ 2013-02-27 16:20 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15209

Jan Kratochvil <jan.kratochvil at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jan.kratochvil at redhat
                   |                            |dot com

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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

* [Bug fortran/15209] ptype/whatis cannot resolve Fortran module name
  2013-02-27 14:02 [Bug fortran/15209] New: ptype/whatis cannot resolve Fortran module name sanimir.agovic at intel dot com
  2013-02-27 16:20 ` [Bug fortran/15209] " jan.kratochvil at redhat dot com
@ 2013-12-19 12:18 ` cvs-commit at gcc dot gnu.org
  2022-02-25 17:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2013-12-19 12:18 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15209

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, master has been updated
       via  530e8392d7d5d4a831c5ce0e4cd410e1c4bd166a (commit)
       via  7f9b20bb352768e14cfa7361a82373b8539bebed (commit)
      from  f6ec89e7bc631c0bd48cb6c4b960b29266e19550 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=530e8392d7d5d4a831c5ce0e4cd410e1c4bd166a

commit 530e8392d7d5d4a831c5ce0e4cd410e1c4bd166a
Author: Keven Boell <keven.boell@intel.com>
Date:   Fri Nov 15 11:32:01 2013 +0100

    fortran: enable ptype/whatis for modules.

    Added new domain MODULE_DOMAIN for fortran modules to avoid
    issues with sharing namespaces (e.g. when a variable currently
    in scope has the same name as a module).

        (gdb) ptype modname
        old> No symbol "modname" in current context.
        new> type = module modname

    This fixes PR 15209 and also addresses the issue
    with sharing namespaces:
    https://sourceware.org/ml/gdb-patches/2013-02/msg00643.html

    2013-11-19  Keven Boell  <keven.boell@intel.com>
                Sanimir Agovic  <sanimir.agovic@intel.com>

        * cp-namespace.c (cp_lookup_nested_symbol): Enable
        nested lookups for fortran modules.
        * dwarf2read.c (read_module): Add fortran module to
        the symbol table.
        (add_partial_symbol, add_partial_module): Add fortran
        module to the partial symbol table.
        (new_symbol_full): Create full symbol for fortran module.
        * f-exp.y (yylex): Add new module domain to be parsed.
        * symtab.h: New domain for fortran modules.

    testsuite/

        * gdb.fortran/module.exp: Completion matches fortran module
        names as well. ptype/whatis on modules return a proper type.
        Add new check for having the correct scope.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7f9b20bb352768e14cfa7361a82373b8539bebed

commit 7f9b20bb352768e14cfa7361a82373b8539bebed
Author: Keven Boell <keven.boell@intel.com>
Date:   Fri Oct 25 12:10:57 2013 +0100

    fortran: enable ptype/whatis for user defined types.

        (gdb) ptype type
        old> No symbol "type" in current context.
        new> type = Type type
             integer(kind=4) :: t_i
             End Type type

    2013-11-19  Sanimir Agovic  <sanimir.agovic@intel.com>
                Keven Boell  <keven.boell@intel.com>

        * f-exp.y (yylex): Add domain array to enable lookup
        in multiple domains. Loop over lookup domains and try
        to find requested symbol. Add STRUCT_DOMAIN to lookup
        domains to be able to query for user defined types.

    testsuite/
        * gdb.fortran/type.f90: New file.
        * gdb.fortran/whatis_type.f90: New file.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                 |   19 +++++++++++
 gdb/cp-namespace.c                        |    4 ++
 gdb/dwarf2read.c                          |   20 ++++++++++++
 gdb/f-exp.y                               |   38 +++++++++++++++-------
 gdb/symtab.h                              |    4 ++
 gdb/testsuite/ChangeLog                   |   11 ++++++
 gdb/testsuite/gdb.fortran/module.exp      |   13 ++++++--
 gdb/testsuite/gdb.fortran/module.f90      |   12 +++++++
 gdb/testsuite/gdb.fortran/type.f90        |   28 +++++++++++++++++
 gdb/testsuite/gdb.fortran/whatis_type.exp |   48 +++++++++++++++++++++++++++++
 10 files changed, 182 insertions(+), 15 deletions(-)
 create mode 100644 gdb/testsuite/gdb.fortran/type.f90
 create mode 100644 gdb/testsuite/gdb.fortran/whatis_type.exp

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


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

* [Bug fortran/15209] ptype/whatis cannot resolve Fortran module name
  2013-02-27 14:02 [Bug fortran/15209] New: ptype/whatis cannot resolve Fortran module name sanimir.agovic at intel dot com
  2013-02-27 16:20 ` [Bug fortran/15209] " jan.kratochvil at redhat dot com
  2013-12-19 12:18 ` cvs-commit at gcc dot gnu.org
@ 2022-02-25 17:02 ` tromey at sourceware dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2022-02-25 17:02 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Was this fixed, or is there still something to be done?

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

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

end of thread, other threads:[~2022-02-25 17:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 14:02 [Bug fortran/15209] New: ptype/whatis cannot resolve Fortran module name sanimir.agovic at intel dot com
2013-02-27 16:20 ` [Bug fortran/15209] " jan.kratochvil at redhat dot com
2013-12-19 12:18 ` cvs-commit at gcc dot gnu.org
2022-02-25 17:02 ` 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).