aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2015-02-09 14:59:05 +0000
committerPedro Alves <palves@redhat.com>2015-02-27 17:19:15 +0000
commit52059ffd6935427d02ee418be3eceeff6fd5c066 (patch)
tree5ea61d24cc0cc0bebe9493ba00afe8877a330955 /gdb/value.c
parentfe978cb071b460b2d4aed2f9a71d895f84efce0e (diff)
downloadgdb-52059ffd6935427d02ee418be3eceeff6fd5c066.zip
gdb-52059ffd6935427d02ee418be3eceeff6fd5c066.tar.gz
gdb-52059ffd6935427d02ee418be3eceeff6fd5c066.tar.bz2
Fix struct, union, and enum nesting in C++
In C, an enum or structure defined inside other structure has global scope just like it had been defined outside the struct in the first place. However, in C++, such a nested structure is given a name that is nested inside the structure. This patch moves such affected structures/enums out to global scope, so that code using them works the same in C++ as it works today in C. gdb/ChangeLog: 2015-02-27 Tom Tromey <tromey@redhat.com> Pedro Alves <palves@redhat.com> * dwarf2-frame.c (enum cfa_how_kind, struct dwarf2_frame_state_reg_info): Move out of struct dwarf2_frame_state. * dwarf2read.c (struct tu_stats): Move out of struct dwarf2_per_objfile. (struct file_entry): Move out of struct line_header. (struct nextfield, struct nextfnfield, struct fnfieldlist, struct typedef_field_list): Move out of struct field_info. * gdbtypes.h (enum dynamic_prop_kind, union dynamic_prop_data): Move out of struct dynamic_prop. (union type_owner, union field_location, struct field, struct range_bounds, union type_specific): Move out of struct main_type. (struct fn_fieldlist, struct fn_field, struct typedef_field) (VOFFSET_STATIC): Move out of struct cplus_struct_type. (struct call_site_target, union call_site_parameter_u, struct call_site_parameter): Move out of struct call_site. * m32c-tdep.c (enum m32c_prologue_kind): Move out of struct m32c_prologue. (enum srcdest_kind): Move out of struct srcdest. * main.c (enum cmdarg_kind): Move out of struct cmdarg. * prologue-value.h (enum prologue_value_kind): Move out of struct prologue_value. * s390-linux-tdep.c (enum s390_abi_kind): Move out of struct gdbarch_tdep. * stabsread.c (struct nextfield, struct next_fnfieldlist): Move out of struct field_info. * symfile.h (struct other_sections): Move out of struct section_addr_info. * symtab.c (struct symbol_cache_slot): Move out struct block_symbol_cache. * target-descriptions.c (enum tdesc_type_kind): Move out of typedef struct tdesc_type. * tui/tui-data.h (enum tui_line_or_address_kind): Move out of struct tui_line_or_address. * value.c (enum internalvar_kind, union internalvar_data): Move out of struct internalvar. * xtensa-tdep.h (struct ctype_cache): Move out of struct gdbarch_tdep.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c121
1 files changed, 62 insertions, 59 deletions
diff --git a/gdb/value.c b/gdb/value.c
index 06da269..b9a45ef 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1891,6 +1891,66 @@ show_values (char *num_exp, int from_tty)
}
}
+enum internalvar_kind
+{
+ /* The internal variable is empty. */
+ INTERNALVAR_VOID,
+
+ /* The value of the internal variable is provided directly as
+ a GDB value object. */
+ INTERNALVAR_VALUE,
+
+ /* A fresh value is computed via a call-back routine on every
+ access to the internal variable. */
+ INTERNALVAR_MAKE_VALUE,
+
+ /* The internal variable holds a GDB internal convenience function. */
+ INTERNALVAR_FUNCTION,
+
+ /* The variable holds an integer value. */
+ INTERNALVAR_INTEGER,
+
+ /* The variable holds a GDB-provided string. */
+ INTERNALVAR_STRING,
+};
+
+union internalvar_data
+{
+ /* A value object used with INTERNALVAR_VALUE. */
+ struct value *value;
+
+ /* The call-back routine used with INTERNALVAR_MAKE_VALUE. */
+ struct
+ {
+ /* The functions to call. */
+ const struct internalvar_funcs *functions;
+
+ /* The function's user-data. */
+ void *data;
+ } make_value;
+
+ /* The internal function used with INTERNALVAR_FUNCTION. */
+ struct
+ {
+ struct internal_function *function;
+ /* True if this is the canonical name for the function. */
+ int canonical;
+ } fn;
+
+ /* An integer value used with INTERNALVAR_INTEGER. */
+ struct
+ {
+ /* If type is non-NULL, it will be used as the type to generate
+ a value for this internal variable. If type is NULL, a default
+ integer type for the architecture is used. */
+ struct type *type;
+ LONGEST val;
+ } integer;
+
+ /* A string value used with INTERNALVAR_STRING. */
+ char *string;
+};
+
/* Internal variables. These are variables within the debugger
that hold values assigned by debugger commands.
The user refers to them with a '$' prefix
@@ -1905,66 +1965,9 @@ struct internalvar
enum internalvar_kind specifies the kind, and union internalvar_data
provides the data associated with this particular kind. */
- enum internalvar_kind
- {
- /* The internal variable is empty. */
- INTERNALVAR_VOID,
-
- /* The value of the internal variable is provided directly as
- a GDB value object. */
- INTERNALVAR_VALUE,
-
- /* A fresh value is computed via a call-back routine on every
- access to the internal variable. */
- INTERNALVAR_MAKE_VALUE,
-
- /* The internal variable holds a GDB internal convenience function. */
- INTERNALVAR_FUNCTION,
-
- /* The variable holds an integer value. */
- INTERNALVAR_INTEGER,
-
- /* The variable holds a GDB-provided string. */
- INTERNALVAR_STRING,
-
- } kind;
+ enum internalvar_kind kind;
- union internalvar_data
- {
- /* A value object used with INTERNALVAR_VALUE. */
- struct value *value;
-
- /* The call-back routine used with INTERNALVAR_MAKE_VALUE. */
- struct
- {
- /* The functions to call. */
- const struct internalvar_funcs *functions;
-
- /* The function's user-data. */
- void *data;
- } make_value;
-
- /* The internal function used with INTERNALVAR_FUNCTION. */
- struct
- {
- struct internal_function *function;
- /* True if this is the canonical name for the function. */
- int canonical;
- } fn;
-
- /* An integer value used with INTERNALVAR_INTEGER. */
- struct
- {
- /* If type is non-NULL, it will be used as the type to generate
- a value for this internal variable. If type is NULL, a default
- integer type for the architecture is used. */
- struct type *type;
- LONGEST val;
- } integer;
-
- /* A string value used with INTERNALVAR_STRING. */
- char *string;
- } u;
+ union internalvar_data u;
};
static struct internalvar *internalvars;