Commit 68317985 by Richard Biener Committed by Richard Biener

debug.h (gcc_debug_hooks): Add filename parameter to early_finish hook.

2016-09-20  Richard Biener  <rguenther@suse.de>

	* debug.h (gcc_debug_hooks): Add filename parameter to early_finish
	hook.
	* debug.c (do_nothing_debug_hooks): Adjust.
	* dbxout.c (dbx_debug_hooks): Likewise.
	* sdbout.c (sdb_debug_hooks): Likewise.
	* dwarf2out.c (dwarf2_lineno_debug_hooks): Likewise.
	(dwarf2out_finish): Move producer, filename and
	path annotation ...
	(dwarf2out_early_finish): ... here.  Remove in_lto_p special-casing.
	* cgraphunit.c (symbol_table::finalize_compilation_unit): Adjust.

	lto/
	* lto.c (lto_main): Call early_finish with "<artificial>" as
	filename.

From-SVN: r240255
parent b7871393
2016-09-20 Richard Biener <rguenther@suse.de>
* debug.h (gcc_debug_hooks): Add filename parameter to early_finish
hook.
* debug.c (do_nothing_debug_hooks): Adjust.
* dbxout.c (dbx_debug_hooks): Likewise.
* sdbout.c (sdb_debug_hooks): Likewise.
* dwarf2out.c (dwarf2_lineno_debug_hooks): Likewise.
(dwarf2out_finish): Move producer, filename and
path annotation ...
(dwarf2out_early_finish): ... here. Remove in_lto_p special-casing.
* cgraphunit.c (symbol_table::finalize_compilation_unit): Adjust.
2016-09-19 Bernd Edlinger <bernd.edlinger@hotmail.de> 2016-09-19 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/77434 PR c++/77434
......
...@@ -2561,7 +2561,7 @@ symbol_table::finalize_compilation_unit (void) ...@@ -2561,7 +2561,7 @@ symbol_table::finalize_compilation_unit (void)
/* Clean up anything that needs cleaning up after initial debug /* Clean up anything that needs cleaning up after initial debug
generation. */ generation. */
(*debug_hooks->early_finish) (); (*debug_hooks->early_finish) (main_input_filename);
} }
/* Finally drive the pass manager. */ /* Finally drive the pass manager. */
......
...@@ -344,7 +344,7 @@ const struct gcc_debug_hooks dbx_debug_hooks = ...@@ -344,7 +344,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
{ {
dbxout_init, dbxout_init,
dbxout_finish, dbxout_finish,
debug_nothing_void, debug_nothing_charstar,
debug_nothing_void, debug_nothing_void,
debug_nothing_int_charstar, debug_nothing_int_charstar,
debug_nothing_int_charstar, debug_nothing_int_charstar,
......
...@@ -26,7 +26,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks = ...@@ -26,7 +26,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
{ {
debug_nothing_charstar, debug_nothing_charstar,
debug_nothing_charstar, debug_nothing_charstar,
debug_nothing_void, /* early_finish */ debug_nothing_charstar, /* early_finish */
debug_nothing_void, debug_nothing_void,
debug_nothing_int_charstar, debug_nothing_int_charstar,
debug_nothing_int_charstar, debug_nothing_int_charstar,
......
...@@ -31,7 +31,7 @@ struct gcc_debug_hooks ...@@ -31,7 +31,7 @@ struct gcc_debug_hooks
void (* finish) (const char *main_filename); void (* finish) (const char *main_filename);
/* Run cleanups necessary after early debug generation. */ /* Run cleanups necessary after early debug generation. */
void (* early_finish) (void); void (* early_finish) (const char *main_filename);
/* Called from cgraph_optimize before starting to assemble /* Called from cgraph_optimize before starting to assemble
functions/variables/toplevel asms. */ functions/variables/toplevel asms. */
......
...@@ -2480,7 +2480,7 @@ build_cfa_aligned_loc (dw_cfa_location *cfa, ...@@ -2480,7 +2480,7 @@ build_cfa_aligned_loc (dw_cfa_location *cfa,
static void dwarf2out_init (const char *); static void dwarf2out_init (const char *);
static void dwarf2out_finish (const char *); static void dwarf2out_finish (const char *);
static void dwarf2out_early_finish (void); static void dwarf2out_early_finish (const char *);
static void dwarf2out_assembly_start (void); static void dwarf2out_assembly_start (void);
static void dwarf2out_define (unsigned int, const char *); static void dwarf2out_define (unsigned int, const char *);
static void dwarf2out_undef (unsigned int, const char *); static void dwarf2out_undef (unsigned int, const char *);
...@@ -2556,7 +2556,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks = ...@@ -2556,7 +2556,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
{ {
dwarf2out_init, dwarf2out_init,
debug_nothing_charstar, debug_nothing_charstar,
debug_nothing_void, debug_nothing_charstar,
debug_nothing_void, debug_nothing_void,
debug_nothing_int_charstar, debug_nothing_int_charstar,
debug_nothing_int_charstar, debug_nothing_int_charstar,
...@@ -27804,7 +27804,7 @@ flush_limbo_die_list (void) ...@@ -27804,7 +27804,7 @@ flush_limbo_die_list (void)
and generate the DWARF-2 debugging info. */ and generate the DWARF-2 debugging info. */
static void static void
dwarf2out_finish (const char *filename) dwarf2out_finish (const char *)
{ {
comdat_type_node *ctnode; comdat_type_node *ctnode;
dw_die_ref main_comp_unit_die; dw_die_ref main_comp_unit_die;
...@@ -27816,34 +27816,8 @@ dwarf2out_finish (const char *filename) ...@@ -27816,34 +27816,8 @@ dwarf2out_finish (const char *filename)
DIEs generated after early finish. */ DIEs generated after early finish. */
gcc_assert (deferred_asm_name == NULL); gcc_assert (deferred_asm_name == NULL);
/* PCH might result in DW_AT_producer string being restored from the
header compilation, so always fill it with empty string initially
and overwrite only here. */
dw_attr_node *producer = get_AT (comp_unit_die (), DW_AT_producer);
producer_string = gen_producer_string ();
producer->dw_attr_val.v.val_str->refcount--;
producer->dw_attr_val.v.val_str = find_AT_string (producer_string);
gen_remaining_tmpl_value_param_die_attribute (); gen_remaining_tmpl_value_param_die_attribute ();
/* Add the name for the main input file now. We delayed this from
dwarf2out_init to avoid complications with PCH.
For LTO produced units use a fixed artificial name to avoid
leaking tempfile names into the dwarf. */
if (!in_lto_p)
add_name_attribute (comp_unit_die (), remap_debug_filename (filename));
else
add_name_attribute (comp_unit_die (), "<artificial>");
if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir)
add_comp_dir_attribute (comp_unit_die ());
else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL)
{
bool p = false;
file_table->traverse<bool *, file_table_relative_p> (&p);
if (p)
add_comp_dir_attribute (comp_unit_die ());
}
#if ENABLE_ASSERT_CHECKING #if ENABLE_ASSERT_CHECKING
{ {
dw_die_ref die = comp_unit_die (), c; dw_die_ref die = comp_unit_die (), c;
...@@ -28151,10 +28125,31 @@ dwarf2out_finish (const char *filename) ...@@ -28151,10 +28125,31 @@ dwarf2out_finish (const char *filename)
has run. */ has run. */
static void static void
dwarf2out_early_finish (void) dwarf2out_early_finish (const char *filename)
{ {
set_early_dwarf s; set_early_dwarf s;
/* PCH might result in DW_AT_producer string being restored from the
header compilation, so always fill it with empty string initially
and overwrite only here. */
dw_attr_node *producer = get_AT (comp_unit_die (), DW_AT_producer);
producer_string = gen_producer_string ();
producer->dw_attr_val.v.val_str->refcount--;
producer->dw_attr_val.v.val_str = find_AT_string (producer_string);
/* Add the name for the main input file now. We delayed this from
dwarf2out_init to avoid complications with PCH. */
add_name_attribute (comp_unit_die (), remap_debug_filename (filename));
if (!IS_ABSOLUTE_PATH (filename) || targetm.force_at_comp_dir)
add_comp_dir_attribute (comp_unit_die ());
else if (get_AT (comp_unit_die (), DW_AT_comp_dir) == NULL)
{
bool p = false;
file_table->traverse<bool *, file_table_relative_p> (&p);
if (p)
add_comp_dir_attribute (comp_unit_die ());
}
/* With LTO early dwarf was really finished at compile-time, so make /* With LTO early dwarf was really finished at compile-time, so make
sure to adjust the phase after annotating the LTRANS CU DIE. */ sure to adjust the phase after annotating the LTRANS CU DIE. */
if (in_lto_p) if (in_lto_p)
......
2016-09-20 Richard Biener <rguenther@suse.de>
* lto.c (lto_main): Call early_finish with "<artificial>" as
filename.
2016-09-19 Richard Biener <rguenther@suse.de> 2016-09-19 Richard Biener <rguenther@suse.de>
* lto.c (lto_main): Invoke early_finish debug hook. * lto.c (lto_main): Invoke early_finish debug hook.
......
...@@ -3316,7 +3316,7 @@ lto_main (void) ...@@ -3316,7 +3316,7 @@ lto_main (void)
lto_promote_statics_nonwpa (); lto_promote_statics_nonwpa ();
/* Annotate the CU DIE and mark the early debug phase as finished. */ /* Annotate the CU DIE and mark the early debug phase as finished. */
debug_hooks->early_finish (); debug_hooks->early_finish ("<artificial>");
/* Let the middle end know that we have read and merged all of /* Let the middle end know that we have read and merged all of
the input files. */ the input files. */
......
...@@ -277,7 +277,7 @@ const struct gcc_debug_hooks sdb_debug_hooks = ...@@ -277,7 +277,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
{ {
sdbout_init, /* init */ sdbout_init, /* init */
sdbout_finish, /* finish */ sdbout_finish, /* finish */
debug_nothing_void, /* early_finish */ debug_nothing_charstar, /* early_finish */
debug_nothing_void, /* assembly_start */ debug_nothing_void, /* assembly_start */
debug_nothing_int_charstar, /* define */ debug_nothing_int_charstar, /* define */
debug_nothing_int_charstar, /* undef */ debug_nothing_int_charstar, /* undef */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment