Commit 17f24b36 authored by Luke Macken's avatar Luke Macken

Modify the path in the same PyRun_SimpleString that we exec code in.

parent 4a6dd64a
...@@ -52,14 +52,13 @@ class CodeInjector(object): ...@@ -52,14 +52,13 @@ class CodeInjector(object):
self.filename = os.path.abspath(filename) self.filename = os.path.abspath(filename)
gdb_cmds = [ gdb_cmds = [
'PyGILState_Ensure()', 'PyGILState_Ensure()',
# Allow payloads to import modules alongside them, and allow them 'PyRun_SimpleString("'
# to 'import pyrasite' as well. 'import sys; sys.path.insert(0, \\"%s\\"); '
'PyRun_SimpleString("import sys; sys.path.insert(0, \\"%s\\"); ' 'sys.path.insert(0, \\"%s\\"); '
'sys.path.insert(0, \\"%s\\")"' % ( 'exec(open(\\"%s\\").read())")' %
os.path.dirname(self.filename), (os.path.dirname(self.filename),
os.path.join(os.path.abspath(__file__), '..')), os.path.abspath(os.path.join(os.path.dirname(__file__), '..')),
'PyRun_SimpleString("exec(open(\\"%s\\").read())")' % self.filename),
self.filename,
'PyGILState_Release($1)', 'PyGILState_Release($1)',
] ]
p = subprocess.Popen('%sgdb -p %d -batch %s' % (self.gdb_prefix, self.pid, p = subprocess.Popen('%sgdb -p %d -batch %s' % (self.gdb_prefix, self.pid,
......
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