This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug python/22498] New: Can't access type component when calling script from command line


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

            Bug ID: 22498
           Summary: Can't access type component when calling script from
                    command line
           Product: gdb
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: python
          Assignee: unassigned at sourceware dot org
          Reporter: zed.three at gmail dot com
  Target Milestone: ---

Running the "reproducer.py" script below from the command line results in:

  {my_char = 'good'} <error reading variable>

while calling it from inside gdb produces the correct result:

  (gdb) py exec(open("reproducer.py").read())
  ...
  ( my_char = 'good' ) 'good'

Changing `my_char` to type `integer` does seem to work though.


---
mvce.f90:

  program mvce
    implicit none

    type :: my_type
      character(len=4) :: my_char
    end type my_type

    type(my_type) :: foo
    foo%my_char = "good"

    print*, foo%my_char

  end program mvce

---
reproducer.py:

  gdb.execute("file a.out")
  gdb.execute("b 11")
  gdb.execute("run")

  foo = gdb.parse_and_eval("foo")
  print(foo, foo['my_char'])

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]