projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Split TRY_CATCH into TRY + CATCH
[deliverable/binutils-gdb.git]
/
gdb
/
python
/
py-value.c
diff --git
a/gdb/python/py-value.c
b/gdb/python/py-value.c
index 5a1377756a1080736700298354730e982cc1da15..6622d11e8dc877f29d17d253f45545f12ea50814 100644
(file)
--- a/
gdb/python/py-value.c
+++ b/
gdb/python/py-value.c
@@
-172,10
+172,9
@@
gdbpy_preserve_values (const struct extension_language_defn *extlang,
static PyObject *
valpy_dereference (PyObject *self, PyObject *args)
{
static PyObject *
valpy_dereference (PyObject *self, PyObject *args)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
PyObject *result = NULL;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *res_val;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
{
struct value *res_val;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@
-184,7
+183,11
@@
valpy_dereference (PyObject *self, PyObject *args)
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
return result;
}
@@
-200,10
+203,9
@@
valpy_dereference (PyObject *self, PyObject *args)
static PyObject *
valpy_referenced_value (PyObject *self, PyObject *args)
{
static PyObject *
valpy_referenced_value (PyObject *self, PyObject *args)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
PyObject *result = NULL;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *self_val, *res_val;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
{
struct value *self_val, *res_val;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@
-225,7
+227,11
@@
valpy_referenced_value (PyObject *self, PyObject *args)
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
return result;
}
@@
-235,11
+241,10
@@
static PyObject *
valpy_get_address (PyObject *self, void *closure)
{
value_object *val_obj = (value_object *) self;
valpy_get_address (PyObject *self, void *closure)
{
value_object *val_obj = (value_object *) self;
- volatile struct gdb_exception except;
if (!val_obj->address)
{
if (!val_obj->address)
{
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *res_val;
struct cleanup *cleanup
{
struct value *res_val;
struct cleanup *cleanup
@@
-249,11
+254,12
@@
valpy_get_address (PyObject *self, void *closure)
val_obj->address = value_to_value_object (res_val);
do_cleanups (cleanup);
}
val_obj->address = value_to_value_object (res_val);
do_cleanups (cleanup);
}
-
if (except.reason < 0
)
+
CATCH (except, RETURN_MASK_ALL
)
{
val_obj->address = Py_None;
Py_INCREF (Py_None);
}
{
val_obj->address = Py_None;
Py_INCREF (Py_None);
}
+ END_CATCH
}
Py_XINCREF (val_obj->address);
}
Py_XINCREF (val_obj->address);
@@
-283,7
+289,6
@@
static PyObject *
valpy_get_dynamic_type (PyObject *self, void *closure)
{
value_object *obj = (value_object *) self;
valpy_get_dynamic_type (PyObject *self, void *closure)
{
value_object *obj = (value_object *) self;
- volatile struct gdb_exception except;
struct type *type = NULL;
if (obj->dynamic_type != NULL)
struct type *type = NULL;
if (obj->dynamic_type != NULL)
@@
-292,7
+297,7
@@
valpy_get_dynamic_type (PyObject *self, void *closure)
return obj->dynamic_type;
}
return obj->dynamic_type;
}
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *val = obj->value;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
{
struct value *val = obj->value;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@
-331,7
+336,11
@@
valpy_get_dynamic_type (PyObject *self, void *closure)
do_cleanups (cleanup);
}
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (type == NULL)
obj->dynamic_type = valpy_get_type (self, NULL);
if (type == NULL)
obj->dynamic_type = valpy_get_type (self, NULL);
@@
-358,13
+367,12
@@
valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
const char *user_encoding = NULL;
static char *keywords[] = { "encoding", "length", NULL };
PyObject *str_obj = NULL;
const char *user_encoding = NULL;
static char *keywords[] = { "encoding", "length", NULL };
PyObject *str_obj = NULL;
- volatile struct gdb_exception except;
if (!PyArg_ParseTupleAndKeywords (args, kw, "|s" GDB_PY_LL_ARG, keywords,
&user_encoding, &length))
return NULL;
if (!PyArg_ParseTupleAndKeywords (args, kw, "|s" GDB_PY_LL_ARG, keywords,
&user_encoding, &length))
return NULL;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@
-377,7
+385,11
@@
valpy_lazy_string (PyObject *self, PyObject *args, PyObject *kw)
do_cleanups (cleanup);
}
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return str_obj;
}
return str_obj;
}
@@
-394,7
+406,6
@@
valpy_string (PyObject *self, PyObject *args, PyObject *kw)
int length = -1;
gdb_byte *buffer;
struct value *value = ((value_object *) self)->value;
int length = -1;
gdb_byte *buffer;
struct value *value = ((value_object *) self)->value;
- volatile struct gdb_exception except;
PyObject *unicode;
const char *encoding = NULL;
const char *errors = NULL;
PyObject *unicode;
const char *encoding = NULL;
const char *errors = NULL;
@@
-407,11
+418,15
@@
valpy_string (PyObject *self, PyObject *args, PyObject *kw)
&user_encoding, &errors, &length))
return NULL;
&user_encoding, &errors, &length))
return NULL;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
}
{
LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
unicode = PyUnicode_Decode ((const char *) buffer,
encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding;
unicode = PyUnicode_Decode ((const char *) buffer,
@@
-429,7
+444,6
@@
valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
{
PyObject *type_obj, *result = NULL;
struct type *type;
{
PyObject *type_obj, *result = NULL;
struct type *type;
- volatile struct gdb_exception except;
if (! PyArg_ParseTuple (args, "O", &type_obj))
return NULL;
if (! PyArg_ParseTuple (args, "O", &type_obj))
return NULL;
@@
-442,7
+456,7
@@
valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
return NULL;
}
return NULL;
}
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *val = ((value_object *) self)->value;
struct value *res_val;
{
struct value *val = ((value_object *) self)->value;
struct value *res_val;
@@
-461,7
+475,11
@@
valpy_do_cast (PyObject *self, PyObject *args, enum exp_opcode op)
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
return result;
}
@@
-508,7
+526,6
@@
value_has_field (struct value *v, PyObject *field)
struct type *parent_type, *val_type;
enum type_code type_code;
PyObject *type_object = PyObject_GetAttrString (field, "parent_type");
struct type *parent_type, *val_type;
enum type_code type_code;
PyObject *type_object = PyObject_GetAttrString (field, "parent_type");
- volatile struct gdb_exception except;
int has_field = 0;
if (type_object == NULL)
int has_field = 0;
if (type_object == NULL)
@@
-524,7
+541,7
@@
value_has_field (struct value *v, PyObject *field)
return -1;
}
return -1;
}
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
val_type = value_type (v);
val_type = check_typedef (val_type);
{
val_type = value_type (v);
val_type = check_typedef (val_type);
@@
-539,7
+556,11
@@
value_has_field (struct value *v, PyObject *field)
else
has_field = 0;
}
else
has_field = 0;
}
- GDB_PY_SET_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_SET_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return has_field;
}
return has_field;
}
@@
-591,11
+612,11
@@
get_field_type (PyObject *field)
static PyObject *
valpy_getitem (PyObject *self, PyObject *key)
{
static PyObject *
valpy_getitem (PyObject *self, PyObject *key)
{
+ struct gdb_exception except = exception_none;
value_object *self_value = (value_object *) self;
char *field = NULL;
struct type *base_class_type = NULL, *field_type = NULL;
long bitpos = -1;
value_object *self_value = (value_object *) self;
char *field = NULL;
struct type *base_class_type = NULL, *field_type = NULL;
long bitpos = -1;
- volatile struct gdb_exception except;
PyObject *result = NULL;
if (gdbpy_is_string (key))
PyObject *result = NULL;
if (gdbpy_is_string (key))
@@
-673,7
+694,7
@@
valpy_getitem (PyObject *self, PyObject *key)
}
}
}
}
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *tmp = self_value->value;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
{
struct value *tmp = self_value->value;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@
-723,6
+744,11
@@
valpy_getitem (PyObject *self, PyObject *key)
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
result = value_to_value_object (res_val);
do_cleanups (cleanup);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
xfree (field);
GDB_PY_HANDLE_EXCEPTION (except);
xfree (field);
GDB_PY_HANDLE_EXCEPTION (except);
@@
-744,18
+770,21
@@
static PyObject *
valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
{
Py_ssize_t args_count;
valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
{
Py_ssize_t args_count;
- volatile struct gdb_exception except;
struct value *function = ((value_object *) self)->value;
struct value **vargs = NULL;
struct type *ftype = NULL;
struct value *mark = value_mark ();
PyObject *result = NULL;
struct value *function = ((value_object *) self)->value;
struct value **vargs = NULL;
struct type *ftype = NULL;
struct value *mark = value_mark ();
PyObject *result = NULL;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
ftype = check_typedef (value_type (function));
}
{
ftype = check_typedef (value_type (function));
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (TYPE_CODE (ftype) != TYPE_CODE_FUNC)
{
if (TYPE_CODE (ftype) != TYPE_CODE_FUNC)
{
@@
-790,7
+819,7
@@
valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
}
}
}
}
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
struct value *return_value;
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
struct value *return_value;
@@
-799,7
+828,11
@@
valpy_call (PyObject *self, PyObject *args, PyObject *keywords)
result = value_to_value_object (return_value);
do_cleanups (cleanup);
}
result = value_to_value_object (return_value);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
return result;
}
@@
-812,12
+845,11
@@
valpy_str (PyObject *self)
char *s = NULL;
PyObject *result;
struct value_print_options opts;
char *s = NULL;
PyObject *result;
struct value_print_options opts;
- volatile struct gdb_exception except;
get_user_print_options (&opts);
opts.deref_ref = 0;
get_user_print_options (&opts);
opts.deref_ref = 0;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct ui_file *stb = mem_fileopen ();
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
{
struct ui_file *stb = mem_fileopen ();
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@
-828,7
+860,11
@@
valpy_str (PyObject *self)
do_cleanups (old_chain);
}
do_cleanups (old_chain);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
xfree (s);
result = PyUnicode_Decode (s, strlen (s), host_charset (), NULL);
xfree (s);
@@
-842,13
+878,16
@@
valpy_get_is_optimized_out (PyObject *self, void *closure)
{
struct value *value = ((value_object *) self)->value;
int opt = 0;
{
struct value *value = ((value_object *) self)->value;
int opt = 0;
- volatile struct gdb_exception except;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
opt = value_optimized_out (value);
}
{
opt = value_optimized_out (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (opt)
Py_RETURN_TRUE;
if (opt)
Py_RETURN_TRUE;
@@
-862,13
+901,16
@@
valpy_get_is_lazy (PyObject *self, void *closure)
{
struct value *value = ((value_object *) self)->value;
int opt = 0;
{
struct value *value = ((value_object *) self)->value;
int opt = 0;
- volatile struct gdb_exception except;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
opt = value_lazy (value);
}
{
opt = value_lazy (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (opt)
Py_RETURN_TRUE;
if (opt)
Py_RETURN_TRUE;
@@
-881,14
+923,17
@@
static PyObject *
valpy_fetch_lazy (PyObject *self, PyObject *args)
{
struct value *value = ((value_object *) self)->value;
valpy_fetch_lazy (PyObject *self, PyObject *args)
{
struct value *value = ((value_object *) self)->value;
- volatile struct gdb_exception except;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (value_lazy (value))
value_fetch_lazy (value);
}
{
if (value_lazy (value))
value_fetch_lazy (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
Py_RETURN_NONE;
}
Py_RETURN_NONE;
}
@@
-926,10
+971,9
@@
enum valpy_opcode
static PyObject *
valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
{
static PyObject *
valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
PyObject *result = NULL;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *arg1, *arg2;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
{
struct value *arg1, *arg2;
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@
-1049,7
+1093,11
@@
valpy_binop (enum valpy_opcode opcode, PyObject *self, PyObject *other)
do_cleanups (cleanup);
}
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
return result;
}
@@
-1103,10
+1151,9
@@
valpy_power (PyObject *self, PyObject *other, PyObject *unused)
static PyObject *
valpy_negative (PyObject *self)
{
static PyObject *
valpy_negative (PyObject *self)
{
- volatile struct gdb_exception except;
PyObject *result = NULL;
PyObject *result = NULL;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Perhaps overkill, but consistency has some virtue. */
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
{
/* Perhaps overkill, but consistency has some virtue. */
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@
-1116,7
+1163,11
@@
valpy_negative (PyObject *self)
result = value_to_value_object (val);
do_cleanups (cleanup);
}
result = value_to_value_object (val);
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return result;
}
return result;
}
@@
-1131,10
+1182,9
@@
static PyObject *
valpy_absolute (PyObject *self)
{
struct value *value = ((value_object *) self)->value;
valpy_absolute (PyObject *self)
{
struct value *value = ((value_object *) self)->value;
- volatile struct gdb_exception except;
int isabs = 1;
int isabs = 1;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
@@
-1143,7
+1193,11
@@
valpy_absolute (PyObject *self)
do_cleanups (cleanup);
}
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
if (isabs)
return valpy_positive (self);
if (isabs)
return valpy_positive (self);
@@
-1155,12
+1209,12
@@
valpy_absolute (PyObject *self)
static int
valpy_nonzero (PyObject *self)
{
static int
valpy_nonzero (PyObject *self)
{
-
volatile struct gdb_exception except
;
+
struct gdb_exception except = exception_none
;
value_object *self_value = (value_object *) self;
struct type *type;
int nonzero = 0; /* Appease GCC warning. */
value_object *self_value = (value_object *) self;
struct type *type;
int nonzero = 0; /* Appease GCC warning. */
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (value_type (self_value->value));
{
type = check_typedef (value_type (self_value->value));
@@
-1176,6
+1230,12
@@
valpy_nonzero (PyObject *self)
/* All other values are True. */
nonzero = 1;
}
/* All other values are True. */
nonzero = 1;
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
/* This is not documented in the Python documentation, but if this
function fails, return -1 as slot_nb_nonzero does (the default
Python nonzero function). */
/* This is not documented in the Python documentation, but if this
function fails, return -1 as slot_nb_nonzero does (the default
Python nonzero function). */
@@
-1189,13
+1249,16
@@
static PyObject *
valpy_invert (PyObject *self)
{
struct value *val = NULL;
valpy_invert (PyObject *self)
{
struct value *val = NULL;
- volatile struct gdb_exception except;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
val = value_complement (((value_object *) self)->value);
}
{
val = value_complement (((value_object *) self)->value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (val);
}
return value_to_value_object (val);
}
@@
-1241,7
+1304,6
@@
static PyObject *
valpy_richcompare (PyObject *self, PyObject *other, int op)
{
int result = 0;
valpy_richcompare (PyObject *self, PyObject *other, int op)
{
int result = 0;
- volatile struct gdb_exception except;
if (other == Py_None)
/* Comparing with None is special. From what I can tell, in Python
if (other == Py_None)
/* Comparing with None is special. From what I can tell, in Python
@@
-1262,7
+1324,7
@@
valpy_richcompare (PyObject *self, PyObject *other, int op)
return NULL;
}
return NULL;
}
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *value_other, *mark = value_mark ();
struct cleanup *cleanup;
{
struct value *value_other, *mark = value_mark ();
struct cleanup *cleanup;
@@
-1307,7
+1369,11
@@
valpy_richcompare (PyObject *self, PyObject *other, int op)
do_cleanups (cleanup);
}
do_cleanups (cleanup);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
/* In this case, the Python exception has already been set. */
if (result < 0)
/* In this case, the Python exception has already been set. */
if (result < 0)
@@
-1327,16
+1393,19
@@
valpy_int (PyObject *self)
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
LONGEST l = 0;
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
LONGEST l = 0;
- volatile struct gdb_exception except;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (!is_integral_type (type))
error (_("Cannot convert value to int."));
l = value_as_long (value);
}
{
if (!is_integral_type (type))
error (_("Cannot convert value to int."));
l = value_as_long (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return gdb_py_object_from_longest (l);
}
return gdb_py_object_from_longest (l);
}
@@
-1349,9
+1418,8
@@
valpy_long (PyObject *self)
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
LONGEST l = 0;
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
LONGEST l = 0;
- volatile struct gdb_exception except;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
{
CHECK_TYPEDEF (type);
@@
-1361,7
+1429,11
@@
valpy_long (PyObject *self)
l = value_as_long (value);
}
l = value_as_long (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return gdb_py_long_from_longest (l);
}
return gdb_py_long_from_longest (l);
}
@@
-1373,9
+1445,8
@@
valpy_float (PyObject *self)
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
double d = 0;
struct value *value = ((value_object *) self)->value;
struct type *type = value_type (value);
double d = 0;
- volatile struct gdb_exception except;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
{
CHECK_TYPEDEF (type);
@@
-1384,7
+1455,11
@@
valpy_float (PyObject *self)
d = value_as_double (value);
}
d = value_as_double (value);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return PyFloat_FromDouble (d);
}
return PyFloat_FromDouble (d);
}
@@
-1431,12
+1506,11
@@
struct value *
convert_value_from_python (PyObject *obj)
{
struct value *value = NULL; /* -Wall */
convert_value_from_python (PyObject *obj)
{
struct value *value = NULL; /* -Wall */
- volatile struct gdb_exception except;
int cmp;
gdb_assert (obj != NULL);
int cmp;
gdb_assert (obj != NULL);
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (PyBool_Check (obj))
{
{
if (PyBool_Check (obj))
{
@@
-1532,13
+1606,14
@@
convert_value_from_python (PyObject *obj)
PyString_AsString (PyObject_Str (obj)));
#endif
}
PyString_AsString (PyObject_Str (obj)));
#endif
}
-
if (except.reason < 0
)
+
CATCH (except, RETURN_MASK_ALL
)
{
PyErr_Format (except.reason == RETURN_QUIT
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
"%s", except.message);
return NULL;
}
{
PyErr_Format (except.reason == RETURN_QUIT
? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
"%s", except.message);
return NULL;
}
+ END_CATCH
return value;
}
return value;
}
@@
-1549,16
+1624,19
@@
gdbpy_history (PyObject *self, PyObject *args)
{
int i;
struct value *res_val = NULL; /* Initialize to appease gcc warning. */
{
int i;
struct value *res_val = NULL; /* Initialize to appease gcc warning. */
- volatile struct gdb_exception except;
if (!PyArg_ParseTuple (args, "i", &i))
return NULL;
if (!PyArg_ParseTuple (args, "i", &i))
return NULL;
- TRY
_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = access_value_history (i);
}
{
res_val = access_value_history (i);
}
- GDB_PY_HANDLE_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
return value_to_value_object (res_val);
}
return value_to_value_object (res_val);
}
This page took
0.031486 seconds
and
4
git commands to generate.