dbxout.c (dbxout_begin_prologue): New function.
authorDevang Patel <dpatel@apple.com>
Thu, 12 Aug 2004 21:32:56 +0000 (14:32 -0700)
committerDevang Patel <dpatel@gcc.gnu.org>
Thu, 12 Aug 2004 21:32:56 +0000 (14:32 -0700)
        * dbxout.c (dbxout_begin_prologue): New function.
        (dbx_debug_hooks): Use new begin prologue hook.
        (dbxout_function_end): Emit N_ENSYM.
        * stab.def (N_BNSYM, N_ENSYM): Define and document these two new stabs.

        testsuite:
        gcc.dg/darwin-20040809-2.c: New test.

From-SVN: r85908

gcc/ChangeLog
gcc/dbxout.c
gcc/stab.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/darwin-20040809-2.c [new file with mode: 0644]

index a1baa0f..7ddf1ac 100644 (file)
@@ -1,3 +1,10 @@
+2004-08-12  Devang patel  <dpatel@apple.com>
+
+       * dbxout.c (dbxout_begin_prologue): New function.
+       (dbx_debug_hooks): Use new begin prologue hook.
+       (dbxout_function_end): Emit N_ENSYM.
+       * stab.def (N_BNSYM, N_ENSYM): Define and document these two new stabs.
+       
 2004-08-12  Janis Johnson  <janis187@us.ibm.com>
 
        * config/rs6000/altivec.h (vec_dst): Fix C++ functions whose first
index 9a9e447..55f2275 100644 (file)
@@ -372,6 +372,7 @@ static void dbxout_handle_pch (unsigned);
 #if defined (DBX_DEBUGGING_INFO)
 
 static void dbxout_source_line (unsigned int, const char *);
+static void dbxout_begin_prologue (unsigned int, const char *);
 static void dbxout_source_file (FILE *, const char *);
 static void dbxout_function_end (void);
 static void dbxout_begin_function (tree);
@@ -391,8 +392,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
   dbxout_end_block,
   debug_true_tree,                      /* ignore_block */
   dbxout_source_line,                   /* source_line */
-  dbxout_source_line,                   /* begin_prologue: just output 
-                                           line info */
+  dbxout_begin_prologue,                /* begin_prologue */
   debug_nothing_int_charstar,           /* end_prologue */
   debug_nothing_int_charstar,           /* end_epilogue */
 #ifdef DBX_FUNCTION_FIRST
@@ -481,6 +481,9 @@ dbxout_function_end (void)
   assemble_name (asmfile, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
   fprintf (asmfile, "\n");
 #endif
+
+  if (!flag_debug_only_used_symbols)
+    fprintf (asmfile, "%s%d,0,0\n", ASM_STABD_OP, N_ENSYM);
 }
 #endif /* DBX_DEBUGGING_INFO */
 
@@ -753,6 +756,17 @@ dbxout_source_file (FILE *file, const char *filename)
     }
 }
 
+/* Output N_BNSYM and line number symbol entry.  */
+
+static void
+dbxout_begin_prologue (unsigned int lineno, const char *filename)
+{
+  if (!flag_debug_only_used_symbols)
+    fprintf (asmfile, "%s%d,0,0\n", ASM_STABD_OP, N_BNSYM);
+
+  dbxout_source_line (lineno, filename);
+}
+
 /* Output a line number symbol entry for source file FILENAME and line
    number LINENO.  */
 
index 7a0b849..2d58961 100644 (file)
@@ -39,6 +39,12 @@ __define_stab (N_STSYM, 0x26, "STSYM")
 /* BSS-segment variable with internal linkage.  Value is its address.  */
 __define_stab (N_LCSYM, 0x28, "LCSYM")
 
+/* Begin function marker.  */
+__define_stab (N_BNSYM, 0x2e, "BNSYM")
+
+/* End function marker.  */
+__define_stab (N_ENSYM, 0x4e, "ENSYM")
+
 /* Name of main routine.  Only the name is significant.
    This is not used in C.  */
 __define_stab (N_MAIN, 0x2a, "MAIN")
@@ -201,11 +207,11 @@ __define_stab (N_LENG, 0xfe, "LENG")
        |_______________________________________________|
        | Debug entries with bit 01 set are unused.     |
        | 20 GSYM   | 22 FNAME  | 24 FUN    | 26 STSYM  |
-       | 28 LCSYM  | 2A MAIN   | 2C        | 2E        |
+       | 28 LCSYM  | 2A MAIN   | 2C        | 2E BNSYM  |
        | 30 PC     | 32 NSYMS  | 34 NOMAP  | 36        |
        | 38 OBJ    | 3A        | 3C OPT    | 3E        |
        | 40 RSYM   | 42 M2C    | 44 SLINE  | 46 DSLINE |
-       | 48 BSLINE*| 4A DEFD   | 4C        | 4E        |
+       | 48 BSLINE*| 4A DEFD   | 4C        | 4E ENSYM  |
        | 50 EHDECL*| 52        | 54 CATCH  | 56        |
        | 58        | 5A        | 5C        | 5E        |
        | 60 SSYM   | 62        | 64 SO     | 66        |
index 0233a79..73d9c13 100644 (file)
@@ -1,3 +1,7 @@
+2004-08-12  Devang patel  <dpatel@apple.com>
+
+       * gcc.dg/darwin-20040809-2.c: New test.
+       
 2004-08-12  Janis Johnson  <janis1872us.ibm.com>
 
        * g++.dg/ext/altivec-12.C: New test.
diff --git a/gcc/testsuite/gcc.dg/darwin-20040809-2.c b/gcc/testsuite/gcc.dg/darwin-20040809-2.c
new file mode 100644 (file)
index 0000000..5ed27a4
--- /dev/null
@@ -0,0 +1,15 @@
+/* Test dead code strip support.  */
+/* Contributed by Devang Patel  <dpatel@apple.com>  */
+
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-g -fno-eliminate-unused-debug-symbols" } */
+
+int
+main ()
+{
+  return 0;
+}
+
+/* { dg-final { scan-assembler ".stabd.46,0,0" } } */
+/* { dg-final { scan-assembler ".stabd.78,0,0" } } */
+