X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fdbxout.c;h=8c59b4594383bdf0751ac843128d936d40261864;hb=0ac23bc8a78146c50d65692bc654ff40831fe18c;hp=5ed9b69e7cdf28c9092230f82fe999a0d3ccbc90;hpb=00e3fe4411f5ad4f6c2c2b87af0806574a380678;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 5ed9b69e7cd..8c59b459438 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -88,35 +88,16 @@ along with GCC; see the file COPYING3. If not see #include "debug.h" #include "function.h" #include "target.h" +#include "common/common-target.h" #include "langhooks.h" #include "obstack.h" #include "expr.h" +#include "cgraph.h" #ifdef XCOFF_DEBUGGING_INFO #include "xcoffout.h" #endif -/* When -gused is used, emit debug info for only used symbols. But in - addition to the standard intercepted debug_hooks there are some - direct calls into this file, i.e., dbxout_symbol, dbxout_parms, and - dbxout_reg_params. Those routines may also be called from a higher - level intercepted routine. So to prevent recording data for an inner - call to one of these for an intercept, we maintain an intercept - nesting counter (debug_nesting). We only save the intercepted - arguments if the nesting is 1. */ -static int debug_nesting = 0; - -static tree *symbol_queue; -static int symbol_queue_index = 0; -static int symbol_queue_size = 0; - -#define DBXOUT_DECR_NESTING \ - if (--debug_nesting == 0 && symbol_queue_index > 0) \ - { emit_pending_bincls_if_required (); debug_flush_symbol_queue (); } - -#define DBXOUT_DECR_NESTING_AND_RETURN(x) \ - do {--debug_nesting; return (x);} while (0) - #ifndef ASM_STABS_OP # ifdef XCOFF_DEBUGGING_INFO # define ASM_STABS_OP "\t.stabx\t" @@ -924,6 +905,31 @@ dbxout_finish_complex_stabs (tree sym, stab_code_type code, obstack_free (&stabstr_ob, str); } +#if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO) + +/* When -gused is used, emit debug info for only used symbols. But in + addition to the standard intercepted debug_hooks there are some + direct calls into this file, i.e., dbxout_symbol, dbxout_parms, and + dbxout_reg_params. Those routines may also be called from a higher + level intercepted routine. So to prevent recording data for an inner + call to one of these for an intercept, we maintain an intercept + nesting counter (debug_nesting). We only save the intercepted + arguments if the nesting is 1. */ +static int debug_nesting = 0; + +static tree *symbol_queue; +static int symbol_queue_index = 0; +static int symbol_queue_size = 0; + +#define DBXOUT_DECR_NESTING \ + if (--debug_nesting == 0 && symbol_queue_index > 0) \ + { emit_pending_bincls_if_required (); debug_flush_symbol_queue (); } + +#define DBXOUT_DECR_NESTING_AND_RETURN(x) \ + do {--debug_nesting; return (x);} while (0) + +#endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */ + #if defined (DBX_DEBUGGING_INFO) static void @@ -946,7 +952,7 @@ dbxout_function_end (tree decl ATTRIBUTE_UNUSED) named sections. */ if (!use_gnu_debug_info_extensions || NO_DBX_FUNCTION_END - || !targetm.have_named_sections) + || !targetm_common.have_named_sections) return; /* By convention, GCC will mark the end of a function with an N_FUN @@ -1505,7 +1511,7 @@ dbxout_type_fields (tree type) { /* If one of the nodes is an error_mark or its type is then return early. */ - if (tem == error_mark_node || TREE_TYPE (tem) == error_mark_node) + if (error_operand_p (tem)) return; /* Omit here local type decls until we know how to support them. */ @@ -2466,6 +2472,20 @@ dbxout_expand_expr (tree expr) disable debug info for these variables. */ if (!targetm.have_tls && DECL_THREAD_LOCAL_P (expr)) return NULL; + if (TREE_STATIC (expr) + && !TREE_ASM_WRITTEN (expr) + && !DECL_HAS_VALUE_EXPR_P (expr) + && !TREE_PUBLIC (expr) + && DECL_RTL_SET_P (expr) + && MEM_P (DECL_RTL (expr))) + { + /* If this is a var that might not be actually output, + return NULL, otherwise stabs might reference an undefined + symbol. */ + struct varpool_node *node = varpool_get_node (expr); + if (!node || !node->needed) + return NULL; + } /* FALLTHRU */ case PARM_DECL: