Commit ac7829c9 authored by Kirill Smelkov's avatar Kirill Smelkov

Fix for recent GDB / Python without debug info

Without explicit casts GDB complains e.g.

    'PyGILState_Ensure' has unknown return type; cast the call to its declared return type

and does not execute the commands.
parent d0c90ab3
......@@ -23,15 +23,15 @@ def inject(pid, filename, verbose=False, gdb_prefix=''):
"""Executes a file in a running Python process."""
filename = os.path.abspath(filename)
gdb_cmds = [
'PyGILState_Ensure()',
'PyRun_SimpleString("'
'(int)PyGILState_Ensure()',
'(int)PyRun_SimpleString("'
'import sys; sys.path.insert(0, \\"%s\\"); '
'sys.path.insert(0, \\"%s\\"); '
'exec(open(\\"%s\\").read())")' %
(os.path.dirname(filename),
os.path.abspath(os.path.join(os.path.dirname(__file__), '..')),
filename),
'PyGILState_Release($1)',
'(void)PyGILState_Release($1)',
]
p = subprocess.Popen('%sgdb -p %d -batch %s' % (gdb_prefix, pid,
' '.join(["-eval-command='call %s'" % cmd for cmd in gdb_cmds])),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment