This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/6] Mention which return values need to be freed in lang_varobj_ops
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>
- Date: Thu, 29 Jan 2015 14:28:32 -0500
- Subject: [PATCH 2/6] Mention which return values need to be freed in lang_varobj_ops
- Authentication-results: sourceware.org; auth=none
- References: <1422559716-5480-1-git-send-email-simon dot marchi at ericsson dot com>
This is the result of a little bit of investigation of the C and Ada
languages, as well as some common sense.
gdb/ChangeLog:
* varobj.h (lang_varobj_ops): Mention which return values need
to be freed.
---
gdb/varobj.h | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/gdb/varobj.h b/gdb/varobj.h
index 796b940..145b963 100644
--- a/gdb/varobj.h
+++ b/gdb/varobj.h
@@ -169,23 +169,28 @@ struct lang_varobj_ops
/* The number of children of PARENT. */
int (*number_of_children) (struct varobj *parent);
- /* The name (expression) of a root varobj. */
+ /* The name (expression) of a root varobj. The returned value must be freed
+ by the caller. */
char *(*name_of_variable) (struct varobj *parent);
- /* The name of the INDEX'th child of PARENT. */
+ /* The name of the INDEX'th child of PARENT. The returned value must be
+ freed by the caller. */
char *(*name_of_child) (struct varobj *parent, int index);
/* Returns the rooted expression of CHILD, which is a variable
- obtain that has some parent. */
+ obtain that has some parent. The returned value must be freed by the
+ caller. */
char *(*path_expr_of_child) (struct varobj *child);
- /* The ``struct value *'' of the INDEX'th child of PARENT. */
+ /* The ``struct value *'' of the INDEX'th child of PARENT. The returned
+ value must be freed by the caller. */
struct value *(*value_of_child) (struct varobj *parent, int index);
/* The type of the INDEX'th child of PARENT. */
struct type *(*type_of_child) (struct varobj *parent, int index);
- /* The current value of VAR. */
+ /* The current value of VAR. The returned value must be freed by the
+ caller. */
char *(*value_of_variable) (struct varobj *var,
enum varobj_display_formats format);
--
2.1.4