aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-unwind-inline.py
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-04-26 11:06:27 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-04-26 11:50:51 -0400
commit7c45c0c0fa8e2d8d9501b4fc108a456a3842e502 (patch)
treec33b9446a8f6db6cd480ea963bad7e42240ced4d /gdb/testsuite/gdb.python/py-unwind-inline.py
parentbea3329b76cf131ad4ac27acb6728b38984998b9 (diff)
downloadbinutils-users/simark/black.zip
binutils-users/simark/black.tar.gz
binutils-users/simark/black.tar.bz2
gdb: re-format Python files using black 21.4b0users/simark/black
Re-format all Python files using black [1] version 21.4b0. This specific version (currently the latest) can be installed using: $ pip3 install 'black == 21.4b0' All you need to do to re-format files is run `black <file/directory>`, and black will re-format any Python file it finds in there. It runs quite fast, so the simplest is probably to do: $ black gdb/ from the top-level. Change-Id: I28588a22c2406afd6bc2703774ddfff47cd61919
Diffstat (limited to 'gdb/testsuite/gdb.python/py-unwind-inline.py')
-rw-r--r--gdb/testsuite/gdb.python/py-unwind-inline.py37
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")