Message 334196 - Python tracker (original) (raw)

I experienced this bug as well and have tried to dig into it a little.

I experimented with a service I have that uses shared libraries. If I compile with high level of optimizations for the C++ code (-O3) I don't experience the issue, but compiling without any optimizations I do.

I also tried with a script that does not use any shared libraries and I do not see the issue.

Digging into it a little, when running with the optimized version I found:

gdb.lookup_type('PyUnicodeObject')

returns a gdb.TYPE_CODE_TYPEDEF, which is the correct type. Running with the non-optimized version instead returns a gdb.TYPE_CODE_STRUCT.

The struct type errors because it has no target(), but I actually think target() might be superfluous here.

Both versions if I only call fields = gdb.lookup_type('PyUnicodeObject').fields() returns a list of fields, one of which is named data for the purposes of the pep check, so target() doesn't seem vital.