diff options
author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-04 06:32:01 +0000 |
---|---|---|
committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-04 06:32:01 +0000 |
commit | 7850c77b65dfc62f85911b27bc7565246018cc06 (patch) | |
tree | 3dd52337f3606374aad08d77be51f3f0a3275268 /gcc/dbxout.c | |
parent | 91caa6ca3986bf788a691be18aec8cafe401a1a0 (diff) | |
download | gcc-7850c77b65dfc62f85911b27bc7565246018cc06.tar.gz |
PR 13596
* dbxout.c (dbx_output_lbrac, dbx_output_rbrac): New
functions, broken out of dbxout_block.
(dbxout_block): The block at depth 0 should get LBRAC/RBRAC
stabs too, if it contains symbols. Use the begin_label and
the Lscope label (emitted by dbxout_function_end) for the
range of this block.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85544 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dbxout.c')
-rw-r--r-- | gcc/dbxout.c | 100 |
1 files changed, 66 insertions, 34 deletions
diff --git a/gcc/dbxout.c b/gcc/dbxout.c index 6630702e9d5..81717577973 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -3089,6 +3089,46 @@ dbxout_args (tree args) } } +/* Subroutine of dbxout_block. Emit an N_LBRAC stab referencing LABEL. + BEGIN_LABEL is the name of the beginning of the function, which may + be required. */ +static void +dbx_output_lbrac (const char *label, + const char *begin_label ATTRIBUTE_UNUSED) +{ +#ifdef DBX_OUTPUT_LBRAC + DBX_OUTPUT_LBRAC (asmfile, label); +#else + fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_LBRAC); + assemble_name (asmfile, label); +#if DBX_BLOCKS_FUNCTION_RELATIVE + putc ('-', asmfile); + assemble_name (asmfile, begin_label); +#endif + fprintf (asmfile, "\n"); +#endif +} + +/* Subroutine of dbxout_block. Emit an N_RBRAC stab referencing LABEL. + BEGIN_LABEL is the name of the beginning of the function, which may + be required. */ +static void +dbx_output_rbrac (const char *label, + const char *begin_label ATTRIBUTE_UNUSED) +{ +#ifdef DBX_OUTPUT_RBRAC + DBX_OUTPUT_RBRAC (asmfile, label); +#else + fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_RBRAC); + assemble_name (asmfile, label); +#if DBX_BLOCKS_FUNCTION_RELATIVE + putc ('-', asmfile); + assemble_name (asmfile, begin_label); +#endif + fprintf (asmfile, "\n"); +#endif +} + /* Output everything about a symbol block (a BLOCK node that represents a scope level), including recursive output of contained blocks. @@ -3109,15 +3149,11 @@ dbxout_args (tree args) static void dbxout_block (tree block, int depth, tree args) { - int blocknum = -1; - -#if DBX_BLOCKS_FUNCTION_RELATIVE const char *begin_label; if (current_function_func_begin_label != NULL_TREE) begin_label = IDENTIFIER_POINTER (current_function_func_begin_label); else begin_label = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); -#endif while (block) { @@ -3125,6 +3161,7 @@ dbxout_block (tree block, int depth, tree args) if (TREE_USED (block) && TREE_ASM_WRITTEN (block)) { int did_output; + int blocknum = BLOCK_NUMBER (block); /* In dbx format, the syms of a block come before the N_LBRAC. If nothing is output, we don't need the N_LBRAC, either. */ @@ -3138,11 +3175,20 @@ dbxout_block (tree block, int depth, tree args) the block. Use the block's tree-walk order to generate the assembler symbols LBBn and LBEn that final will define around the code in this block. */ - if (depth > 0 && did_output) + if (did_output) { char buf[20]; - blocknum = BLOCK_NUMBER (block); - ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum); + const char *scope_start; + + if (depth == 0) + /* The outermost block doesn't get LBB labels; use + the function symbol. */ + scope_start = begin_label; + else + { + ASM_GENERATE_INTERNAL_LABEL (buf, "LBB", blocknum); + scope_start = buf; + } if (BLOCK_HANDLER_BLOCK (block)) { @@ -3152,44 +3198,30 @@ dbxout_block (tree block, int depth, tree args) { fprintf (asmfile, "%s\"%s:C1\",%d,0,0,", ASM_STABS_OP, IDENTIFIER_POINTER (DECL_NAME (decl)), N_CATCH); - assemble_name (asmfile, buf); + assemble_name (asmfile, scope_start); fprintf (asmfile, "\n"); decl = TREE_CHAIN (decl); } } - -#ifdef DBX_OUTPUT_LBRAC - DBX_OUTPUT_LBRAC (asmfile, buf); -#else - fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_LBRAC); - assemble_name (asmfile, buf); -#if DBX_BLOCKS_FUNCTION_RELATIVE - putc ('-', asmfile); - assemble_name (asmfile, begin_label); -#endif - fprintf (asmfile, "\n"); -#endif + dbx_output_lbrac (scope_start, begin_label); } /* Output the subblocks. */ dbxout_block (BLOCK_SUBBLOCKS (block), depth + 1, NULL_TREE); /* Refer to the marker for the end of the block. */ - if (depth > 0 && did_output) + if (did_output) { - char buf[20]; - ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum); -#ifdef DBX_OUTPUT_RBRAC - DBX_OUTPUT_RBRAC (asmfile, buf); -#else - fprintf (asmfile, "%s%d,0,0,", ASM_STABN_OP, N_RBRAC); - assemble_name (asmfile, buf); -#if DBX_BLOCKS_FUNCTION_RELATIVE - putc ('-', asmfile); - assemble_name (asmfile, begin_label); -#endif - fprintf (asmfile, "\n"); -#endif + char buf[100]; + if (depth == 0) + /* The outermost block doesn't get LBE labels; + use the "scope" label which will be emitted + by dbxout_function_end. */ + ASM_GENERATE_INTERNAL_LABEL (buf, "Lscope", scope_labelno); + else + ASM_GENERATE_INTERNAL_LABEL (buf, "LBE", blocknum); + + dbx_output_rbrac (buf, begin_label); } } block = BLOCK_CHAIN (block); |