projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use a wrapper for PyErr_Fetch
[deliverable/binutils-gdb.git]
/
gdb
/
python
/
py-value.c
diff --git
a/gdb/python/py-value.c
b/gdb/python/py-value.c
index 9abcf9212e6580337cef235fe9242e51940479ee..9cc56e6cd1d1494a83b91cdcb9831cf14d8d271f 100644
(file)
--- a/
gdb/python/py-value.c
+++ b/
gdb/python/py-value.c
@@
-1,6
+1,6
@@
/* Python interface to values.
/* Python interface to values.
- Copyright (C) 2008-201
8
Free Software Foundation, Inc.
+ Copyright (C) 2008-201
9
Free Software Foundation, Inc.
This file is part of GDB.
This file is part of GDB.
@@
-917,10
+917,10
@@
valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
TRY
{
scoped_value_mark free_values;
TRY
{
scoped_value_mark free_values;
- struct value *return_value;
- return_value = call_function_by_hand (function, NULL,
- args_count, vargs);
+ value *return_value
+ = call_function_by_hand (function, NULL,
+ gdb::make_array_view (vargs, args_count));
result = value_to_value_object (return_value);
}
CATCH (except, RETURN_MASK_ALL)
result = value_to_value_object (return_value);
}
CATCH (except, RETURN_MASK_ALL)
@@
-1503,7
+1503,8
@@
valpy_int (PyObject *self)
value = value_cast (type, value);
}
value = value_cast (type, value);
}
- if (!is_integral_type (type))
+ if (!is_integral_type (type)
+ && TYPE_CODE (type) != TYPE_CODE_PTR)
error (_("Cannot convert value to int."));
l = value_as_long (value);
error (_("Cannot convert value to int."));
l = value_as_long (value);
@@
-1514,7
+1515,10
@@
valpy_int (PyObject *self)
}
END_CATCH
}
END_CATCH
- return gdb_py_object_from_longest (l);
+ if (TYPE_UNSIGNED (type))
+ return gdb_py_object_from_ulongest (l).release ();
+ else
+ return gdb_py_object_from_longest (l).release ();
}
#endif
}
#endif
@@
-1657,9
+1661,7
@@
convert_value_from_python (PyObject *obj)
ULONGEST instead. */
if (PyErr_ExceptionMatches (PyExc_OverflowError))
{
ULONGEST instead. */
if (PyErr_ExceptionMatches (PyExc_OverflowError))
{
- PyObject *etype, *evalue, *etraceback;
-
- PyErr_Fetch (&etype, &evalue, &etraceback);
+ gdbpy_err_fetch fetched_error;
gdbpy_ref<> zero (PyInt_FromLong (0));
/* Check whether obj is positive. */
gdbpy_ref<> zero (PyInt_FromLong (0));
/* Check whether obj is positive. */
@@
-1672,8
+1674,10
@@
convert_value_from_python (PyObject *obj)
value = value_from_ulongest (builtin_type_upylong, ul);
}
else
value = value_from_ulongest (builtin_type_upylong, ul);
}
else
- /* There's nothing we can do. */
- PyErr_Restore (etype, evalue, etraceback);
+ {
+ /* There's nothing we can do. */
+ fetched_error.restore ();
+ }
}
}
else
}
}
else
@@
-1728,9
+1732,7
@@
convert_value_from_python (PyObject *obj)
}
CATCH (except, RETURN_MASK_ALL)
{
}
CATCH (except, RETURN_MASK_ALL)
{
- PyErr_Format (except.reason == RETURN_QUIT
- ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
- "%s", except.message);
+ gdbpy_convert_exception (except);
return NULL;
}
END_CATCH
return NULL;
}
END_CATCH
This page took
0.025254 seconds
and
4
git commands to generate.