[gdb/python] Use gdbpy_err_fetch::{type,value} as getters

Similar to gdbpy_err_fetch::value, add a getter gdbpy_err_fetch::type, and use
both consistently to get gdbpy_err_fetch members m_error_value and
m_error_type.

Tested on aarch64-linux.
This commit is contained in:
Tom de Vries
2024-03-09 16:13:10 +01:00
parent 5cd5266180
commit b1abf8b1b9
2 changed files with 15 additions and 6 deletions

View File

@@ -675,16 +675,24 @@ public:
bool type_matches (PyObject *type) const
{
return PyErr_GivenExceptionMatches (m_error_type.get (), type);
gdbpy_ref<> err_type = this->type ();
return PyErr_GivenExceptionMatches (err_type.get (), type);
}
/* Return a new reference to the exception value object. */
gdbpy_ref<> value ()
gdbpy_ref<> value () const
{
return m_error_value;
}
/* Return a new reference to the exception type object. */
gdbpy_ref<> type () const
{
return m_error_type;
}
private:
gdbpy_ref<> m_error_type, m_error_value, m_error_traceback;