summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>1996-11-15 22:37:40 +0000
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>1996-11-15 22:37:40 +0000
commit33d72caeb60149c4b270b4f0a809833d76f24e6e (patch)
tree4505494c3394c62e861b72b346a4107427f33ffc
parentce4974e03f74f743dbd4a646586166e4da0677b6 (diff)
downloadgcc-33d72caeb60149c4b270b4f0a809833d76f24e6e.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@13179 138bc75d-0d04-0410-961f-82ee72b054a4
-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 112b658028e..0093ed5bff1 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 9a3ab92f8df..788061c39da 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 a08b5987f66..6a67d03c6fa 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