aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2004-08-04 06:32:01 +0000
committerZack Weinberg <zack@gcc.gnu.org>2004-08-04 06:32:01 +0000
commit7e2e8179ee0887e17549cde85e47b92d1164d6eb (patch)
tree3dd52337f3606374aad08d77be51f3f0a3275268
parent73a8adb62e1609c94e21903fe9c261b6d30a8415 (diff)
downloadgcc-7e2e8179ee0887e17549cde85e47b92d1164d6eb.zip
gcc-7e2e8179ee0887e17549cde85e47b92d1164d6eb.tar.gz
gcc-7e2e8179ee0887e17549cde85e47b92d1164d6eb.tar.bz2
re PR c++/13596 (value of __cplusplus)
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. From-SVN: r85544
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/dbxout.c100
2 files changed, 76 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ddfba85..d4dde17 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2004-08-03 Zack Weinberg <zack@codesourcery.com>
+
+ 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.
+
2004-08-03 Nathanael Nerode <neroden@gcc.gnu.org>
* doc/install.texi: Update autoconf version requirements.
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 6630702..8171757 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);