This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: py-bt errors on backtrace with PyRun_SimpleString and friends
Type: crash Stage: resolved
Components: Demos and Tools Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: dmalcolm Nosy List: dmalcolm, iritkatriel, ngie, pmuldoon, tromey
Priority: normal Keywords:

Created on 2013-06-14 14:07 by pmuldoon, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg191131 - (view) Author: Phil Muldoon (pmuldoon) Date: 2013-06-14 14:07
(gdb) py-bt

#2 Frame 0xef8180, for file <string>, line 1, in <module> ()
Python Exception <type 'exceptions.IOError'> (2, 'No such file or directory', '<string>'): 
Error occurred in Python command: (2, 'No such file or directory', '<string>')

This is the actual raw frame data:

#0  frapy_pc (self=<gdb.Frame at remote 0x7ffff1ab28b0>, args=0x0) at ../../gdb/gdb/python/py-frame.c:223
#1  0x0000003edf4dcfd6 in call_function (oparg=<optimized out>, pp_stack=0x7fffffffd378) at /usr/src/debug/Python-2.7.3/Python/ceval.c:4082
#2  PyEval_EvalFrameEx (f=f@entry=Frame 0xef8180, for file <string>, line 1, in <module> (), throwflag=throwflag@entry=0)
    at /usr/src/debug/Python-2.7.3/Python/ceval.c:2740
#3  0x0000003edf4ddcbf in PyEval_EvalCodeEx (
During symbol reading, Multiple children of DIE 0x3904c refer to DIE 0x38d87 as their abstract origin.
co=co@entry=0x7ffff1adb8b0, globals=globals@entry=
    {'g': <gdb.Frame at remote 0x7ffff1ab28b0>, '__builtins__': <module at remote 0x7ffff1ba9ad0>, 'GdbRemoveReadlineFinder': <classobj at remote 0x7ffff1ac81f0>, '__package__': None, 'sys': <module at remote 0x7ffff1ba9b78>, 'gdb': <module at remote 0x7ffff1af2130>, '__name__': '__main__', '__doc__': None}, locals=locals@entry=
    {'g': <gdb.Frame at remote 0x7ffff1ab28b0>, '__builtins__': <module at remote 0x7ffff1ba9ad0>, 'GdbRemoveReadlineFinder': <classobj at remote 0x7ffff1ac81f0>, '__package__': None, 'sys': <module at remote 0x7ffff1ba9b78>, 'gdb': <module at remote 0x7ffff1af2130>, '__name__': '__main__', '__doc__': None}, args=args@entry=0x0, argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0x0, 
    defcount=defcount@entry=0, closure=closure@entry=0x0) at /usr/src/debug/Python-2.7.3/Python/ceval.c:3330
msg191136 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2013-06-14 15:06
pmuldoon: did you truncate the output of bt?  (or did the superior gdb you're using do this behind the scenes?  I know you hack on gdb itself, and this looks a superior gdb debugging an inferior gdb).

The reason for this error:

    Python Exception <type 'exceptions.IOError'> (2, 'No such file or directory', '<string>'): 

is that py-bt is attempting to print the line of source code that the frame is at, but the source was provided as a string, not a file, presumably due to a call to PyRun_SimpleString et al.

Python sets the filename of such code to be the dummy name "<string>", and py-bt attempts to use that as a real filename and open it, failing (unless you happen to have a file named "<string>" in which case it tries to list it).
msg191138 - (view) Author: Phil Muldoon (pmuldoon) Date: 2013-06-14 15:58
Yes I did truncate the output, the backtrace was very long.

This is my scenario:

gdb --args ./gdb <somefile>

When the superior gdb loads, I did:

(top-gdb) b frapy_pc
(top-gdb) run

In the inferior gdb, I did:

(gdb) start
(gdb) py g = gdb.selected_frame()
(gdb) py print g.pc()

This will hit the breakpoint in the inferior gdb and you will be returned to the superior gdb.  I then did:

(top-gdb) py-bt
msg361454 - (view) Author: Enji Cooper (ngie) * Date: 2020-02-05 21:02
This particular issue has been resolved in python 3.x.
msg382098 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-11-30 00:09
Python 2-only issue.
History
Date User Action Args
2022-04-11 14:57:46adminsetgithub: 62413
2020-11-30 00:09:20iritkatrielsetstatus: open -> closed

nosy: + iritkatriel
messages: + msg382098

resolution: out of date
stage: resolved
2020-02-05 21:02:29ngiesetnosy: + ngie
messages: + msg361454
2013-06-14 15:58:48pmuldoonsetmessages: + msg191138
2013-06-14 15:06:51dmalcolmsetassignee: dmalcolm
messages: + msg191136
title: py-bt errors on backtrace -> py-bt errors on backtrace with PyRun_SimpleString and friends
2013-06-14 14:11:37tromeysetnosy: + tromey
2013-06-14 14:07:25pmuldooncreate