gdb/python: add PendingFrame.level and Frame.level methods
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 26 May 2021 21:01:59 +0000 (22:01 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 21 Jun 2021 15:20:08 +0000 (16:20 +0100)
commitd52b8007213eea4d1f33e3a604481f390d37b52a
tree07158fe01e4d4d0edc2bf3e043d13198cb21d96e
parent8b9c48b287d42d1c816f441e4273dcb8c7af1876
gdb/python: add PendingFrame.level and Frame.level methods

Add new methods to the PendingFrame and Frame classes to obtain the
stack frame level for each object.

The use of 'level' as the method name is consistent with the existing
attribute RecordFunctionSegment.level (though this is an attribute
rather than a method).

For Frame/PendingFrame I went with methods as these classes currently
only use methods, including for simple data like architecture, so I
want to be consistent with this interface.

gdb/ChangeLog:

* NEWS: Mention the two new methods.
* python/py-frame.c (frapy_level): New function.
(frame_object_methods): Register 'level' method.
* python/py-unwind.c (pending_framepy_level): New function.
(pending_frame_object_methods): Register 'level' method.

gdb/doc/ChangeLog:

* python.texi (Unwinding Frames in Python): Mention
PendingFrame.level.
(Frames In Python): Mention Frame.level.

gdb/testsuite/ChangeLog:

* gdb.python/py-frame.exp: Add Frame.level tests.
* gdb.python/py-pending-frame-level.c: New file.
* gdb.python/py-pending-frame-level.exp: New file.
* gdb.python/py-pending-frame-level.py: New file.
gdb/ChangeLog
gdb/NEWS
gdb/doc/ChangeLog
gdb/doc/python.texi
gdb/python/py-frame.c
gdb/python/py-unwind.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-frame.exp
gdb/testsuite/gdb.python/py-pending-frame-level.c [new file with mode: 0644]
gdb/testsuite/gdb.python/py-pending-frame-level.exp [new file with mode: 0644]
gdb/testsuite/gdb.python/py-pending-frame-level.py [new file with mode: 0644]