Fix crash in gdbpy_parse_register_id
authorTom Tromey <tom@tromey.com>
Wed, 27 Apr 2022 21:22:56 +0000 (15:22 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 21 Aug 2022 14:03:42 +0000 (08:03 -0600)
commitbdc8cfc1e43ebc4029cf130c678b9e1a4e4e5682
tree8bfc24e3261a01621b4c01020a35db142213c9de
parent12f26cb22e56ab8c26dd5a00f32158af561da4cb
Fix crash in gdbpy_parse_register_id

I noticed that gdbpy_parse_register_id would assert if passed a Python
object of a type it was not expecting.  The included test case shows
this crash.  This patch fixes the problem and also changes
gdbpy_parse_register_id to be more "Python-like" -- it always ensures
the Python error is set when it fails, and the callers now simply
propagate the existing exception.
gdb/python/py-frame.c
gdb/python/py-registers.c
gdb/python/py-unwind.c
gdb/python/python-internal.h
gdb/testsuite/gdb.python/py-frame.exp
gdb/testsuite/gdb.python/py-unwind.exp
gdb/testsuite/gdb.python/py-unwind.py