GDB (API)
/home/stan/gdb/src/gdb/varobj.h
Go to the documentation of this file.
00001 /* GDB variable objects API.
00002    Copyright (C) 1999-2013 Free Software Foundation, Inc.
00003 
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 3 of the License, or
00007    (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00016 
00017 #ifndef VAROBJ_H
00018 #define VAROBJ_H 1
00019 
00020 #include "symtab.h"
00021 #include "gdbtypes.h"
00022 #include "vec.h"
00023 
00024 /* Enumeration for the format types */
00025 enum varobj_display_formats
00026   {
00027     FORMAT_NATURAL,             /* What gdb actually calls 'natural' */
00028     FORMAT_BINARY,              /* Binary display                    */
00029     FORMAT_DECIMAL,             /* Decimal display                   */
00030     FORMAT_HEXADECIMAL,         /* Hex display                       */
00031     FORMAT_OCTAL                /* Octal display                     */
00032   };
00033 
00034 enum varobj_type
00035   {
00036     USE_SPECIFIED_FRAME,        /* Use the frame passed to varobj_create.  */
00037     USE_CURRENT_FRAME,          /* Use the current frame.  */
00038     USE_SELECTED_FRAME          /* Always reevaluate in selected frame.  */
00039   };
00040 
00041 /* Enumerator describing if a variable object is in scope.  */
00042 enum varobj_scope_status
00043   {
00044     VAROBJ_IN_SCOPE = 0,        /* Varobj is scope, value available.  */
00045     VAROBJ_NOT_IN_SCOPE = 1,    /* Varobj is not in scope, value not
00046                                    available, but varobj can become in
00047                                    scope later.  */
00048     VAROBJ_INVALID = 2,         /* Varobj no longer has any value, and never
00049                                    will.  */
00050   };
00051 
00052 /* String representations of gdb's format codes (defined in varobj.c).  */
00053 extern char *varobj_format_string[];
00054 
00055 /* Languages supported by this variable objects system.  This enum is used
00056    to index arrays so we make its first enum explicitly zero.  */
00057 enum varobj_languages
00058   {
00059     vlang_c = 0, vlang_cplus, vlang_java, vlang_ada, vlang_end
00060   };
00061 
00062 /* String representations of gdb's known languages (defined in varobj.c).  */
00063 extern char *varobj_language_string[];
00064 
00065 /* Struct thar describes a variable object instance.  */
00066 struct varobj;
00067 
00068 typedef struct varobj *varobj_p;
00069 DEF_VEC_P (varobj_p);
00070 
00071 typedef struct varobj_update_result_t
00072 {
00073   struct varobj *varobj;
00074   int type_changed;
00075   int children_changed;
00076   int changed;
00077   enum varobj_scope_status status;
00078   /* This variable is used internally by varobj_update to indicate if the
00079      new value of varobj is already computed and installed, or has to
00080      be yet installed.  Don't use this outside varobj.c.  */
00081   int value_installed;  
00082 
00083   /* This will be non-NULL when new children were added to the varobj.
00084      It lists the new children (which must necessarily come at the end
00085      of the child list) added during an update.  The caller is
00086      responsible for freeing this vector.  */
00087   VEC (varobj_p) *new;
00088 } varobj_update_result;
00089 
00090 DEF_VEC_O (varobj_update_result);
00091 
00092 /* API functions */
00093 
00094 extern struct varobj *varobj_create (char *objname,
00095                                      char *expression, CORE_ADDR frame,
00096                                      enum varobj_type type);
00097 
00098 extern char *varobj_gen_name (void);
00099 
00100 extern struct varobj *varobj_get_handle (char *name);
00101 
00102 extern char *varobj_get_objname (struct varobj *var);
00103 
00104 extern char *varobj_get_expression (struct varobj *var);
00105 
00106 extern int varobj_delete (struct varobj *var, char ***dellist,
00107                           int only_children);
00108 
00109 extern enum varobj_display_formats varobj_set_display_format (
00110                                                          struct varobj *var,
00111                                         enum varobj_display_formats format);
00112 
00113 extern enum varobj_display_formats varobj_get_display_format (
00114                                                         struct varobj *var);
00115 
00116 extern int varobj_get_thread_id (struct varobj *var);
00117 
00118 extern void varobj_set_frozen (struct varobj *var, int frozen);
00119 
00120 extern int varobj_get_frozen (struct varobj *var);
00121 
00122 extern void varobj_get_child_range (struct varobj *var, int *from, int *to);
00123 
00124 extern void varobj_set_child_range (struct varobj *var, int from, int to);
00125 
00126 extern char *varobj_get_display_hint (struct varobj *var);
00127 
00128 extern int varobj_get_num_children (struct varobj *var);
00129 
00130 /* Return the list of children of VAR.  The returned vector should not
00131    be modified in any way.  FROM and TO are in/out parameters
00132    indicating the range of children to return.  If either *FROM or *TO
00133    is less than zero on entry, then all children will be returned.  On
00134    return, *FROM and *TO will be updated to indicate the real range
00135    that was returned.  The resulting VEC will contain at least the
00136    children from *FROM to just before *TO; it might contain more
00137    children, depending on whether any more were available.  */
00138 extern VEC (varobj_p)* varobj_list_children (struct varobj *var,
00139                                              int *from, int *to);
00140 
00141 extern char *varobj_get_type (struct varobj *var);
00142 
00143 extern struct type *varobj_get_gdb_type (struct varobj *var);
00144 
00145 extern char *varobj_get_path_expr (struct varobj *var);
00146 
00147 extern enum varobj_languages varobj_get_language (struct varobj *var);
00148 
00149 extern int varobj_get_attributes (struct varobj *var);
00150 
00151 extern char *varobj_get_formatted_value (struct varobj *var,
00152                                          enum varobj_display_formats format);
00153 
00154 extern char *varobj_get_value (struct varobj *var);
00155 
00156 extern int varobj_set_value (struct varobj *var, char *expression);
00157 
00158 extern void all_root_varobjs (void (*func) (struct varobj *var, void *data),
00159                               void *data);
00160 
00161 extern VEC(varobj_update_result) *varobj_update (struct varobj **varp, 
00162                                                  int explicit);
00163 
00164 extern void varobj_invalidate (void);
00165 
00166 extern int varobj_editable_p (struct varobj *var);
00167 
00168 extern int varobj_floating_p (struct varobj *var);
00169 
00170 extern void varobj_set_visualizer (struct varobj *var,
00171                                    const char *visualizer);
00172 
00173 extern void varobj_enable_pretty_printing (void);
00174 
00175 extern int varobj_has_more (struct varobj *var, int to);
00176 
00177 extern int varobj_pretty_printed_p (struct varobj *var);
00178 
00179 #endif /* VAROBJ_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines