From c0c6f77785d5f523f929919b66cf90bcd273a9fe Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Sun, 29 Mar 2009 21:11:11 +0000 Subject: gdb/ Change gdb.Value.address from a method to an attribute. * python/python-value.c (value_object): Add `address' element. (valpy_dealloc): Decrement reference to self->address if set. (valpy_new): Initialize val_obj->address. (valpy_address): Rename to ... (valpy_get_address): ... this. Change signature from method to attribute. Update self->address if not set. (value_to_value_object): Initialize val_obj->address. (value_object_getset): Add `address' element. (value_object_methods): Remove `address' element. gdb/testsuite/ * gdb.python/python-value.exp: Add tests for the address attribute. gdb/doc/ * gdb.texinfo (Values From Inferior): Change gdb.Value.address from a method to an attribute. --- gdb/testsuite/gdb.python/python-value.exp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/testsuite/gdb.python') diff --git a/gdb/testsuite/gdb.python/python-value.exp b/gdb/testsuite/gdb.python/python-value.exp index 2d1ece6..b3b5746 100644 --- a/gdb/testsuite/gdb.python/python-value.exp +++ b/gdb/testsuite/gdb.python/python-value.exp @@ -70,6 +70,9 @@ proc test_value_creation {} { gdb_py_test_silent_cmd "python a = gdb.Value (u'unicode test')" "create unicode value" 1 gdb_test "python print a" "\"unicode test\"" "print Unicode string" gdb_test "python print a.__class__" "" "verify type of unicode string" + + # Test address attribute is None in a non-addressable value + gdb_test "python print 'result =', i.address" "= None" "Test address attribute in non-addressable value" } proc test_value_numeric_ops {} { @@ -228,6 +231,9 @@ proc test_value_in_inferior {} { # Smoke-test is_optimized_out attribute gdb_test "python print 'result =', arg0.is_optimized_out" "= False" "Test is_optimized_out attribute" + + # Test address attribute + gdb_test "python print 'result =', arg0.address" "= 0x\[\[:xdigit:\]\]+" "Test address attribute" } -- cgit v1.1