Merge branch 'vendor/GDB'
[dragonfly.git] / contrib / gdb-7 / gdb / varobj.h
1 /* GDB variable objects API.
2    Copyright (C) 1999-2001, 2005, 2007-2012 Free Software Foundation,
3    Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18 #ifndef VAROBJ_H
19 #define VAROBJ_H 1
20
21 #include "symtab.h"
22 #include "gdbtypes.h"
23 #include "vec.h"
24
25 /* Enumeration for the format types */
26 enum varobj_display_formats
27   {
28     FORMAT_NATURAL,             /* What gdb actually calls 'natural' */
29     FORMAT_BINARY,              /* Binary display                    */
30     FORMAT_DECIMAL,             /* Decimal display                   */
31     FORMAT_HEXADECIMAL,         /* Hex display                       */
32     FORMAT_OCTAL                /* Octal display                     */
33   };
34
35 enum varobj_type
36   {
37     USE_SPECIFIED_FRAME,        /* Use the frame passed to varobj_create.  */
38     USE_CURRENT_FRAME,          /* Use the current frame.  */
39     USE_SELECTED_FRAME          /* Always reevaluate in selected frame.  */
40   };
41
42 /* Enumerator describing if a variable object is in scope.  */
43 enum varobj_scope_status
44   {
45     VAROBJ_IN_SCOPE = 0,        /* Varobj is scope, value available.  */
46     VAROBJ_NOT_IN_SCOPE = 1,    /* Varobj is not in scope, value not
47                                    available, but varobj can become in
48                                    scope later.  */
49     VAROBJ_INVALID = 2,         /* Varobj no longer has any value, and never
50                                    will.  */
51   };
52
53 /* String representations of gdb's format codes (defined in varobj.c).  */
54 extern char *varobj_format_string[];
55
56 /* Languages supported by this variable objects system.  */
57 enum varobj_languages
58   {
59     vlang_unknown = 0, vlang_c, vlang_cplus, vlang_java, vlang_ada, vlang_end
60   };
61
62 /* String representations of gdb's known languages (defined in varobj.c).  */
63 extern char *varobj_language_string[];
64
65 /* Struct thar describes a variable object instance.  */
66 struct varobj;
67
68 typedef struct varobj *varobj_p;
69 DEF_VEC_P (varobj_p);
70
71 typedef struct varobj_update_result_t
72 {
73   struct varobj *varobj;
74   int type_changed;
75   int children_changed;
76   int changed;
77   enum varobj_scope_status status;
78   /* This variable is used internally by varobj_update to indicate if the
79      new value of varobj is already computed and installed, or has to
80      be yet installed.  Don't use this outside varobj.c.  */
81   int value_installed;  
82
83   /* This will be non-NULL when new children were added to the varobj.
84      It lists the new children (which must necessarily come at the end
85      of the child list) added during an update.  The caller is
86      responsible for freeing this vector.  */
87   VEC (varobj_p) *new;
88 } varobj_update_result;
89
90 DEF_VEC_O (varobj_update_result);
91
92 /* API functions */
93
94 extern struct varobj *varobj_create (char *objname,
95                                      char *expression, CORE_ADDR frame,
96                                      enum varobj_type type);
97
98 extern char *varobj_gen_name (void);
99
100 extern struct varobj *varobj_get_handle (char *name);
101
102 extern char *varobj_get_objname (struct varobj *var);
103
104 extern char *varobj_get_expression (struct varobj *var);
105
106 extern int varobj_delete (struct varobj *var, char ***dellist,
107                           int only_children);
108
109 extern enum varobj_display_formats varobj_set_display_format (
110                                                          struct varobj *var,
111                                         enum varobj_display_formats format);
112
113 extern enum varobj_display_formats varobj_get_display_format (
114                                                         struct varobj *var);
115
116 extern int varobj_get_thread_id (struct varobj *var);
117
118 extern void varobj_set_frozen (struct varobj *var, int frozen);
119
120 extern int varobj_get_frozen (struct varobj *var);
121
122 extern void varobj_get_child_range (struct varobj *var, int *from, int *to);
123
124 extern void varobj_set_child_range (struct varobj *var, int from, int to);
125
126 extern char *varobj_get_display_hint (struct varobj *var);
127
128 extern int varobj_get_num_children (struct varobj *var);
129
130 /* Return the list of children of VAR.  The returned vector should not
131    be modified in any way.  FROM and TO are in/out parameters
132    indicating the range of children to return.  If either *FROM or *TO
133    is less than zero on entry, then all children will be returned.  On
134    return, *FROM and *TO will be updated to indicate the real range
135    that was returned.  The resulting VEC will contain at least the
136    children from *FROM to just before *TO; it might contain more
137    children, depending on whether any more were available.  */
138 extern VEC (varobj_p)* varobj_list_children (struct varobj *var,
139                                              int *from, int *to);
140
141 extern char *varobj_get_type (struct varobj *var);
142
143 extern struct type *varobj_get_gdb_type (struct varobj *var);
144
145 extern char *varobj_get_path_expr (struct varobj *var);
146
147 extern enum varobj_languages varobj_get_language (struct varobj *var);
148
149 extern int varobj_get_attributes (struct varobj *var);
150
151 extern char *varobj_get_formatted_value (struct varobj *var,
152                                          enum varobj_display_formats format);
153
154 extern char *varobj_get_value (struct varobj *var);
155
156 extern int varobj_set_value (struct varobj *var, char *expression);
157
158 extern void all_root_varobjs (void (*func) (struct varobj *var, void *data),
159                               void *data);
160
161 extern VEC(varobj_update_result) *varobj_update (struct varobj **varp, 
162                                                  int explicit);
163
164 extern void varobj_invalidate (void);
165
166 extern int varobj_editable_p (struct varobj *var);
167
168 extern int varobj_floating_p (struct varobj *var);
169
170 extern void varobj_set_visualizer (struct varobj *var,
171                                    const char *visualizer);
172
173 extern void varobj_enable_pretty_printing (void);
174
175 extern int varobj_has_more (struct varobj *var, int to);
176
177 extern int varobj_pretty_printed_p (struct varobj *var);
178
179 #endif /* VAROBJ_H */