Upgrade GDB from 7.0 and 7.2 on the vendor branch
[dragonfly.git] / contrib / gdb-7 / gdb / varobj.h
1 /* GDB variable objects API.
2    Copyright (C) 1999, 2000, 2001, 2005, 2007, 2008, 2009, 2010
3    Free Software Foundation, 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 available, 
47                                    but varobj can become in scope later.  */
48     VAROBJ_INVALID = 2,         /* Varobj no longer has any value, and never
49                                    will.  */
50   };
51
52 /* String representations of gdb's format codes (defined in varobj.c) */
53 extern char *varobj_format_string[];
54
55 /* Languages supported by this variable objects system. */
56 enum varobj_languages
57   {
58     vlang_unknown = 0, vlang_c, vlang_cplus, vlang_java, vlang_end
59   };
60
61 /* String representations of gdb's known languages (defined in varobj.c) */
62 extern char *varobj_language_string[];
63
64 /* Struct thar describes a variable object instance */
65 struct varobj;
66
67 typedef struct varobj *varobj_p;
68 DEF_VEC_P (varobj_p);
69
70 typedef struct varobj_update_result_t
71 {
72   struct varobj *varobj;
73   int type_changed;
74   int children_changed;
75   int changed;
76   enum varobj_scope_status status;
77   /* This variable is used internally by varobj_update to indicate if the
78      new value of varobj is already computed and installed, or has to
79      be yet installed.  Don't use this outside varobj.c */
80   int value_installed;  
81
82   /* This will be non-NULL when new children were added to the varobj.
83      It lists the new children (which must necessarily come at the end
84      of the child list) added during an update.  The caller is
85      responsible for freeing this vector.  */
86   VEC (varobj_p) *new;
87 } varobj_update_result;
88
89 DEF_VEC_O (varobj_update_result);
90
91 /* API functions */
92
93 extern struct varobj *varobj_create (char *objname,
94                                      char *expression, CORE_ADDR frame,
95                                      enum varobj_type type);
96
97 extern char *varobj_gen_name (void);
98
99 extern struct varobj *varobj_get_handle (char *name);
100
101 extern char *varobj_get_objname (struct varobj *var);
102
103 extern char *varobj_get_expression (struct varobj *var);
104
105 extern int varobj_delete (struct varobj *var, char ***dellist,
106                           int only_children);
107
108 extern enum varobj_display_formats varobj_set_display_format (
109                                                          struct varobj *var,
110                                         enum varobj_display_formats format);
111
112 extern enum varobj_display_formats varobj_get_display_format (
113                                                         struct varobj *var);
114
115 extern int varobj_get_thread_id (struct varobj *var);
116
117 extern void varobj_set_frozen (struct varobj *var, int frozen);
118
119 extern int varobj_get_frozen (struct varobj *var);
120
121 extern void varobj_get_child_range (struct varobj *var, int *from, int *to);
122
123 extern void varobj_set_child_range (struct varobj *var, int from, int to);
124
125 extern char *varobj_get_display_hint (struct varobj *var);
126
127 extern int varobj_get_num_children (struct varobj *var);
128
129 /* Return the list of children of VAR.  The returned vector should not
130    be modified in any way.  FROM and TO are in/out parameters
131    indicating the range of children to return.  If either *FROM or *TO
132    is less than zero on entry, then all children will be returned.  On
133    return, *FROM and *TO will be updated to indicate the real range
134    that was returned.  The resulting VEC will contain at least the
135    children from *FROM to just before *TO; it might contain more
136    children, depending on whether any more were available.  */
137 extern VEC (varobj_p)* varobj_list_children (struct varobj *var,
138                                              int *from, int *to);
139
140 extern char *varobj_get_type (struct varobj *var);
141
142 extern struct type *varobj_get_gdb_type (struct varobj *var);
143
144 extern char *varobj_get_path_expr (struct varobj *var);
145
146 extern enum varobj_languages varobj_get_language (struct varobj *var);
147
148 extern int varobj_get_attributes (struct varobj *var);
149
150 extern char *varobj_get_formatted_value (struct varobj *var,
151                                          enum varobj_display_formats format);
152
153 extern char *varobj_get_value (struct varobj *var);
154
155 extern int varobj_set_value (struct varobj *var, char *expression);
156
157 extern void all_root_varobjs (void (*func) (struct varobj *var, void *data),
158                               void *data);
159
160 extern VEC(varobj_update_result) *varobj_update (struct varobj **varp, 
161                                                  int explicit);
162
163 extern void varobj_invalidate (void);
164
165 extern int varobj_editable_p (struct varobj *var);
166
167 extern int varobj_floating_p (struct varobj *var);
168
169 extern void 
170 varobj_set_visualizer (struct varobj *var, const char *visualizer);
171
172 extern void varobj_enable_pretty_printing (void);
173
174 extern int varobj_has_more (struct varobj *var, int to);
175
176 extern int varobj_pretty_printed_p (struct varobj *var);
177
178 #endif /* VAROBJ_H */