summaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 208798f0dc7..ec490d75bd1 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2641,6 +2641,89 @@ symbol_table::compile (void)
}
}
+/* Earlydebug dump file, flags, and number. */
+
+static int debuginfo_early_dump_nr;
+static FILE *debuginfo_early_dump_file;
+static dump_flags_t debuginfo_early_dump_flags;
+
+/* Debug dump file, flags, and number. */
+
+static int debuginfo_dump_nr;
+static FILE *debuginfo_dump_file;
+static dump_flags_t debuginfo_dump_flags;
+
+/* Register the debug and earlydebug dump files. */
+
+void
+debuginfo_early_init (void)
+{
+ gcc::dump_manager *dumps = g->get_dumps ();
+ debuginfo_early_dump_nr = dumps->dump_register (".earlydebug", "earlydebug",
+ "earlydebug", DK_tree,
+ OPTGROUP_NONE,
+ false);
+ debuginfo_dump_nr = dumps->dump_register (".debug", "debug",
+ "debug", DK_tree,
+ OPTGROUP_NONE,
+ false);
+}
+
+/* Initialize the debug and earlydebug dump files. */
+
+void
+debuginfo_init (void)
+{
+ gcc::dump_manager *dumps = g->get_dumps ();
+ debuginfo_dump_file = dump_begin (debuginfo_dump_nr, NULL);
+ debuginfo_dump_flags = dumps->get_dump_file_info (debuginfo_dump_nr)->pflags;
+ debuginfo_early_dump_file = dump_begin (debuginfo_early_dump_nr, NULL);
+ debuginfo_early_dump_flags
+ = dumps->get_dump_file_info (debuginfo_early_dump_nr)->pflags;
+}
+
+/* Finalize the debug and earlydebug dump files. */
+
+void
+debuginfo_fini (void)
+{
+ if (debuginfo_dump_file)
+ dump_end (debuginfo_dump_nr, debuginfo_dump_file);
+ if (debuginfo_early_dump_file)
+ dump_end (debuginfo_early_dump_nr, debuginfo_early_dump_file);
+}
+
+/* Set dump_file to the debug dump file. */
+
+void
+debuginfo_start (void)
+{
+ set_dump_file (debuginfo_dump_file);
+}
+
+/* Undo setting dump_file to the debug dump file. */
+
+void
+debuginfo_stop (void)
+{
+ set_dump_file (NULL);
+}
+
+/* Set dump_file to the earlydebug dump file. */
+
+void
+debuginfo_early_start (void)
+{
+ set_dump_file (debuginfo_early_dump_file);
+}
+
+/* Undo setting dump_file to the earlydebug dump file. */
+
+void
+debuginfo_early_stop (void)
+{
+ set_dump_file (NULL);
+}
/* Analyze the whole compilation unit once it is parsed completely. */
@@ -2696,7 +2779,9 @@ symbol_table::finalize_compilation_unit (void)
/* Clean up anything that needs cleaning up after initial debug
generation. */
+ debuginfo_early_start ();
(*debug_hooks->early_finish) (main_input_filename);
+ debuginfo_early_stop ();
}
/* Finally drive the pass manager. */