diff options
author | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2009-03-26 20:58:11 +0000 |
---|---|---|
committer | Thiago Jung Bauermann <bauerman@br.ibm.com> | 2009-03-26 20:58:11 +0000 |
commit | def2b0009c101b13fad1105c2c10424b35b3117b (patch) | |
tree | d363c19a39e4140b846faf3a176384f72b46f58f /gdb/python/python-value.c | |
parent | 442ddf5987d97d3d8fc9c3e64449417d4cec3190 (diff) | |
download | gdb-def2b0009c101b13fad1105c2c10424b35b3117b.zip gdb-def2b0009c101b13fad1105c2c10424b35b3117b.tar.gz gdb-def2b0009c101b13fad1105c2c10424b35b3117b.tar.bz2 |
gdb/
Add gdb.Value.is_optimized_out attribute.
* python/python-value.c (valpy_get_is_optimized_out): New
function.
(value_object_getset): New variable.
(value_object_type): Initialize tp_getset element.
gdb/doc/
* gdb.texinfo (Values From Inferior): Document is_optimized_out
attribute.
gdb/testsuite/
* gdb.python/python-value.exp (test_value_in_inferior): Test
gdb.Value.is_optimized_out attribute.
Diffstat (limited to 'gdb/python/python-value.c')
-rw-r--r-- | gdb/python/python-value.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c index cbc481f..bf07dc4 100644 --- a/gdb/python/python-value.c +++ b/gdb/python/python-value.c @@ -272,6 +272,18 @@ valpy_str (PyObject *self) return result; } +/* Implements gdb.Value.is_optimized_out. */ +static PyObject * +valpy_get_is_optimized_out (PyObject *self, void *closure) +{ + struct value *value = ((value_object *) self)->value; + + if (value_optimized_out (value)) + Py_RETURN_TRUE; + + Py_RETURN_FALSE; +} + enum valpy_opcode { VALPY_ADD, @@ -825,6 +837,13 @@ gdbpy_initialize_values (void) values_in_python = NULL; } +static PyGetSetDef value_object_getset[] = { + { "is_optimized_out", valpy_get_is_optimized_out, NULL, + "Boolean telling whether the value is optimized out (i.e., not available).", + NULL }, + {NULL} /* Sentinel */ +}; + static PyMethodDef value_object_methods[] = { { "address", valpy_address, METH_NOARGS, "Return the address of the value." }, { "dereference", valpy_dereference, METH_NOARGS, "Dereferences the value." }, @@ -897,7 +916,7 @@ PyTypeObject value_object_type = { 0, /* tp_iternext */ value_object_methods, /* tp_methods */ 0, /* tp_members */ - 0, /* tp_getset */ + value_object_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ |