binutils-gdb/gdb/python
Andrew Burgess d2d62da62e gdb/python: have UnwindInfo.add_saved_register accept named args
Update gdb.UnwindInfo.add_saved_register to accept named keyword
arguments.

As part of this update we now use gdb_PyArg_ParseTupleAndKeywords
instead of PyArg_UnpackTuple to parse the function arguments.

By switching to gdb_PyArg_ParseTupleAndKeywords, we can now use 'O!'
as the argument format for the function's value argument.  This means
that we can check the argument type (is gdb.Value) as part of the
argument processing rather than manually performing the check later in
the function.  One result of this is that we now get a better error
message (at least, I think so).  Previously we would get something
like:

  ValueError: Bad register value

Now we get:

  TypeError: argument 2 must be gdb.Value, not XXXX

It's unfortunate that the exception type changed, but I think the new
exception type actually makes more sense.

My preference for argument names is to use full words where that's not
too excessive.  As such, I've updated the name of the argument from
'reg' to 'register' in the documentation, which is the argument name
I've made GDB look for here.

For existing unwinder code that doesn't throw any exceptions nothing
should change with this commit.  It is possible that a user has some
code that throws and catches the ValueError, and this code will break
after this commit, but I think this is going to be sufficiently rare
that we can take the risk here.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Tom Tromey <tom@tromey.com>
2023-04-06 14:57:32 +01:00
..
lib/gdb Add readMemory and writeMemory requests to DAP 2023-04-03 08:47:52 -06:00
py-all-events.def
py-arch.c
py-auto-load.c
py-block.c Remove ALL_BLOCK_SYMBOLS_WITH_NAME 2023-02-19 12:51:06 -07:00
py-bpevent.c
py-breakpoint.c gdb: fix mi breakpoint-deleted notifications for thread-specific b/p 2023-02-28 10:56:28 +00:00
py-cmd.c gdb, gdbserver, gdbsupport: fix whitespace issues 2023-03-09 16:32:00 -05:00
py-connection.c
py-continueevent.c
py-dap.c Simplify interp::exec / interp_exec - let exceptions propagate 2023-02-08 17:28:42 +00:00
py-disasm.c gdb/python: replace strlen call with std::string::size call 2023-03-03 09:56:21 +00:00
py-event-types.def
py-event.c
py-event.h
py-events.h
py-evtregistry.c
py-evts.c
py-exitedevent.c
py-finishbreakpoint.c gdb: fix mi breakpoint-deleted notifications for thread-specific b/p 2023-02-28 10:56:28 +00:00
py-frame.c gdb/python: remove unneeded nullptr check in frapy_block 2023-03-30 10:25:46 +01:00
py-framefilter.c Turn value_type into method 2023-02-13 15:21:06 -07:00
py-function.c
py-gdb-readline.c Python QUIT processing updates 2023-02-27 16:20:39 -07:00
py-inferior.c Turn remaining value_contents functions into methods 2023-02-13 15:22:16 -07:00
py-infevents.c
py-infthread.c
py-instruction.c
py-instruction.h
py-lazy-string.c Fix value chain use-after-free 2023-02-27 15:46:31 -07:00
py-linetable.c Constify linetables 2023-03-11 08:48:10 -07:00
py-membuf.c
py-micmd.c gdb, gdbserver, gdbsupport: fix whitespace issues 2023-03-09 16:32:00 -05:00
py-newobjfileevent.c
py-objfile.c
py-param.c
py-prettyprint.c Fix value chain use-after-free 2023-02-27 15:46:31 -07:00
py-progspace.c
py-record-btrace.c
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
py-stopevent.c
py-stopevent.h
py-symbol.c Python QUIT processing updates 2023-02-27 16:20:39 -07:00
py-symtab.c
py-threadevent.c gdb: make find_thread_ptid an inferior method 2023-04-04 21:05:30 -04:00
py-tui.c gdb/python: Fix --disable-tui build 2023-03-06 17:31:57 +01:00
py-type.c Fix value chain use-after-free 2023-02-27 15:46:31 -07:00
py-unwind.c gdb/python: have UnwindInfo.add_saved_register accept named args 2023-04-06 14:57:32 +01:00
py-utils.c Python QUIT processing updates 2023-02-27 16:20:39 -07:00
py-value.c Python QUIT processing updates 2023-02-27 16:20:39 -07:00
py-varobj.c
py-xmethods.c Fix value chain use-after-free 2023-02-27 15:46:31 -07:00
python-config.py
python-internal.h gdb: fix mi breakpoint-deleted notifications for thread-specific b/p 2023-02-28 10:56:28 +00:00
python.c gdb, gdbserver, gdbsupport: fix whitespace issues 2023-03-09 16:32:00 -05:00
python.h