diff mbox

Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations (was: [PATCH] Refactor section/label init for early LTO debug)

Message ID 87lgycnzne.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge Sept. 28, 2016, 9:26 a.m. UTC
Hi!

On Tue, 27 Sep 2016 12:34:46 +0200 (CEST), Richard Biener <rguenther@suse.de> wrote:
> --- gcc/dwarf2out.c     (revision 240521)
> +++ gcc/dwarf2out.c     (working copy)
> @@ -25657,14 +25687,6 @@ dwarf2out_init (const char *filename ATT
>      vec_alloc (macinfo_table, 64);
>  #endif
>  
> -  /* Make sure the line number table for .text always exists.  */
> -  text_section_line_info = new_line_info_table ();
> -  text_section_line_info->end_label = text_end_label;
> -
> -#ifdef DWARF2_LINENO_DEBUGGING_INFO
> -  cur_line_info_table = text_section_line_info;
> -#endif
> -
>    /* If front-ends already registered a main translation unit but we were 
> not
>       ready to perform the association, do this now.  */
>    if (main_translation_unit != NULL_TREE)
> @@ -25688,6 +25710,14 @@ dwarf2out_assembly_start (void)
>    ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
>  #endif
>  
> +  /* Make sure the line number table for .text always exists.  */
> +  text_section_line_info = new_line_info_table ();
> +  text_section_line_info->end_label = text_end_label;
> +
> +#ifdef DWARF2_LINENO_DEBUGGING_INFO
> +  cur_line_info_table = text_section_line_info;
> +#endif
> +
>    if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
>        && dwarf2out_do_cfi_asm ()
>        && (!(flag_unwind_tables || flag_exceptions)

(This got committed in r240545.)  For DWARF2_LINENO_DEBUGGING_INFO
configurations (that is, nvptx; Bernd CCed, who originally authored the
DWARF2_LINENO_DEBUGGING_INFO support), this breaks things because of
uninitialized text_section_line_info/cur_line_info_table.  OK to fix as
follows?

commit e745307ac5a90e999133dfeeee21139526230e81
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Wed Sep 28 10:55:23 2016 +0200

    Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations
    
    	gcc/
    	* dwarf2out.c (dwarf2_lineno_debug_hooks): Use
    	dwarf2out_assembly_start.
---
 gcc/dwarf2out.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



Grüße
 Thomas

Comments

Richard Biener Sept. 28, 2016, 9:28 a.m. UTC | #1
On Wed, 28 Sep 2016, Thomas Schwinge wrote:

> Hi!
> 
> On Tue, 27 Sep 2016 12:34:46 +0200 (CEST), Richard Biener <rguenther@suse.de> wrote:
> > --- gcc/dwarf2out.c     (revision 240521)
> > +++ gcc/dwarf2out.c     (working copy)
> > @@ -25657,14 +25687,6 @@ dwarf2out_init (const char *filename ATT
> >      vec_alloc (macinfo_table, 64);
> >  #endif
> >  
> > -  /* Make sure the line number table for .text always exists.  */
> > -  text_section_line_info = new_line_info_table ();
> > -  text_section_line_info->end_label = text_end_label;
> > -
> > -#ifdef DWARF2_LINENO_DEBUGGING_INFO
> > -  cur_line_info_table = text_section_line_info;
> > -#endif
> > -
> >    /* If front-ends already registered a main translation unit but we were 
> > not
> >       ready to perform the association, do this now.  */
> >    if (main_translation_unit != NULL_TREE)
> > @@ -25688,6 +25710,14 @@ dwarf2out_assembly_start (void)
> >    ASM_OUTPUT_LABEL (asm_out_file, text_section_label);
> >  #endif
> >  
> > +  /* Make sure the line number table for .text always exists.  */
> > +  text_section_line_info = new_line_info_table ();
> > +  text_section_line_info->end_label = text_end_label;
> > +
> > +#ifdef DWARF2_LINENO_DEBUGGING_INFO
> > +  cur_line_info_table = text_section_line_info;
> > +#endif
> > +
> >    if (HAVE_GAS_CFI_SECTIONS_DIRECTIVE
> >        && dwarf2out_do_cfi_asm ()
> >        && (!(flag_unwind_tables || flag_exceptions)
> 
> (This got committed in r240545.)  For DWARF2_LINENO_DEBUGGING_INFO
> configurations (that is, nvptx; Bernd CCed, who originally authored the
> DWARF2_LINENO_DEBUGGING_INFO support), this breaks things because of
> uninitialized text_section_line_info/cur_line_info_table.  OK to fix as
> follows?

Ok.

Richard.

> commit e745307ac5a90e999133dfeeee21139526230e81
> Author: Thomas Schwinge <thomas@codesourcery.com>
> Date:   Wed Sep 28 10:55:23 2016 +0200
> 
>     Un-break dwarf2out for DWARF2_LINENO_DEBUGGING_INFO configurations
>     
>     	gcc/
>     	* dwarf2out.c (dwarf2_lineno_debug_hooks): Use
>     	dwarf2out_assembly_start.
> ---
>  gcc/dwarf2out.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git gcc/dwarf2out.c gcc/dwarf2out.c
> index 51cab42..8c18c4c 100644
> --- gcc/dwarf2out.c
> +++ gcc/dwarf2out.c
> @@ -2539,7 +2539,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
>    dwarf2out_init,
>    debug_nothing_charstar,
>    debug_nothing_charstar,
> -  debug_nothing_void,
> +  dwarf2out_assembly_start,
>    debug_nothing_int_charstar,
>    debug_nothing_int_charstar,
>    debug_nothing_int_charstar,
>
diff mbox

Patch

diff --git gcc/dwarf2out.c gcc/dwarf2out.c
index 51cab42..8c18c4c 100644
--- gcc/dwarf2out.c
+++ gcc/dwarf2out.c
@@ -2539,7 +2539,7 @@  const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
   dwarf2out_init,
   debug_nothing_charstar,
   debug_nothing_charstar,
-  debug_nothing_void,
+  dwarf2out_assembly_start,
   debug_nothing_int_charstar,
   debug_nothing_int_charstar,
   debug_nothing_int_charstar,