def debug(got_error): tb = None if got_error: import traceback stacktrace_errmsg = ["Error:\n"] exc, val, tb = sys.exc_info() stacktrace_errmsg.extend( [" %s" % line for line in traceback.format_tb(tb)]) summary_errmsg = traceback.format_exception_only(exc, val) block = getattr(val, '__annotator_block', None) if block: class FileLike: def write(self, s): summary_errmsg.append(" %s" % s) summary_errmsg.append("Processing block:\n") t.about(block, FileLike()) log.info(''.join(stacktrace_errmsg)) log.ERROR(''.join(summary_errmsg)) else: log.event('Done.') if translateconfig.batch: log.event("batch mode, not calling interactive helpers") return log.event("start debugger...") if translateconfig.view: try: t1 = drv.hint_translator except (NameError, AttributeError): t1 = t from rpython.translator.tool import graphpage page = graphpage.TranslatorPage(t1, translateconfig.huge) page.display_background() pdb_plus_show.start(tb)
def do_callgraph(self, arg): """callgraph show the program's call graph""" from rpython.translator.tool import graphpage self._show(graphpage.TranslatorPage(self.translator, 100))