diff options
author | Andrew Burgess <aburgess@redhat.com> | 2023-03-10 12:29:58 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2023-03-30 10:25:46 +0100 |
commit | 3712e78cab09017bf59105d44e2f745c5e608c5a (patch) | |
tree | 9de28d89f3dca732b04cfbfd26f59b1f1503aa59 /gdb/testsuite/gdb.python/py-unwind.py | |
parent | 64826d05d3ccc487009312958de5d83752b2867a (diff) | |
download | binutils-3712e78cab09017bf59105d44e2f745c5e608c5a.zip binutils-3712e78cab09017bf59105d44e2f745c5e608c5a.tar.gz binutils-3712e78cab09017bf59105d44e2f745c5e608c5a.tar.bz2 |
gdb/python: Add new gdb.unwinder.FrameId class
When writing an unwinder it is necessary to create a new class to act
as a frame-id. This new class is almost certainly just going to set a
'sp' and 'pc' attribute within the instance.
This commit adds a little helper class gdb.unwinder.FrameId that does
this job. Users can make use of this to avoid having to write out
standard boilerplate code any time they write an unwinder.
Of course, if the user wants their FrameId class to be more
complicated in some way, then they can still write their own class,
just like they could before.
I've simplified the example code in the documentation to now use the
new helper class, and I've also made use of this helper within the
testsuite.
Any existing user code will continue to work just as it did before
after this change.
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.python/py-unwind.py')
-rw-r--r-- | gdb/testsuite/gdb.python/py-unwind.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/gdb/testsuite/gdb.python/py-unwind.py b/gdb/testsuite/gdb.python/py-unwind.py index dbabb00..4e110c5 100644 --- a/gdb/testsuite/gdb.python/py-unwind.py +++ b/gdb/testsuite/gdb.python/py-unwind.py @@ -14,7 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import gdb -from gdb.unwinder import Unwinder +from gdb.unwinder import Unwinder, FrameId # These are set to test whether invalid register names cause an error. @@ -22,20 +22,6 @@ add_saved_register_error = False read_register_error = False -class FrameId(object): - def __init__(self, sp, pc): - self._sp = sp - self._pc = pc - - @property - def sp(self): - return self._sp - - @property - def pc(self): - return self._pc - - class TestUnwinder(Unwinder): AMD64_RBP = 6 AMD64_RSP = 7 |