mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-18 00:37:28 +08:00
[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:
@@ -195,10 +195,11 @@ gdbpy_err_fetch::to_string () const
|
||||
Using str (aka PyObject_Str) will fetch the error message from
|
||||
gdb.GdbError ("message"). */
|
||||
|
||||
if (m_error_value.get () != nullptr && m_error_value.get () != Py_None)
|
||||
return gdbpy_obj_to_string (m_error_value.get ());
|
||||
gdbpy_ref<> value = this->value ();
|
||||
if (value.get () != nullptr && value.get () != Py_None)
|
||||
return gdbpy_obj_to_string (value.get ());
|
||||
else
|
||||
return gdbpy_obj_to_string (m_error_type.get ());
|
||||
return gdbpy_obj_to_string (this->type ().get ());
|
||||
}
|
||||
|
||||
/* See python-internal.h. */
|
||||
@@ -206,7 +207,7 @@ gdbpy_err_fetch::to_string () const
|
||||
gdb::unique_xmalloc_ptr<char>
|
||||
gdbpy_err_fetch::type_to_string () const
|
||||
{
|
||||
return gdbpy_obj_to_string (m_error_type.get ());
|
||||
return gdbpy_obj_to_string (this->type ().get ());
|
||||
}
|
||||
|
||||
/* Convert a GDB exception to the appropriate Python exception.
|
||||
|
||||
Reference in New Issue
Block a user