diff options
Diffstat (limited to 'gdb/testsuite/gdb.python/py-unwind-inline.py')
-rw-r--r-- | gdb/testsuite/gdb.python/py-unwind-inline.py | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/gdb/testsuite/gdb.python/py-unwind-inline.py b/gdb/testsuite/gdb.python/py-unwind-inline.py index 4ee52c5..3042472 100644 --- a/gdb/testsuite/gdb.python/py-unwind-inline.py +++ b/gdb/testsuite/gdb.python/py-unwind-inline.py @@ -23,49 +23,50 @@ from gdb.unwinder import Unwinder apb_global = None -class dummy_unwinder (Unwinder): - """ A dummy unwinder that looks at a bunch of registers as part of + +class dummy_unwinder(Unwinder): + """A dummy unwinder that looks at a bunch of registers as part of the unwinding process.""" - class frame_id (object): - """ Basic frame id.""" + class frame_id(object): + """Basic frame id.""" - def __init__ (self, sp, pc): - """ Create the frame id.""" + def __init__(self, sp, pc): + """Create the frame id.""" self.sp = sp self.pc = pc - def __init__ (self): + def __init__(self): """Create the unwinder.""" - Unwinder.__init__ (self, "dummy stack unwinder") + Unwinder.__init__(self, "dummy stack unwinder") self.void_ptr_t = gdb.lookup_type("void").pointer() self.regs = None - def get_regs (self, pending_frame): + def get_regs(self, pending_frame): """Return a list of register names that should be read. Only gathers the list once, then caches the result.""" - if (self.regs != None): + if self.regs != None: return self.regs # Collect the names of all registers to read. - self.regs = list (pending_frame.architecture () - .register_names ()) + self.regs = list(pending_frame.architecture().register_names()) return self.regs - def __call__ (self, pending_frame): + def __call__(self, pending_frame): """Actually performs the unwind, or at least sniffs this frame to see if the unwinder should claim it, which is never does.""" try: - for r in (self.get_regs (pending_frame)): - v = pending_frame.read_register (r).cast (self.void_ptr_t) + for r in self.get_regs(pending_frame): + v = pending_frame.read_register(r).cast(self.void_ptr_t) except: - print ("Dummy unwinder, exception") + print("Dummy unwinder, exception") raise return None + # Register the ComRV stack unwinder. -gdb.unwinder.register_unwinder (None, dummy_unwinder (), True) +gdb.unwinder.register_unwinder(None, dummy_unwinder(), True) -print ("Python script imported") +print("Python script imported") |