aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <dje@gnu.org>1996-11-15 22:37:40 +0000
committerDoug Evans <dje@gnu.org>1996-11-15 22:37:40 +0000
commitcc694a8150db5f0cc607aba151150e8a77cedf49 (patch)
tree4505494c3394c62e861b72b346a4107427f33ffc
parent6619df077de9c3f535607deb2f87c07f65e1d6dc (diff)
downloadgcc-cc694a8150db5f0cc607aba151150e8a77cedf49.zip
gcc-cc694a8150db5f0cc607aba151150e8a77cedf49.tar.gz
gcc-cc694a8150db5f0cc607aba151150e8a77cedf49.tar.bz2
sdbout.c (current_file): New global.
* sdbout.c (current_file): New global. (PUT_SDB_SRC_FILE): New PUT_SDB_FOO macro. (sdbout_init): Initialize current_file ifdef MIPS_DEBUGGING_INFO. (sdbout_{start_new,resume_previous}_source_file): New functions. * toplev.c (debug_{start,end}_source_file): Call them if SDB_DEBUG. * mips/mips.h (PUT_SDB_SRC_FILE): Define. From-SVN: r13179
-rw-r--r--gcc/config/mips/mips.h6
-rw-r--r--gcc/sdbout.c69
-rw-r--r--gcc/toplev.c8
3 files changed, 83 insertions, 0 deletions
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 112b658..0093ed5 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -1061,6 +1061,12 @@ do { \
#define PUT_SDB_EPILOGUE_END(NAME)
+#define PUT_SDB_SRC_FILE(FILENAME) \
+do { \
+ extern FILE *asm_out_text_file; \
+ output_file_directive (asm_out_text_file, (FILENAME)); \
+} while (0)
+
#define SDB_GENERATE_FAKE(BUFFER, NUMBER) \
sprintf ((BUFFER), ".%dfake", (NUMBER));
diff --git a/gcc/sdbout.c b/gcc/sdbout.c
index 9a3ab92..788061c 100644
--- a/gcc/sdbout.c
+++ b/gcc/sdbout.c
@@ -288,6 +288,38 @@ do { fprintf (asm_out_file, "\t.def\t"); \
/* Ensure we don't output a negative line number. */
#define MAKE_LINE_SAFE(line) \
if (line <= sdb_begin_function_line) line = sdb_begin_function_line + 1
+
+/* Perform linker optimization of merging header file definitions together
+ for targets with MIPS_DEBUGGING_INFO defined. This won't work without a
+ post 960826 version of GAS. Nothing breaks with earlier versions of GAS,
+ the optimization just won't be done. The native assembler already has the
+ necessary support. */
+
+#ifdef MIPS_DEBUGGING_INFO
+
+#ifndef PUT_SDB_SRC_FILE
+#define PUT_SDB_SRC_FILE(FILENAME) \
+output_file_directive (asm_out_file, (FILENAME))
+#endif
+
+/* ECOFF linkers have an optimization that does the same kind of thing as
+ N_BINCL/E_INCL in stabs: eliminate duplicate debug information in the
+ executable. To achieve this, GCC must output a .file for each file
+ name change. */
+
+/* This is a stack of input files. */
+
+struct sdb_file
+{
+ struct sdb_file *next;
+ char *name;
+};
+
+/* This is the top of the stack. */
+
+static struct sdb_file *current_file;
+
+#endif /* MIPS_DEBUGGING_INFO */
/* Set up for SDB output at the start of compilation. */
@@ -297,6 +329,12 @@ sdbout_init (asm_file, input_file_name, syms)
char *input_file_name;
tree syms;
{
+#ifdef MIPS_DEBUGGING_INFO
+ current_file = (struct sdb_file *) xmalloc (sizeof *current_file);
+ current_file->next = NULL;
+ current_file->name = input_file_name;
+#endif
+
#ifdef RMS_QUICK_HACK_1
tree t;
for (t = syms; t; t = TREE_CHAIN (t))
@@ -1556,4 +1594,35 @@ sdbout_label (insn)
PUT_SDB_ENDEF;
}
+/* Change to reading from a new source file. */
+
+void
+sdbout_start_new_source_file (filename)
+ char *filename;
+{
+#ifdef MIPS_DEBUGGING_INFO
+ struct sdb_file *n = (struct sdb_file *) xmalloc (sizeof *n);
+
+ n->next = current_file;
+ n->name = filename;
+ current_file = n;
+ PUT_SDB_SRC_FILE (filename);
+#endif
+}
+
+/* Revert to reading a previous source file. */
+
+void
+sdbout_resume_previous_source_file ()
+{
+#ifdef MIPS_DEBUGGING_INFO
+ struct sdb_file *next;
+
+ next = current_file->next;
+ free (current_file);
+ current_file = next;
+ PUT_SDB_SRC_FILE (current_file->name);
+#endif
+}
+
#endif /* SDB_DEBUGGING_INFO */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index a08b598..6a67d03 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -4323,6 +4323,10 @@ debug_start_source_file (filename)
&& write_symbols == DWARF2_DEBUG)
dwarf2out_start_source_file (filename);
#endif /* DWARF2_DEBUGGING_INFO */
+#ifdef SDB_DEBUGGING_INFO
+ if (write_symbols == SDB_DEBUG)
+ sdbout_start_new_source_file (filename);
+#endif
}
/* Record the resumption of a source file. LINENO is the line number in
@@ -4346,6 +4350,10 @@ debug_end_source_file (lineno)
&& write_symbols == DWARF2_DEBUG)
dwarf2out_end_source_file ();
#endif /* DWARF2_DEBUGGING_INFO */
+#ifdef SDB_DEBUGGING_INFO
+ if (write_symbols == SDB_DEBUG)
+ sdbout_resume_previous_source_file ();
+#endif
}
/* Called from check_newline in c-parse.y. The `buffer' parameter contains