How to make a Front-end to invoke pdb methods interactively?

186 views Asked by At

I'm trying to make a GUI that invokes pdb methods interactivaly without a terminal. My code looks like this:

class Debugger(pdb.Pdb):

  def user_call(self, frame, args):
    name = frame.f_code.co_name or "<unknown>"
    print("call", name, args, frame)
    print('local:', frame.f_locals)
    print('global:', frame.f_globals)

  def user_line(self, frame):
    name = frame.f_code.co_name or "<unknown>"
    filename = self.canonic(frame.f_code.co_filename)
    print("break at", filename, frame.f_lineno, "in", name)
    print("continue...")

  def user_return(self, frame, value):
    name = frame.f_code.co_name or "<unknown>"
    print("return from", name, value)
    print("continue...")

  def user_exception(self, frame, exception):
    name = frame.f_code.co_name or "<unknown>"
    print("exception in", name, exception)
    print("continue...")

def debug():
  debugger = Debugger()

  # invoke the interactive debugging commands here 

if __name__=='__main__':
  debug()

How to start a debug session from the code pointing to a file and invoke commands like step and continue?

0

There are 0 answers