21 if sys.version_info[0] > 2:
23 from imp
import reload
48 write(s, stream=STDOUT)
54 write(s, stream=STDERR)
78 """Internal function called from GDB to execute all unwinders.
80 Runs each currently enabled unwinder until it finds the one that
81 can unwind given frame.
84 pending_frame: gdb.PendingFrame instance.
86 gdb.UnwindInfo instance or None.
88 for objfile
in _gdb.objfiles():
89 for unwinder
in objfile.frame_unwinders:
91 unwind_info = unwinder(pending_frame)
92 if unwind_info
is not None:
95 current_progspace = _gdb.current_progspace()
96 for unwinder
in current_progspace.frame_unwinders:
98 unwind_info = unwinder(pending_frame)
99 if unwind_info
is not None:
102 for unwinder
in frame_unwinders:
104 unwind_info = unwinder(pending_frame)
105 if unwind_info
is not None:
112 PYTHONDIR = os.path.dirname(os.path.dirname(__file__))
129 for package
in packages:
130 location = os.path.join(os.path.dirname(__file__), package)
131 if os.path.exists(location):
132 py_files = filter(
lambda x: x.endswith(
'.py')
133 and x !=
'__init__.py',
134 os.listdir(location))
136 for py_file
in py_files:
138 modname =
"%s.%s.%s" % ( __name__, package, py_file[:-3] )
140 if modname
in sys.modules:
142 reload(__import__(modname))
146 sys.stderr.write (traceback.format_exc() +
"\n")
151 """Update sys.path, reload gdb and auto-load packages."""
155 sys.path.remove(PYTHONDIR)
158 sys.path.insert(0, dir)
164 reload(__import__(__name__))
def GdbSetPythonDirectory(dir)
def execute_unwinders(pending_frame)
def writelines(self, iterable)