Discussion:
[Bug python/22498] New: Can't access type component when calling script from command line
zed.three at gmail dot com
2017-11-26 17:49:17 UTC
Permalink
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.
zed.three at gmail dot com
2017-11-26 17:49:28 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22498

zed.three at gmail dot com changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |zed.three at gmail dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-04-21 21:50:22 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22498

Tom Tromey <tromey at sourceware dot org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org

--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
How exactly do you invoke reproducer.py?
--
You are receiving this mail because:
You are on the CC list for the bug.
zed.three at gmail dot com
2018-04-22 10:32:58 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22498

--- Comment #2 from zed.three at gmail dot com ---
Compile mvce.f90:

gfortran -g mvce.f90

Then run the reproducer from the command line with:

gdb --python reproducer.py

And from inside gdb with:

gdb ./a.out
py exec(open("reproducer.py").read())
--
You are receiving this mail because:
You are on the CC list for the bug.
tromey at sourceware dot org
2018-09-15 06:48:51 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=22498

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I get

("{my_char = 'good'}", '<error reading variable>')

in both cases.

I'm using

$ gdb -batch -nx -x r.py


Note also that --python never landed in gdb proper.
There's another bug open about that.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...