1 /* GDB variable objects API.
2 Copyright (C) 1999-2013 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
24 /* Enumeration for the format types */
25 enum varobj_display_formats
27 FORMAT_NATURAL
, /* What gdb actually calls 'natural' */
28 FORMAT_BINARY
, /* Binary display */
29 FORMAT_DECIMAL
, /* Decimal display */
30 FORMAT_HEXADECIMAL
, /* Hex display */
31 FORMAT_OCTAL
/* Octal display */
36 USE_SPECIFIED_FRAME
, /* Use the frame passed to varobj_create. */
37 USE_CURRENT_FRAME
, /* Use the current frame. */
38 USE_SELECTED_FRAME
/* Always reevaluate in selected frame. */
41 /* Enumerator describing if a variable object is in scope. */
42 enum varobj_scope_status
44 VAROBJ_IN_SCOPE
= 0, /* Varobj is scope, value available. */
45 VAROBJ_NOT_IN_SCOPE
= 1, /* Varobj is not in scope, value not
46 available, but varobj can become in
48 VAROBJ_INVALID
= 2, /* Varobj no longer has any value, and never
52 /* String representations of gdb's format codes (defined in varobj.c). */
53 extern char *varobj_format_string
[];
55 /* Languages supported by this variable objects system. This enum is used
56 to index arrays so we make its first enum explicitly zero. */
59 vlang_c
= 0, vlang_cplus
, vlang_java
, vlang_ada
, vlang_end
62 /* String representations of gdb's known languages (defined in varobj.c). */
63 extern char *varobj_language_string
[];
65 /* Struct thar describes a variable object instance. */
69 typedef struct varobj
*varobj_p
;
72 typedef struct varobj_update_result_t
74 struct varobj
*varobj
;
78 enum varobj_scope_status status
;
79 /* This variable is used internally by varobj_update to indicate if the
80 new value of varobj is already computed and installed, or has to
81 be yet installed. Don't use this outside varobj.c. */
84 /* This will be non-NULL when new children were added to the varobj.
85 It lists the new children (which must necessarily come at the end
86 of the child list) added during an update. The caller is
87 responsible for freeing this vector. */
89 } varobj_update_result
;
91 DEF_VEC_O (varobj_update_result
);
94 struct varobj_dynamic
;
96 /* Every variable in the system has a structure of this type defined
97 for it. This structure holds all information necessary to manipulate
98 a particular object variable. Members which must be freed are noted. */
101 /* Alloc'd name of the variable for this object. If this variable is a
102 child, then this name will be the child's source name.
103 (bar, not foo.bar). */
104 /* NOTE: This is the "expression". */
107 /* Alloc'd expression for this child. Can be used to create a
108 root variable corresponding to this child. */
111 /* The alloc'd name for this variable's object. This is here for
112 convenience when constructing this object's children. */
115 /* Index of this variable in its parent or -1. */
118 /* The type of this variable. This can be NULL
119 for artifial variable objects -- currently, the "accessibility"
120 variable objects in C++. */
123 /* The value of this expression or subexpression. A NULL value
124 indicates there was an error getting this value.
125 Invariant: if varobj_value_is_changeable_p (this) is non-zero,
126 the value is either NULL, or not lazy. */
129 /* The number of (immediate) children this variable has. */
132 /* If this object is a child, this points to its immediate parent. */
133 struct varobj
*parent
;
135 /* Children of this object. */
136 VEC (varobj_p
) *children
;
138 /* Description of the root variable. Points to root variable for
140 struct varobj_root
*root
;
142 /* The format of the output for this object. */
143 enum varobj_display_formats format
;
145 /* Was this variable updated via a varobj_set_value operation. */
148 /* Last print value. */
151 /* Is this variable frozen. Frozen variables are never implicitly
152 updated by -var-update *
153 or -var-update <direct-or-indirect-parent>. */
156 /* Is the value of this variable intentionally not fetched? It is
157 not fetched if either the variable is frozen, or any parents is
161 /* Sub-range of children which the MI consumer has requested. If
162 FROM < 0 or TO < 0, means that all children have been
167 /* Dynamic part of varobj. */
168 struct varobj_dynamic
*dynamic
;
173 extern struct varobj
*varobj_create (char *objname
,
174 char *expression
, CORE_ADDR frame
,
175 enum varobj_type type
);
177 extern char *varobj_gen_name (void);
179 extern struct varobj
*varobj_get_handle (char *name
);
181 extern char *varobj_get_objname (struct varobj
*var
);
183 extern char *varobj_get_expression (struct varobj
*var
);
185 extern int varobj_delete (struct varobj
*var
, char ***dellist
,
188 extern enum varobj_display_formats
varobj_set_display_format (
190 enum varobj_display_formats format
);
192 extern enum varobj_display_formats
varobj_get_display_format (
195 extern int varobj_get_thread_id (struct varobj
*var
);
197 extern void varobj_set_frozen (struct varobj
*var
, int frozen
);
199 extern int varobj_get_frozen (struct varobj
*var
);
201 extern void varobj_get_child_range (struct varobj
*var
, int *from
, int *to
);
203 extern void varobj_set_child_range (struct varobj
*var
, int from
, int to
);
205 extern char *varobj_get_display_hint (struct varobj
*var
);
207 extern int varobj_get_num_children (struct varobj
*var
);
209 /* Return the list of children of VAR. The returned vector should not
210 be modified in any way. FROM and TO are in/out parameters
211 indicating the range of children to return. If either *FROM or *TO
212 is less than zero on entry, then all children will be returned. On
213 return, *FROM and *TO will be updated to indicate the real range
214 that was returned. The resulting VEC will contain at least the
215 children from *FROM to just before *TO; it might contain more
216 children, depending on whether any more were available. */
217 extern VEC (varobj_p
)* varobj_list_children (struct varobj
*var
,
220 extern char *varobj_get_type (struct varobj
*var
);
222 extern struct type
*varobj_get_gdb_type (struct varobj
*var
);
224 extern char *varobj_get_path_expr (struct varobj
*var
);
226 extern enum varobj_languages
varobj_get_language (struct varobj
*var
);
228 extern int varobj_get_attributes (struct varobj
*var
);
230 extern char *varobj_get_formatted_value (struct varobj
*var
,
231 enum varobj_display_formats format
);
233 extern char *varobj_get_value (struct varobj
*var
);
235 extern int varobj_set_value (struct varobj
*var
, char *expression
);
237 extern void all_root_varobjs (void (*func
) (struct varobj
*var
, void *data
),
240 extern VEC(varobj_update_result
) *varobj_update (struct varobj
**varp
,
243 extern void varobj_invalidate (void);
245 extern int varobj_editable_p (struct varobj
*var
);
247 extern int varobj_floating_p (struct varobj
*var
);
249 extern void varobj_set_visualizer (struct varobj
*var
,
250 const char *visualizer
);
252 extern void varobj_enable_pretty_printing (void);
254 extern int varobj_has_more (struct varobj
*var
, int to
);
256 extern int varobj_pretty_printed_p (struct varobj
*var
);
258 #endif /* VAROBJ_H */