}
}
\f
+/* 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.
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)
{
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. */
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))
{
{
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);