aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog26
-rw-r--r--gdb/dwarf2read.c8
-rw-r--r--gdb/gdbtypes.c17
-rw-r--r--gdb/gdbtypes.h8
-rw-r--r--gdb/mdebugread.c17
-rw-r--r--gdb/parse.c48
-rw-r--r--gdb/xcoffread.c15
7 files changed, 63 insertions, 76 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 088bece..7264d4e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,29 @@
+2007-06-22 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * gdbtypes.h (struct builtin_type): New members nodebug_text_symbol,
+ nodebug_data_symbol, nodebug_unknown_symbol, and nodebug_tls_symbol.
+ * gdbtypes.c (gdbtypes_post_init): Initialize nodebug_ default types.
+
+ * parse.c (msym_text_symbol_type, msym_data_symbol_type): Remove.
+ (msym_unknown_symbol_type, msym_tls_symbol_type): Remove.
+ (write_exp_msymbol): Use builtin nodebug_ types instead of them.
+ (build_parse): Remove.
+ (_initialize_parse): Do not call build_parse. Do not register
+ msym_ types for gdbarch-swapping.
+
+ * dwarf2read.c (new_symbol): Use default nodebug_data_symbol type
+ instead of creating private type.
+
+ * xcoffread.c (func_symbol_type, var_symbol_type): Remove.
+ (_initialize_xcoffread): Do not initialized them.
+ (process_xcoff_symbol): Use builtin nodebug_ types instead of them.
+
+ * mdebugread.c (nodebug_func_symbol_type): Remove.
+ (nodebug_var_symbol_type): Remove.
+ (_initialize_mdebugread): Do not initialize them.
+ (parse_symbol): Use builtin nodebug_ type instead of them.
+ (parse_procedure): Likewise.
+
2007-06-21 Chris Dearman <chris@mips.com>
* printcmd.c (do_one_display): If display/i, start with an initial
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 6f447a9..32d6f15 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -7150,11 +7150,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
with missing type entries. Change the misleading `void' type
to something sensible. */
if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID)
- SYMBOL_TYPE (sym) = init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch)
- / HOST_CHAR_BIT,
- 0, "<variable, no debug info>",
- objfile);
+ SYMBOL_TYPE (sym)
+ = builtin_type (current_gdbarch)->nodebug_data_symbol;
+
attr = dwarf2_attr (die, DW_AT_const_value, cu);
if (attr)
{
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index c2f580b..15af16b 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3582,6 +3582,23 @@ gdbtypes_post_init (struct gdbarch *gdbarch)
TYPE_FLAG_UNSIGNED,
"__CORE_ADDR", (struct objfile *) NULL);
+
+ /* The following set of types is used for symbols with no
+ debug information. */
+ builtin_type->nodebug_text_symbol
+ = init_type (TYPE_CODE_FUNC, 1, 0, "<text variable, no debug info>", NULL);
+ TYPE_TARGET_TYPE (builtin_type->nodebug_text_symbol)
+ = builtin_type->builtin_int;
+ builtin_type->nodebug_data_symbol
+ = init_type (TYPE_CODE_INT, gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
+ "<data variable, no debug info>", NULL);
+ builtin_type->nodebug_unknown_symbol
+ = init_type (TYPE_CODE_INT, 1, 0,
+ "<variable (not text or data), no debug info>", NULL);
+ builtin_type->nodebug_tls_symbol
+ = init_type (TYPE_CODE_INT, gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT, 0,
+ "<thread local variable, no debug info>", NULL);
+
return builtin_type;
}
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 220400c..c565be6 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1001,6 +1001,14 @@ struct builtin_type
/* The target CPU's address type. This is the ISA address size. */
struct type *builtin_core_addr;
+
+ /* Types used for symbols with no debug information. */
+ struct type *nodebug_text_symbol;
+ struct type *nodebug_data_symbol;
+ struct type *nodebug_unknown_symbol;
+ struct type *nodebug_tls_symbol;
+
+
/* Integral types. */
/* We use this for the '/c' print format, because c_char is just a
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 8fade1e..5f0343d 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -237,11 +237,6 @@ static struct type *mdebug_type_fixed_dec;
static struct type *mdebug_type_float_dec;
static struct type *mdebug_type_string;
-/* Types for symbols from files compiled without debugging info. */
-
-static struct type *nodebug_func_symbol_type;
-static struct type *nodebug_var_symbol_type;
-
/* Nonzero if we have seen ecoff debugging info for a file. */
static int found_ecoff_debugging_info;
@@ -660,7 +655,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
/* Type could be missing if file is compiled without debugging info. */
if (SC_IS_UNDEF (sh->sc)
|| sh->sc == scNil || sh->index == indexNil)
- SYMBOL_TYPE (s) = nodebug_var_symbol_type;
+ SYMBOL_TYPE (s) = builtin_type (current_gdbarch)->nodebug_data_symbol;
else
SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
/* Value of a data symbol is its memory address */
@@ -1984,7 +1979,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab,
if (processing_gcc_compilation == 0
&& found_ecoff_debugging_info == 0
&& TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s))) == TYPE_CODE_VOID)
- SYMBOL_TYPE (s) = nodebug_func_symbol_type;
+ SYMBOL_TYPE (s) = builtin_type (current_gdbarch)->nodebug_text_symbol;
}
/* Parse the external symbol ES. Just call parse_symbol() after
@@ -4881,12 +4876,4 @@ _initialize_mdebugread (void)
gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
0, "floating decimal",
(struct objfile *) NULL);
-
- nodebug_func_symbol_type = init_type (TYPE_CODE_FUNC, 1, 0,
- "<function, no debug info>", NULL);
- TYPE_TARGET_TYPE (nodebug_func_symbol_type) = mdebug_type_int;
- nodebug_var_symbol_type =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT, 0,
- "<variable, no debug info>", NULL);
}
diff --git a/gdb/parse.c b/gdb/parse.c
index 0c7dfd8..95b0c18 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -384,16 +384,12 @@ write_exp_bitstring (struct stoken str)
based on the language, but they no longer have names like "int", so
the initial rationale is gone. */
-static struct type *msym_text_symbol_type;
-static struct type *msym_data_symbol_type;
-static struct type *msym_unknown_symbol_type;
-static struct type *msym_tls_symbol_type;
-
void
write_exp_msymbol (struct minimal_symbol *msymbol,
struct type *text_symbol_type,
struct type *data_symbol_type)
{
+ struct gdbarch *gdbarch = current_gdbarch;
CORE_ADDR addr;
write_exp_elt_opcode (OP_LONG);
@@ -419,7 +415,7 @@ write_exp_msymbol (struct minimal_symbol *msymbol,
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
write_exp_elt_objfile (ofp);
- write_exp_elt_type (msym_tls_symbol_type);
+ write_exp_elt_type (builtin_type (gdbarch)->nodebug_tls_symbol);
write_exp_elt_opcode (UNOP_MEMVAL_TLS);
return;
}
@@ -430,18 +426,18 @@ write_exp_msymbol (struct minimal_symbol *msymbol,
case mst_text:
case mst_file_text:
case mst_solib_trampoline:
- write_exp_elt_type (msym_text_symbol_type);
+ write_exp_elt_type (builtin_type (gdbarch)->nodebug_text_symbol);
break;
case mst_data:
case mst_file_data:
case mst_bss:
case mst_file_bss:
- write_exp_elt_type (msym_data_symbol_type);
+ write_exp_elt_type (builtin_type (gdbarch)->nodebug_data_symbol);
break;
default:
- write_exp_elt_type (msym_unknown_symbol_type);
+ write_exp_elt_type (builtin_type (gdbarch)->nodebug_unknown_symbol);
break;
}
write_exp_elt_opcode (UNOP_MEMVAL);
@@ -1177,30 +1173,6 @@ follow_types (struct type *follow_type)
return follow_type;
}
-static void build_parse (void);
-static void
-build_parse (void)
-{
- int i;
-
- msym_text_symbol_type =
- init_type (TYPE_CODE_FUNC, 1, 0, "<text variable, no debug info>", NULL);
- TYPE_TARGET_TYPE (msym_text_symbol_type) = builtin_type_int;
- msym_data_symbol_type =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT, 0,
- "<data variable, no debug info>", NULL);
- msym_unknown_symbol_type =
- init_type (TYPE_CODE_INT, 1, 0,
- "<variable (not text or data), no debug info>",
- NULL);
-
- msym_tls_symbol_type =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT, 0,
- "<thread local variable, no debug info>", NULL);
-}
-
/* This function avoids direct calls to fprintf
in the parser generated debug code. */
void
@@ -1226,16 +1198,6 @@ _initialize_parse (void)
type_stack = (union type_stack_elt *)
xmalloc (type_stack_size * sizeof (*type_stack));
- build_parse ();
-
- /* FIXME - For the moment, handle types by swapping them in and out.
- Should be using the per-architecture data-pointer and a large
- struct. */
- DEPRECATED_REGISTER_GDBARCH_SWAP (msym_text_symbol_type);
- DEPRECATED_REGISTER_GDBARCH_SWAP (msym_data_symbol_type);
- DEPRECATED_REGISTER_GDBARCH_SWAP (msym_unknown_symbol_type);
- deprecated_register_gdbarch_swap (NULL, 0, build_parse);
-
add_setshow_zinteger_cmd ("expression", class_maintenance,
&expressiondebug, _("\
Set expression debugging."), _("\
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index e5c2e08..7769e02 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1432,9 +1432,6 @@ read_xcoff_symtab (struct partial_symtab *pst)
(ALLOCED) ? (NAME) : obsavestring ((NAME), strlen (NAME), &objfile->objfile_obstack);
-static struct type *func_symbol_type;
-static struct type *var_symbol_type;
-
/* process one xcoff symbol. */
static struct symbol *
@@ -1479,7 +1476,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
patch_block_stabs (), unless the file was compiled without -g. */
DEPRECATED_SYMBOL_NAME (sym) = SYMNAME_ALLOC (name, symname_alloced);
- SYMBOL_TYPE (sym) = func_symbol_type;
+ SYMBOL_TYPE (sym) = builtin_type (current_gdbarch)->nodebug_text_symbol;
SYMBOL_CLASS (sym) = LOC_BLOCK;
SYMBOL_DUP (sym, sym2);
@@ -1492,7 +1489,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
else
{
/* In case we can't figure out the type, provide default. */
- SYMBOL_TYPE (sym) = var_symbol_type;
+ SYMBOL_TYPE (sym) = builtin_type (current_gdbarch)->nodebug_data_symbol;
switch (cs->c_sclass)
{
@@ -3024,12 +3021,4 @@ void
_initialize_xcoffread (void)
{
add_symtab_fns (&xcoff_sym_fns);
-
- func_symbol_type = init_type (TYPE_CODE_FUNC, 1, 0,
- "<function, no debug info>", NULL);
- TYPE_TARGET_TYPE (func_symbol_type) = builtin_type_int;
- var_symbol_type =
- init_type (TYPE_CODE_INT,
- gdbarch_int_bit (current_gdbarch) / HOST_CHAR_BIT, 0,
- "<variable, no debug info>", NULL);
}