From 4e7ac24200e18bbd6367139a46c1286294a70474 Mon Sep 17 00:00:00 2001 From: kan Date: Fri, 11 Jul 2003 04:00:23 +0000 Subject: FreeBSD uses stock versions of these GCC files. --- contrib/gcc/dbxout.c | 103 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 32 deletions(-) (limited to 'contrib/gcc/dbxout.c') diff --git a/contrib/gcc/dbxout.c b/contrib/gcc/dbxout.c index bd7f9a7..60ca664 100644 --- a/contrib/gcc/dbxout.c +++ b/contrib/gcc/dbxout.c @@ -1,6 +1,6 @@ /* Output dbx-format symbol table information from GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GCC. @@ -155,7 +155,7 @@ static int source_label_number = 1; #endif #ifdef DEBUG_SYMS_TEXT -#define FORCE_TEXT text_section (); +#define FORCE_TEXT function_section (current_function_decl); #else #define FORCE_TEXT #endif @@ -309,6 +309,7 @@ static void print_int_cst_octal PARAMS ((tree)); static void print_octal PARAMS ((unsigned HOST_WIDE_INT, int)); static void print_wide_int PARAMS ((HOST_WIDE_INT)); static void dbxout_type_name PARAMS ((tree)); +static void dbxout_class_name_qualifiers PARAMS ((tree)); static int dbxout_symbol_location PARAMS ((tree, tree, const char *, rtx)); static void dbxout_symbol_name PARAMS ((tree, const char *, int)); static void dbxout_prepare_symbol PARAMS ((tree)); @@ -327,7 +328,7 @@ static void dbxout_begin_block PARAMS ((unsigned, unsigned)); static void dbxout_end_block PARAMS ((unsigned, unsigned)); static void dbxout_function_decl PARAMS ((tree)); -struct gcc_debug_hooks dbx_debug_hooks = +const struct gcc_debug_hooks dbx_debug_hooks = { dbxout_init, dbxout_finish, @@ -340,8 +341,8 @@ struct gcc_debug_hooks dbx_debug_hooks = debug_true_tree, /* ignore_block */ dbxout_source_line, /* source_line */ dbxout_source_line, /* begin_prologue: just output line info */ - debug_nothing_int, /* end_prologue */ - debug_nothing_void, /* end_epilogue */ + debug_nothing_int_charstar, /* end_prologue */ + debug_nothing_int_charstar, /* end_epilogue */ #ifdef DBX_FUNCTION_FIRST dbxout_begin_function, #else @@ -357,7 +358,7 @@ struct gcc_debug_hooks dbx_debug_hooks = #endif /* DBX_DEBUGGING_INFO */ #if defined (XCOFF_DEBUGGING_INFO) -struct gcc_debug_hooks xcoff_debug_hooks = +const struct gcc_debug_hooks xcoff_debug_hooks = { dbxout_init, dbxout_finish, @@ -370,7 +371,7 @@ struct gcc_debug_hooks xcoff_debug_hooks = debug_true_tree, /* ignore_block */ xcoffout_source_line, xcoffout_begin_prologue, /* begin_prologue */ - debug_nothing_int, /* end_prologue */ + debug_nothing_int_charstar, /* end_prologue */ xcoffout_end_epilogue, debug_nothing_tree, /* begin_function */ xcoffout_end_function, @@ -417,7 +418,7 @@ dbxout_init (input_file_name) const char *input_file_name; { char ltext_label_name[100]; - tree syms = getdecls (); + tree syms = (*lang_hooks.decls.getdecls) (); asmfile = asm_out_file; @@ -674,7 +675,7 @@ dbxout_global_decl (decl) && ! DECL_EXTERNAL (decl) && DECL_RTL_SET_P (decl)) /* Not necessary? */ dbxout_symbol (decl, 0); -} +} /* At the end of compilation, finish writing the symbol table. Unless you define DBX_OUTPUT_MAIN_SOURCE_FILE_END, the default is @@ -1019,7 +1020,7 @@ dbxout_type_methods (type) } if (!need_prefix) { - putc (';', asmfile); + putc (';', asmfile); CHARS (1); } } @@ -1107,7 +1108,9 @@ dbxout_type (type, full) static int anonymous_type_number = 0; if (TREE_CODE (type) == VECTOR_TYPE) - type = TYPE_DEBUG_REPRESENTATION_TYPE (type); + /* The frontend feeds us a representation for the vector as a struct + containing an array. Pull out the array type. */ + type = TREE_TYPE (TYPE_FIELDS (TYPE_DEBUG_REPRESENTATION_TYPE (type))); /* If there was an input error and we don't really have a type, avoid crashing and write something that is at least valid @@ -1279,7 +1282,7 @@ dbxout_type (type, full) write it as a subtype. */ else if (TREE_TYPE (type) != 0 && TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE) - { + { /* If the size is non-standard, say what it is if we can use GDB extensions. */ @@ -1292,10 +1295,10 @@ dbxout_type (type, full) } dbxout_range_type (type); - } + } else - { + { /* If the size is non-standard, say what it is if we can use GDB extensions. */ @@ -1319,7 +1322,7 @@ dbxout_type (type, full) larger. This is because we print the bounds as signed decimal, and hence they can't span same size unsigned types. */ - if (use_gnu_debug_info_extensions + if (use_gnu_debug_info_extensions && TYPE_MIN_VALUE (type) != 0 && TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST && TYPE_MAX_VALUE (type) != 0 @@ -1348,7 +1351,7 @@ dbxout_type (type, full) else /* Output other integer types as subranges of `int'. */ dbxout_range_type (type); - } + } break; @@ -1861,7 +1864,7 @@ print_wide_int (c) CHARS (digs); } - + /* Output the name of type TYPE, with no punctuation. Such names can be set up either by typedef declarations or by struct, enum and union tags. */ @@ -1887,6 +1890,33 @@ dbxout_type_name (type) fprintf (asmfile, "%s", IDENTIFIER_POINTER (t)); CHARS (IDENTIFIER_LENGTH (t)); } + +/* Output leading leading struct or class names needed for qualifying + type whose scope is limited to a struct or class. */ + +static void +dbxout_class_name_qualifiers (decl) + tree decl; +{ + tree context = decl_type_context (decl); + + if (context != NULL_TREE + && TREE_CODE(context) == RECORD_TYPE + && TYPE_NAME (context) != 0 + && (TREE_CODE (TYPE_NAME (context)) == IDENTIFIER_NODE + || (DECL_NAME (TYPE_NAME (context)) != 0))) + { + tree name = TYPE_NAME (context); + + if (TREE_CODE (name) == TYPE_DECL) + { + dbxout_class_name_qualifiers (name); + name = DECL_NAME (name); + } + fprintf (asmfile, "%s::", IDENTIFIER_POINTER (name)); + CHARS (IDENTIFIER_LENGTH (name) + 2); + } +} /* Output a .stabs for the symbol defined by DECL, which must be a ..._DECL node in the normal namespace. @@ -2007,7 +2037,7 @@ dbxout_symbol (decl, local) && !TREE_ASM_WRITTEN (TYPE_NAME (type)) /* Distinguish the implicit typedefs of C++ from explicit ones that might be found in C. */ - && DECL_ARTIFICIAL (decl) + && DECL_ARTIFICIAL (decl) /* Do not generate a tag for records of variable size, since this type can not be properly described in the DBX format, and it confuses some tools such as objdump. */ @@ -2028,9 +2058,17 @@ dbxout_symbol (decl, local) dbxout_finish_symbol (NULL_TREE); } + /* Output .stabs (or whatever) and leading double quote. */ + fprintf (asmfile, "%s\"", ASM_STABS_OP); + + if (use_gnu_debug_info_extensions) + { + /* Output leading class/struct qualifiers. */ + dbxout_class_name_qualifiers (decl); + } + /* Output typedef name. */ - fprintf (asmfile, "%s\"%s:", ASM_STABS_OP, - IDENTIFIER_POINTER (DECL_NAME (decl))); + fprintf (asmfile, "%s:", IDENTIFIER_POINTER (DECL_NAME (decl))); /* Short cut way to output a tag also. */ if ((TREE_CODE (type) == RECORD_TYPE @@ -2039,7 +2077,7 @@ dbxout_symbol (decl, local) && TYPE_NAME (type) == decl /* Distinguish the implicit typedefs of C++ from explicit ones that might be found in C. */ - && DECL_ARTIFICIAL (decl)) + && DECL_ARTIFICIAL (decl)) { if (use_gnu_debug_info_extensions && have_used_extensions) { @@ -2172,7 +2210,7 @@ dbxout_symbol (decl, local) result = dbxout_symbol_location (decl, type, 0, DECL_RTL (decl)); break; - + default: break; } @@ -2196,7 +2234,7 @@ dbxout_symbol_location (decl, type, suffix, home) /* Don't mention a variable at all if it was completely optimized into nothingness. - + If the decl was from an inline function, then its rtl is not identically the rtl that was used in this particular compilation. */ @@ -2275,7 +2313,7 @@ dbxout_symbol_location (decl, type, suffix, home) || GET_CODE (tmp) == LABEL_REF) current_sym_addr = tmp; } - + /* Ultrix `as' seems to need this. */ #ifdef DBX_STATIC_STAB_DATA_SECTION data_section (); @@ -2480,7 +2518,7 @@ dbxout_finish_symbol (sym) #endif } -/* Output definitions of all the decls in a chain. Return non-zero if +/* Output definitions of all the decls in a chain. Return nonzero if anything was output */ int @@ -2564,7 +2602,7 @@ dbxout_parms (parms) } /* It is quite tempting to use: - + dbxout_type (TREE_TYPE (parms), 0); as the next statement, rather than using DECL_ARG_TYPE(), so @@ -2577,7 +2615,7 @@ dbxout_parms (parms) double on the stack, but if we emit a stab saying the type is a float, then gdb will only read in a single value, and this will produce an erroneous value. */ - dbxout_type (DECL_ARG_TYPE (parms), 0); + dbxout_type (DECL_ARG_TYPE (parms), 0); current_sym_value = DEBUGGER_ARG_OFFSET (current_sym_value, addr); dbxout_finish_symbol (parms); } @@ -2695,13 +2733,14 @@ dbxout_parms (parms) const char *const decl_name = (DECL_NAME (parms) ? IDENTIFIER_POINTER (DECL_NAME (parms)) : "(anon)"); - if (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 0)) == REG) - current_sym_value = 0; + if (GET_CODE (XEXP (XEXP (DECL_RTL (parms), 0), 0)) == REG) + current_sym_value = 0; else current_sym_value = INTVAL (XEXP (XEXP (XEXP (DECL_RTL (parms), 0), 0), 1)); current_sym_addr = 0; - + current_sym_code = N_PSYM; + FORCE_TEXT; fprintf (asmfile, "%s\"%s:v", ASM_STABS_OP, decl_name); @@ -2739,7 +2778,7 @@ dbxout_parms (parms) && TYPE_MODE (TREE_TYPE (parms)) != GET_MODE (DECL_RTL (parms)) && GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))) < UNITS_PER_WORD) { - current_sym_value += + current_sym_value += GET_MODE_SIZE (GET_MODE (DECL_RTL (parms))) - GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (parms))); } @@ -2849,7 +2888,7 @@ dbxout_block (block, depth, args) int blocknum = -1; #if DBX_BLOCKS_FUNCTION_RELATIVE - const char *begin_label; + const char *begin_label; if (current_function_func_begin_label != NULL_TREE) begin_label = IDENTIFIER_POINTER (current_function_func_begin_label); else -- cgit v1.1