binutils-gdb/gdb/python
Simon Marchi a7952927db gdb: change value_of_register and value_of_register_lazy to take the next frame
Some functions related to the handling of registers in frames accept
"this frame", for which we want to read or write the register values,
while other functions accept "the next frame", which is the frame next
to that.  The later is needed because we sometimes need to read register
values for a frame that does not exist yet (usually when trying to
unwind that frame-to-be).

value_of_register and value_of_register_lazy both take "this frame",
even if what they ultimately want internally is "the next frame".  This
is annoying if you are in a spot that currently has "the next frame" and
need to call one of these functions (which happens later in this
series).  You need to get the previous frame only for those functions to
get the next frame again.  This is more manipulations, more chances of
mistake.

I propose to change these functions (and a few more functions in the
subsequent patches) to operate on "the next frame".  Things become a bit
less awkward when all these functions agree on which frame they take.

So, in this patch, change value_of_register_lazy and value_of_register
to take "the next frame" instead of "this frame".  This adds a lot of
get_next_frame_sentinel_okay, but if we convert the user registers API
to also use "the next frame" instead of "this frame", it will get simple
again.

Change-Id: Iaa24815e648fbe5ae3c214c738758890a91819cd
Reviewed-By: John Baldwin <jhb@FreeBSD.org>
2023-12-14 16:04:49 +00:00
..
lib/gdb Implement DAP cancellation 2023-12-11 11:44:35 -07:00
py-all-events.def gdb: add Python events for program space addition and removal 2023-10-02 17:06:40 +01:00
py-arch.c
py-auto-load.c gdb: add program_space parameters to some auto-load functions 2023-10-05 13:20:50 -04:00
py-block.c
py-bpevent.c Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-breakpoint.c Use unique_xmalloc_ptr in explicit_location_spec 2023-12-13 14:12:52 -07:00
py-cmd.c gdb/python: display errors from command completion 2023-11-28 18:23:19 +00:00
py-connection.c
py-continueevent.c
py-dap.c [gdb/dap] Disable DAP for python <= 3.5 2023-08-02 23:14:58 +02:00
py-disasm.c gdb: Replace gdb::optional with std::optional 2023-11-21 11:52:35 +00:00
py-event-types.def gdb: add Python events for program space addition and removal 2023-10-02 17:06:40 +01:00
py-event.c
py-event.h gdb: add program_space parameter to emit_clear_objfiles_event 2023-10-05 13:20:50 -04:00
py-events.h
py-evtregistry.c
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c Fix gdb.FinishBreakpoint when returning to an inlined function 2023-12-12 15:57:14 +01:00
py-frame.c gdb: change value_of_register and value_of_register_lazy to take the next frame 2023-12-14 16:04:49 +00:00
py-framefilter.c gdb: Replace gdb::optional with std::optional 2023-11-21 11:52:35 +00:00
py-function.c
py-gdb-readline.c gdb/python: avoid use of _PyOS_ReadlineTState 2023-12-13 10:46:44 +01:00
py-inferior.c gdb: Replace gdb::optional with std::optional 2023-11-21 11:52:35 +00:00
py-infevents.c
py-infthread.c [gdb/build] Return gdb::array_view in thread_info_to_thread_handle 2023-08-24 13:40:38 +02:00
py-instruction.c
py-instruction.h
py-lazy-string.c Handle gdb.LazyString in DAP 2023-10-16 09:27:28 -06:00
py-linetable.c
py-membuf.c
py-mi.c Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-micmd.c gdb/python: generalize serialize_mi_result() 2023-10-10 11:22:56 +01:00
py-newobjfileevent.c gdb: add program_space parameter to emit_clear_objfiles_event 2023-10-05 13:20:50 -04:00
py-objfile.c gdb: remove target_gdbarch 2023-10-10 10:44:35 -04:00
py-param.c [gdb/build] Fix enum param_types odr violation 2023-08-14 18:32:29 +02:00
py-prettyprint.c Introduce gdb.ValuePrinter 2023-09-26 09:29:14 -06:00
py-progspace.c gdb: implement missing debug handler hook for Python 2023-11-14 12:02:47 +00:00
py-record-btrace.c gdb: remove target_gdbarch 2023-10-10 10:44:35 -04:00
py-record-btrace.h
py-record-full.c
py-record-full.h
py-record.c
py-record.h
py-ref.h
py-registers.c
py-signalevent.c Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-stopevent.c Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-stopevent.h Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-symbol.c Remove explanatory comments from includes 2023-09-20 11:45:16 -06:00
py-symtab.c
py-threadevent.c
py-tui.c Fix resizing of TUI python windows 2023-11-06 18:32:41 +01:00
py-type.c Give a language to a type 2023-09-19 13:28:42 -06:00
py-uiout.h Emit stop reason details in Python stop events 2023-12-11 10:51:32 -07:00
py-unwind.c gdb: change value_of_register and value_of_register_lazy to take the next frame 2023-12-14 16:04:49 +00:00
py-utils.c gdb: Replace gdb::optional with std::optional 2023-11-21 11:52:35 +00:00
py-value.c gdb/python: Add new gdb.Value.bytes attribute 2023-10-26 18:27:17 +01:00
py-varobj.c gdb: Use C++17's std::make_unique instead of gdb::make_unique 2023-11-21 11:52:35 +00:00
py-xmethods.c
python-config.py
python-internal.h gdb: move gdbpy_gil into python-internal.h 2023-12-13 10:46:39 +01:00
python.c gdb: move gdbpy_gil into python-internal.h 2023-12-13 10:46:39 +01:00
python.h