summaryrefslogtreecommitdiff
path: root/gcc/sdbout.c
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 /gcc/sdbout.c
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
Diffstat (limited to 'gcc/sdbout.c')
-rw-r--r--gcc/sdbout.c69
1 files changed, 69 insertions, 0 deletions
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 */