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
This commit is contained in:
Richard Biener 2016-09-20 07:37:53 +00:00 committed by Richard Biener
parent b78713939b
commit 6831798543
9 changed files with 49 additions and 36 deletions

View File

@ -1,3 +1,16 @@
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>
PR c++/77434

View File

@ -2561,7 +2561,7 @@ symbol_table::finalize_compilation_unit (void)
/* Clean up anything that needs cleaning up after initial debug
generation. */
(*debug_hooks->early_finish) ();
(*debug_hooks->early_finish) (main_input_filename);
}
/* Finally drive the pass manager. */

View File

@ -344,7 +344,7 @@ const struct gcc_debug_hooks dbx_debug_hooks =
{
dbxout_init,
dbxout_finish,
debug_nothing_void,
debug_nothing_charstar,
debug_nothing_void,
debug_nothing_int_charstar,
debug_nothing_int_charstar,

View File

@ -26,7 +26,7 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
{
debug_nothing_charstar,
debug_nothing_charstar,
debug_nothing_void, /* early_finish */
debug_nothing_charstar, /* early_finish */
debug_nothing_void,
debug_nothing_int_charstar,
debug_nothing_int_charstar,

View File

@ -31,7 +31,7 @@ struct gcc_debug_hooks
void (* finish) (const char *main_filename);
/* 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
functions/variables/toplevel asms. */

View File

@ -2480,7 +2480,7 @@ build_cfa_aligned_loc (dw_cfa_location *cfa,
static void dwarf2out_init (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_define (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 =
{
dwarf2out_init,
debug_nothing_charstar,
debug_nothing_void,
debug_nothing_charstar,
debug_nothing_void,
debug_nothing_int_charstar,
debug_nothing_int_charstar,
@ -27804,7 +27804,7 @@ flush_limbo_die_list (void)
and generate the DWARF-2 debugging info. */
static void
dwarf2out_finish (const char *filename)
dwarf2out_finish (const char *)
{
comdat_type_node *ctnode;
dw_die_ref main_comp_unit_die;
@ -27816,34 +27816,8 @@ dwarf2out_finish (const char *filename)
DIEs generated after early finish. */
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 ();
/* 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
{
dw_die_ref die = comp_unit_die (), c;
@ -28151,10 +28125,31 @@ dwarf2out_finish (const char *filename)
has run. */
static void
dwarf2out_early_finish (void)
dwarf2out_early_finish (const char *filename)
{
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
sure to adjust the phase after annotating the LTRANS CU DIE. */
if (in_lto_p)

View File

@ -1,3 +1,8 @@
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>
* lto.c (lto_main): Invoke early_finish debug hook.

View File

@ -3316,7 +3316,7 @@ lto_main (void)
lto_promote_statics_nonwpa ();
/* 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
the input files. */

View File

@ -277,7 +277,7 @@ const struct gcc_debug_hooks sdb_debug_hooks =
{
sdbout_init, /* init */
sdbout_finish, /* finish */
debug_nothing_void, /* early_finish */
debug_nothing_charstar, /* early_finish */
debug_nothing_void, /* assembly_start */
debug_nothing_int_charstar, /* define */
debug_nothing_int_charstar, /* undef */