+/* Return a value which is a reference to the value. */
+
+static PyObject *
+valpy_reference_value (PyObject *self, PyObject *args)
+{
+ PyObject *result = NULL;
+
+ TRY
+ {
+ struct value *self_val;
+ struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
+
+ self_val = ((value_object *) self)->value;
+ result = value_to_value_object (value_ref (self_val));
+
+ do_cleanups (cleanup);
+ }
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
+
+ return result;
+}
+
+/* Return a "const" qualified version of the value. */
+
+static PyObject *
+valpy_const_value (PyObject *self, PyObject *args)
+{
+ PyObject *result = NULL;
+
+ TRY
+ {
+ struct value *self_val, *res_val;
+ struct cleanup *cleanup = make_cleanup_value_free_to_mark (value_mark ());
+
+ self_val = ((value_object *) self)->value;
+ res_val = make_cv_value (1, 0, self_val);
+ result = value_to_value_object (res_val);
+
+ do_cleanups (cleanup);
+ }
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ END_CATCH
+
+ return result;
+}
+