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):
self.filename = os.path.abspath(filename)
gdb_cmds = [
'PyGILState_Ensure()',
# Allow payloads to import modules alongside them, and allow them
# to 'import pyrasite' as well.
'PyRun_SimpleString("import sys; sys.path.insert(0, \\"%s\\"); '
'sys.path.insert(0, \\"%s\\")"' % (
os.path.dirname(self.filename),
os.path.join(os.path.abspath(__file__), '..')),
'PyRun_SimpleString("exec(open(\\"%s\\").read())")' %
self.filename,
'PyRun_SimpleString("'
'import sys; sys.path.insert(0, \\"%s\\"); '
'sys.path.insert(0, \\"%s\\"); '
'exec(open(\\"%s\\").read())")' %
(os.path.dirname(self.filename),
os.path.abspath(os.path.join(os.path.dirname(__file__), '..')),
self.filename),
'PyGILState_Release($1)',
]
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