public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/26879] New: tab completion of type fields in Fortran doesn't work
@ 2020-11-13 17:19 andrew.burgess at embecosm dot com
  2020-11-14 21:22 ` [Bug cli/26879] " cvs-commit at gcc dot gnu.org
  2020-11-16 11:10 ` andrew.burgess at embecosm dot com
  0 siblings, 2 replies; 3+ messages in thread
From: andrew.burgess at embecosm dot com @ 2020-11-13 17:19 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26879
           Summary: tab completion of type fields in Fortran doesn't work
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: andrew.burgess at embecosm dot com
  Target Milestone: ---

Created attachment 12954
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12954&action=edit
Example code.

Download the attached example, unpack it then run 'make'.  The example include
a C example and a Fortran example.

The C example:

 struct my_type
 {
   int field_a;
   int other_field;
   int last_field;
 };

 struct my_type var;

 int
 main ()
 {
   return 0;
 }

Then in a GDB session:

 (gdb) start
 ...
 (gdb) p var.                   <- Trigger TAB completion here.
 field_a      last_field   other_field

Now compare this to the Fortran example:

 program test
   type my_type
      integer :: field_a
      integer :: other_field
      integer :: last_field
   end type my_type

   type(my_type) :: var

   print *, var
 end program test

And the GDB session:

 (gdb) start
 ...
 (gdb) p var%                   <- Trigger TAB completion here.
 Display all 200 possibilities? (y or n) n
 (gdb) p var%

Clearly GDB is not limiting the completions to the fields names when in Fortran
mode.

-- 
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 cli/26879] tab completion of type fields in Fortran doesn't work
  2020-11-13 17:19 [Bug cli/26879] New: tab completion of type fields in Fortran doesn't work andrew.burgess at embecosm dot com
@ 2020-11-14 21:22 ` cvs-commit at gcc dot gnu.org
  2020-11-16 11:10 ` andrew.burgess at embecosm dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-14 21:22 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andrew Burgess <aburgess@sourceware.org>:

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

commit 9dd02fc063284f59994c095ce525e1b8934b0dc1
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Fri Nov 13 18:27:42 2020 +0000

    gdb: add tab completion of type field names for Fortran

    Add support for tab-completion on Fortran field names.  Consider this
    test case:

     program test
       type my_type
          integer :: field_a
          integer :: other_field
          integer :: last_field
       end type my_type

       type(my_type) :: var

       print *, var
     end program test

    And the GDB session before this patch:

     (gdb) start
     ...
     (gdb) p var%                   <- Trigger TAB completion here.
     Display all 200 possibilities? (y or n) n
     (gdb) p var%

    And the GDB session with this patch:

     (gdb) start
     ...
     (gdb) p var%                   <- Trigger TAB completion here.
     field_a      last_field   other_field
     (gdb) p var%

    The implementation for this is basically copied from c-exp.y, I
    tweaked the parser patterns to be appropriate for Fortran, and it
    "just worked".

    gdb/ChangeLog:

            PR cli/26879
            * f-exp.y (COMPLETE): New token.
            (exp): Two new rules for tab-completion.
            (saw_name_at_eof): New static global.
            (last_was_structop): Likewise.
            (yylex): Set new variables, and return COMPLETE token at the end
            of the input stream in some cases.

    gdb/testsuite/ChangeLog:

            PR cli/26879
            * gdb.fortran/completion.exp: New file.
            * gdb.fortran/completion.f90: New file.

-- 
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 cli/26879] tab completion of type fields in Fortran doesn't work
  2020-11-13 17:19 [Bug cli/26879] New: tab completion of type fields in Fortran doesn't work andrew.burgess at embecosm dot com
  2020-11-14 21:22 ` [Bug cli/26879] " cvs-commit at gcc dot gnu.org
@ 2020-11-16 11:10 ` andrew.burgess at embecosm dot com
  1 sibling, 0 replies; 3+ messages in thread
From: andrew.burgess at embecosm dot com @ 2020-11-16 11:10 UTC (permalink / raw)
  To: gdb-prs

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

Andrew Burgess <andrew.burgess at embecosm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from Andrew Burgess <andrew.burgess at embecosm dot com> ---
Now fixed.

-- 
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:[~2020-11-16 11:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-13 17:19 [Bug cli/26879] New: tab completion of type fields in Fortran doesn't work andrew.burgess at embecosm dot com
2020-11-14 21:22 ` [Bug cli/26879] " cvs-commit at gcc dot gnu.org
2020-11-16 11:10 ` andrew.burgess at embecosm dot com

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).