diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-04-26 11:06:27 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-04-26 11:50:51 -0400 |
commit | 7c45c0c0fa8e2d8d9501b4fc108a456a3842e502 (patch) | |
tree | c33b9446a8f6db6cd480ea963bad7e42240ced4d /gdb/testsuite/gdb.python/py-recurse-unwind.py | |
parent | bea3329b76cf131ad4ac27acb6728b38984998b9 (diff) | |
download | binutils-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-recurse-unwind.py')
-rw-r--r-- | gdb/testsuite/gdb.python/py-recurse-unwind.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/gdb/testsuite/gdb.python/py-recurse-unwind.py b/gdb/testsuite/gdb.python/py-recurse-unwind.py index 8c7b134..1545614 100644 --- a/gdb/testsuite/gdb.python/py-recurse-unwind.py +++ b/gdb/testsuite/gdb.python/py-recurse-unwind.py @@ -16,7 +16,7 @@ # This unwinder never does any unwinding. It'll (pretend to) "sniff" # the frame and ultimately return None, indicating that actual unwinding # should be performed by some other unwinder. -# +# # But, prior to returning None, it will attempt to obtain the value # associated with a symbol via a call to gdb.parse_and_eval(). In # the course of doing this evaluation, GDB will potentially access @@ -28,23 +28,24 @@ import gdb from gdb.unwinder import Unwinder + class TestUnwinder(Unwinder): count = 0 @classmethod - def reset_count (cls): + def reset_count(cls): cls.count = 0 @classmethod - def inc_count (cls): + def inc_count(cls): cls.count += 1 - test = 'check_undefined_symbol' + test = "check_undefined_symbol" @classmethod - def set_test (cls, test) : - cls.test = test + def set_test(cls, test): + cls.test = test def __init__(self): Unwinder.__init__(self, "test unwinder") @@ -59,19 +60,19 @@ class TestUnwinder(Unwinder): self.recurse_level += 1 TestUnwinder.inc_count() - if TestUnwinder.test == 'check_user_reg_pc' : + if TestUnwinder.test == "check_user_reg_pc": - pc = pending_frame.read_register('pc') - pc_as_int = int(pc.cast(gdb.lookup_type('int'))) + pc = pending_frame.read_register("pc") + pc_as_int = int(pc.cast(gdb.lookup_type("int"))) # gdb.write("In unwinder: pc=%x\n" % pc_as_int) - elif TestUnwinder.test == 'check_pae_pc' : + elif TestUnwinder.test == "check_pae_pc": - pc = gdb.parse_and_eval('$pc') - pc_as_int = int(pc.cast(gdb.lookup_type('int'))) + pc = gdb.parse_and_eval("$pc") + pc_as_int = int(pc.cast(gdb.lookup_type("int"))) # gdb.write("In unwinder: pc=%x\n" % pc_as_int) - elif TestUnwinder.test == 'check_undefined_symbol' : + elif TestUnwinder.test == "check_undefined_symbol": try: val = gdb.parse_and_eval("undefined_symbol") @@ -83,5 +84,6 @@ class TestUnwinder(Unwinder): return None + gdb.unwinder.register_unwinder(None, TestUnwinder(), True) gdb.write("Python script imported\n") |