mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-19 01:19:41 +08:00
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.
This commit is contained in:
@@ -253,10 +253,7 @@ frapy_read_register (PyObject *self, PyObject *args)
|
||||
|
||||
if (!gdbpy_parse_register_id (get_frame_arch (frame), pyo_reg_id,
|
||||
®num))
|
||||
{
|
||||
PyErr_SetString (PyExc_ValueError, "Bad register");
|
||||
return NULL;
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
gdb_assert (regnum >= 0);
|
||||
val = value_of_register (regnum, frame);
|
||||
|
||||
Reference in New Issue
Block a user