Deleted Added
full compact
dbxout.c (132727) dbxout.c (146906)
1/* Output dbx-format symbol table information from GNU compiler.
2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 420 unchanged lines hidden (view full) ---

429};
430#endif /* XCOFF_DEBUGGING_INFO */
431
432#if defined (DBX_DEBUGGING_INFO)
433static void
434dbxout_function_end (void)
435{
436 char lscope_label_name[100];
1/* Output dbx-format symbol table information from GNU compiler.
2 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free

--- 420 unchanged lines hidden (view full) ---

429};
430#endif /* XCOFF_DEBUGGING_INFO */
431
432#if defined (DBX_DEBUGGING_INFO)
433static void
434dbxout_function_end (void)
435{
436 char lscope_label_name[100];
437
438 /* The Lscope label must be emitted even if we aren't doing anything
439 else; dbxout_block needs it. */
437 /* Convert Ltext into the appropriate format for local labels in case
438 the system doesn't insert underscores in front of user generated
439 labels. */
440 ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno);
441 (*targetm.asm_out.internal_label) (asmfile, "Lscope", scope_labelno);
442 scope_labelno++;
443
440 /* Convert Ltext into the appropriate format for local labels in case
441 the system doesn't insert underscores in front of user generated
442 labels. */
443 ASM_GENERATE_INTERNAL_LABEL (lscope_label_name, "Lscope", scope_labelno);
444 (*targetm.asm_out.internal_label) (asmfile, "Lscope", scope_labelno);
445 scope_labelno++;
446
447 /* The N_FUN tag at the end of the function is a GNU extension,
448 which may be undesirable, and is unnecessary if we do not have
449 named sections. */
450 if (!use_gnu_debug_info_extensions
451#if defined(NO_DBX_FUNCTION_END)
452 || NO_DBX_FUNCTION_END
453#endif
454 || !targetm.have_named_sections)
455 return;
456
444 /* By convention, GCC will mark the end of a function with an N_FUN
445 symbol and an empty string. */
446#ifdef DBX_OUTPUT_NFUN
447 DBX_OUTPUT_NFUN (asmfile, lscope_label_name, current_function_decl);
448#else
449 fprintf (asmfile, "%s\"\",%d,0,0,", ASM_STABS_OP, N_FUN);
450 assemble_name (asmfile, lscope_label_name);
451 putc ('-', asmfile);

--- 317 unchanged lines hidden (view full) ---

769 emit_pending_bincls_if_required ();
770#ifndef DBX_FUNCTION_FIRST
771 dbxout_begin_function (decl);
772#endif
773 dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
774#ifdef DBX_OUTPUT_FUNCTION_END
775 DBX_OUTPUT_FUNCTION_END (asmfile, decl);
776#endif
457 /* By convention, GCC will mark the end of a function with an N_FUN
458 symbol and an empty string. */
459#ifdef DBX_OUTPUT_NFUN
460 DBX_OUTPUT_NFUN (asmfile, lscope_label_name, current_function_decl);
461#else
462 fprintf (asmfile, "%s\"\",%d,0,0,", ASM_STABS_OP, N_FUN);
463 assemble_name (asmfile, lscope_label_name);
464 putc ('-', asmfile);

--- 317 unchanged lines hidden (view full) ---

782 emit_pending_bincls_if_required ();
783#ifndef DBX_FUNCTION_FIRST
784 dbxout_begin_function (decl);
785#endif
786 dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl));
787#ifdef DBX_OUTPUT_FUNCTION_END
788 DBX_OUTPUT_FUNCTION_END (asmfile, decl);
789#endif
777 if (use_gnu_debug_info_extensions
778#if defined(NO_DBX_FUNCTION_END)
779 && ! NO_DBX_FUNCTION_END
780#endif
781 && targetm.have_named_sections)
782 dbxout_function_end ();
790 dbxout_function_end ();
783}
784
785#endif /* DBX_DEBUGGING_INFO */
786
787/* Debug information for a global DECL. Called from toplev.c after
788 compilation proper has finished. */
789static void
790dbxout_global_decl (tree decl)

--- 1643 unchanged lines hidden (view full) ---

2434 current_sym_code = N_GSYM;
2435 }
2436 else
2437 {
2438 current_sym_addr = XEXP (home, 0);
2439
2440 letter = decl_function_context (decl) ? 'V' : 'S';
2441
791}
792
793#endif /* DBX_DEBUGGING_INFO */
794
795/* Debug information for a global DECL. Called from toplev.c after
796 compilation proper has finished. */
797static void
798dbxout_global_decl (tree decl)

--- 1643 unchanged lines hidden (view full) ---

2442 current_sym_code = N_GSYM;
2443 }
2444 else
2445 {
2446 current_sym_addr = XEXP (home, 0);
2447
2448 letter = decl_function_context (decl) ? 'V' : 'S';
2449
2450 /* Some ports can transform a symbol ref into a label ref,
2451 because the symbol ref is too far away and has to be
2452 dumped into a constant pool. Alternatively, the symbol
2453 in the constant pool might be referenced by a different
2454 symbol. */
2455 if (GET_CODE (current_sym_addr) == SYMBOL_REF
2456 && CONSTANT_POOL_ADDRESS_P (current_sym_addr))
2457 {
2458 bool marked;
2459 rtx tmp = get_pool_constant_mark (current_sym_addr, &marked);
2460
2461 if (GET_CODE (tmp) == SYMBOL_REF)
2462 {
2463 current_sym_addr = tmp;
2464 if (CONSTANT_POOL_ADDRESS_P (current_sym_addr))
2465 get_pool_constant_mark (current_sym_addr, &marked);
2466 else
2467 marked = true;
2468 }
2469 else if (GET_CODE (tmp) == LABEL_REF)
2470 {
2471 current_sym_addr = tmp;
2472 marked = true;
2473 }
2474
2475 /* If all references to the constant pool were optimized
2476 out, we just ignore the symbol. */
2477 if (!marked)
2478 return 0;
2479 }
2480
2442 /* This should be the same condition as in assemble_variable, but
2443 we don't have access to dont_output_data here. So, instead,
2444 we rely on the fact that error_mark_node initializers always
2445 end up in bss for C++ and never end up in bss for C. */
2446 if (DECL_INITIAL (decl) == 0
2447 || (!strcmp (lang_hooks.name, "GNU C++")
2448 && DECL_INITIAL (decl) == error_mark_node))
2449 current_sym_code = N_LCSYM;
2450 else if (DECL_IN_TEXT_SECTION (decl))
2451 /* This is not quite right, but it's the closest
2452 of all the codes that Unix defines. */
2453 current_sym_code = DBX_STATIC_CONST_VAR_CODE;
2454 else
2455 {
2481 /* This should be the same condition as in assemble_variable, but
2482 we don't have access to dont_output_data here. So, instead,
2483 we rely on the fact that error_mark_node initializers always
2484 end up in bss for C++ and never end up in bss for C. */
2485 if (DECL_INITIAL (decl) == 0
2486 || (!strcmp (lang_hooks.name, "GNU C++")
2487 && DECL_INITIAL (decl) == error_mark_node))
2488 current_sym_code = N_LCSYM;
2489 else if (DECL_IN_TEXT_SECTION (decl))
2490 /* This is not quite right, but it's the closest
2491 of all the codes that Unix defines. */
2492 current_sym_code = DBX_STATIC_CONST_VAR_CODE;
2493 else
2494 {
2456 /* Some ports can transform a symbol ref into a label ref,
2457 because the symbol ref is too far away and has to be
2458 dumped into a constant pool. Alternatively, the symbol
2459 in the constant pool might be referenced by a different
2460 symbol. */
2461 if (GET_CODE (current_sym_addr) == SYMBOL_REF
2462 && CONSTANT_POOL_ADDRESS_P (current_sym_addr))
2463 {
2464 bool marked;
2465 rtx tmp = get_pool_constant_mark (current_sym_addr, &marked);
2466
2467 if (GET_CODE (tmp) == SYMBOL_REF)
2468 {
2469 current_sym_addr = tmp;
2470 if (CONSTANT_POOL_ADDRESS_P (current_sym_addr))
2471 get_pool_constant_mark (current_sym_addr, &marked);
2472 else
2473 marked = true;
2474 }
2475 else if (GET_CODE (tmp) == LABEL_REF)
2476 {
2477 current_sym_addr = tmp;
2478 marked = true;
2479 }
2480
2481 /* If all references to the constant pool were optimized
2482 out, we just ignore the symbol. */
2483 if (!marked)
2484 return 0;
2485 }
2486
2487 /* Ultrix `as' seems to need this. */
2488#ifdef DBX_STATIC_STAB_DATA_SECTION
2489 data_section ();
2490#endif
2491 current_sym_code = N_STSYM;
2492 }
2493 }
2494 }

--- 537 unchanged lines hidden (view full) ---

3032 {
3033 putc (',', asmfile);
3034 dbxout_type (TREE_VALUE (args), 0);
3035 CHARS (1);
3036 args = TREE_CHAIN (args);
3037 }
3038}
3039
2495 /* Ultrix `as' seems to need this. */
2496#ifdef DBX_STATIC_STAB_DATA_SECTION
2497 data_section ();
2498#endif
2499 current_sym_code = N_STSYM;
2500 }
2501 }
2502 }

--- 537 unchanged lines hidden (view full) ---

3040 {
3041 putc (',', asmfile);
3042 dbxout_type (TREE_VALUE (args), 0);
3043 CHARS (1);
3044 args = TREE_CHAIN (args);
3045 }
3046}
3047
3048/* Subroutine of dbxout_block. Emit an N_LBRAC stab referencing LABEL.
3049 BEGIN_LABEL is the name of the beginning of the function, which may
3050 be required. */
3051static void
3052dbx_output_lbrac (const char *label,
3053 const char *begin_label ATTRIBUTE_UNUSED)
3054{
3055#ifdef DBX_OUTPUT_LBRAC
3056 DBX_OUTPUT_LBRAC (asmfile, label);
3057#else
3058 fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_LBRAC);
3059 assemble_name (asmfile, label);
3060#if DBX_BLOCKS_FUNCTION_RELATIVE
3061 putc ('-', asmfile);
3062 assemble_name (asmfile, begin_label);
3063#endif
3064 fprintf (asmfile, "\n");
3065#endif
3066}
3067
3068/* Subroutine of dbxout_block. Emit an N_RBRAC stab referencing LABEL.
3069 BEGIN_LABEL is the name of the beginning of the function, which may
3070 be required. */
3071static void
3072dbx_output_rbrac (const char *label,
3073 const char *begin_label ATTRIBUTE_UNUSED)
3074{
3075#ifdef DBX_OUTPUT_RBRAC
3076 DBX_OUTPUT_RBRAC (asmfile, label);
3077#else
3078 fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_RBRAC);
3079 assemble_name (asmfile, label);
3080#if DBX_BLOCKS_FUNCTION_RELATIVE
3081 putc ('-', asmfile);
3082 assemble_name (asmfile, begin_label);
3083#endif
3084 fprintf (asmfile, "\n");
3085#endif
3086}
3087
3040/* Output everything about a symbol block (a BLOCK node
3041 that represents a scope level),
3042 including recursive output of contained blocks.
3043
3044 BLOCK is the BLOCK node.
3045 DEPTH is its depth within containing symbol blocks.
3046 ARGS is usually zero; but for the outermost block of the
3047 body of a function, it is a chain of PARM_DECLs for the function parameters.

--- 4 unchanged lines hidden (view full) ---

3052 except for the outermost block.
3053
3054 Actually, BLOCK may be several blocks chained together.
3055 We handle them all in sequence. */
3056
3057static void
3058dbxout_block (tree block, int depth, tree args)
3059{
3088/* Output everything about a symbol block (a BLOCK node
3089 that represents a scope level),
3090 including recursive output of contained blocks.
3091
3092 BLOCK is the BLOCK node.
3093 DEPTH is its depth within containing symbol blocks.
3094 ARGS is usually zero; but for the outermost block of the
3095 body of a function, it is a chain of PARM_DECLs for the function parameters.

--- 4 unchanged lines hidden (view full) ---

3100 except for the outermost block.
3101
3102 Actually, BLOCK may be several blocks chained together.
3103 We handle them all in sequence. */
3104
3105static void
3106dbxout_block (tree block, int depth, tree args)
3107{
3060 int blocknum = -1;
3061
3062#if DBX_BLOCKS_FUNCTION_RELATIVE
3063 const char *begin_label;
3064 if (current_function_func_begin_label != NULL_TREE)
3065 begin_label = IDENTIFIER_POINTER (current_function_func_begin_label);
3066 else
3067 begin_label = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
3108 const char *begin_label;
3109 if (current_function_func_begin_label != NULL_TREE)
3110 begin_label = IDENTIFIER_POINTER (current_function_func_begin_label);
3111 else
3112 begin_label = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
3068#endif
3069
3070 while (block)
3071 {
3072 /* Ignore blocks never expanded or otherwise marked as real. */
3073 if (TREE_USED (block) && TREE_ASM_WRITTEN (block))
3074 {
3075 int did_output;
3113
3114 while (block)
3115 {
3116 /* Ignore blocks never expanded or otherwise marked as real. */
3117 if (TREE_USED (block) && TREE_ASM_WRITTEN (block))
3118 {
3119 int did_output;
3120 int blocknum = BLOCK_NUMBER (block);
3076
3077 /* In dbx format, the syms of a block come before the N_LBRAC.
3078 If nothing is output, we don't need the N_LBRAC, either. */
3079 did_output = 0;
3080 if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
3081 did_output = dbxout_syms (BLOCK_VARS (block));
3082 if (args)
3083 dbxout_reg_parms (args);
3084
3085 /* Now output an N_LBRAC symbol to represent the beginning of
3086 the block. Use the block's tree-walk order to generate
3087 the assembler symbols LBBn and LBEn
3088 that final will define around the code in this block. */
3121
3122 /* In dbx format, the syms of a block come before the N_LBRAC.
3123 If nothing is output, we don't need the N_LBRAC, either. */
3124 did_output = 0;
3125 if (debug_info_level != DINFO_LEVEL_TERSE || depth == 0)
3126 did_output = dbxout_syms (BLOCK_VARS (block));
3127 if (args)
3128 dbxout_reg_parms (args);
3129
3130 /* Now output an N_LBRAC symbol to represent the beginning of
3131 the block. Use the block's tree-walk order to generate
3132 the assembler symbols LBBn and LBEn
3133 that final will define around the code in this block. */
3089 if (depth > 0 && did_output)
3134 if (did_output)
3090 {
3091 char buf[20];
3135 {
3136 char buf[20];
3092 blocknum = BLOCK_NUMBER (block);
3093 ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
3137 const char *scope_start;
3094
3138
3139 if (depth == 0)
3140 /* The outermost block doesn't get LBB labels; use
3141 the function symbol. */
3142 scope_start = begin_label;
3143 else
3144 {
3145 ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum);
3146 scope_start = buf;
3147 }
3148
3095 if (BLOCK_HANDLER_BLOCK (block))
3096 {
3097 /* A catch block. Must precede N_LBRAC. */
3098 tree decl = BLOCK_VARS (block);
3099 while (decl)
3100 {
3101 fprintf (asmfile, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP,
3102 IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH);
3149 if (BLOCK_HANDLER_BLOCK (block))
3150 {
3151 /* A catch block. Must precede N_LBRAC. */
3152 tree decl = BLOCK_VARS (block);
3153 while (decl)
3154 {
3155 fprintf (asmfile, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP,
3156 IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH);
3103 assemble_name (asmfile, buf);
3157 assemble_name (asmfile, scope_start);
3104 fprintf (asmfile, "\n");
3105 decl = TREE_CHAIN (decl);
3106 }
3107 }
3158 fprintf (asmfile, "\n");
3159 decl = TREE_CHAIN (decl);
3160 }
3161 }
3108
3109#ifdef DBX_OUTPUT_LBRAC
3110 DBX_OUTPUT_LBRAC (asmfile, buf);
3111#else
3112 fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_LBRAC);
3113 assemble_name (asmfile, buf);
3114#if DBX_BLOCKS_FUNCTION_RELATIVE
3115 putc ('-', asmfile);
3116 assemble_name (asmfile, begin_label);
3117#endif
3118 fprintf (asmfile, "\n");
3119#endif
3162 dbx_output_lbrac (scope_start, begin_label);
3120 }
3121
3122 /* Output the subblocks. */
3123 dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
3124
3125 /* Refer to the marker for the end of the block. */
3163 }
3164
3165 /* Output the subblocks. */
3166 dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE);
3167
3168 /* Refer to the marker for the end of the block. */
3126 if (depth > 0 && did_output)
3169 if (did_output)
3127 {
3170 {
3128 char buf[20];
3129 ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
3130#ifdef DBX_OUTPUT_RBRAC
3131 DBX_OUTPUT_RBRAC (asmfile, buf);
3132#else
3133 fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_RBRAC);
3134 assemble_name (asmfile, buf);
3135#if DBX_BLOCKS_FUNCTION_RELATIVE
3136 putc ('-', asmfile);
3137 assemble_name (asmfile, begin_label);
3138#endif
3139 fprintf (asmfile, "\n");
3140#endif
3171 char buf[100];
3172 if (depth == 0)
3173 /* The outermost block doesn't get LBE labels;
3174 use the "scope" label which will be emitted
3175 by dbxout_function_end. */
3176 ASM_GENERATE_INTERNAL_LABEL (buf, "Lscope", scope_labelno);
3177 else
3178 ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum);
3179
3180 dbx_output_rbrac (buf, begin_label);
3141 }
3142 }
3143 block = BLOCK_CHAIN (block);
3144 }
3145}
3146
3147/* Output the information about a function and its arguments and result.
3148 Usually this follows the function's code,

--- 28 unchanged lines hidden ---
3181 }
3182 }
3183 block = BLOCK_CHAIN (block);
3184 }
3185}
3186
3187/* Output the information about a function and its arguments and result.
3188 Usually this follows the function's code,

--- 28 unchanged lines hidden ---