/* Implementation of the GDB variable objects API.
- Copyright (C) 1999-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2014 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "valprint.h"
#include "gdb_assert.h"
-#include "gdb_string.h"
+#include <string.h>
#include "gdb_regex.h"
#include "varobj.h"
char *varobj_format_string[] =
{ "natural", "binary", "decimal", "hexadecimal", "octal" };
-/* String representations of gdb's known languages. */
-char *varobj_language_string[] = { "C", "C++", "Java" };
-
/* True if we want to allow Python-based pretty-printing. */
static int pretty_printing = 0;
/* Language-specific routines. */
-static enum varobj_languages variable_language (struct varobj *var);
-
static int number_of_children (struct varobj *);
static char *name_of_variable (struct varobj *);
#endif /* HAVE_PYTHON */
-/* Array of known source language routines. */
-static const struct lang_varobj_ops *languages[vlang_end] = {
- &c_varobj_ops,
- &cplus_varobj_ops,
- &java_varobj_ops,
- &ada_varobj_ops,
-};
-
/* Private data */
/* Mappings of varobj_display_formats enums to gdb's format codes. */
char *
varobj_get_type (struct varobj *var)
{
- /* For the "fake" variables, do not return a type. (It's type is
+ /* For the "fake" variables, do not return a type. (Its type is
NULL, too.)
Do not return a type for invalid variables as well. */
if (CPLUS_FAKE_CHILD (var) || !var->root->is_valid)
}
}
-enum varobj_languages
+const struct language_defn *
varobj_get_language (struct varobj *var)
{
- return variable_language (var);
+ return var->root->exp->language_defn;
}
int
/* Common entry points */
-/* Get the language of variable VAR. */
-static enum varobj_languages
-variable_language (struct varobj *var)
-{
- enum varobj_languages lang;
-
- switch (var->root->exp->language_defn->la_language)
- {
- default:
- case language_c:
- lang = vlang_c;
- break;
- case language_cplus:
- lang = vlang_cplus;
- break;
- case language_java:
- lang = vlang_java;
- break;
- case language_ada:
- lang = vlang_ada;
- break;
- }
-
- return lang;
-}
-
/* Return the number of children for a given variable.
The result of this function is defined by the language
implementation. The number of children returned by this function