diff mbox series

DWARF: Call set_indirect_string on DW_MACINFO_start_file

Message ID 20180822193624.GA22426@intel.com
State New
Headers show
Series DWARF: Call set_indirect_string on DW_MACINFO_start_file | expand

Commit Message

H.J. Lu Aug. 22, 2018, 7:36 p.m. UTC
Since -gsplit-dwarf -g3 will output filename as indirect string, call
set_indirect_string on DW_MACINFO_start_file for -gsplit-dwarf -g3.

OK for trunk?

H.J.
--
	PR debug/79342
	* dwarf2out.c (save_macinfo_strings): Call set_indirect_string
	on DW_MACINFO_start_file for -gsplit-dwarf -g3
---
 gcc/dwarf2out.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Richard Biener Aug. 23, 2018, 12:56 p.m. UTC | #1
On Wed, Aug 22, 2018 at 9:36 PM H.J. Lu <hongjiu.lu@intel.com> wrote:
>
> Since -gsplit-dwarf -g3 will output filename as indirect string, call
> set_indirect_string on DW_MACINFO_start_file for -gsplit-dwarf -g3.
>
> OK for trunk?

Can you add a testcase?

Richard.

> H.J.
> --
>         PR debug/79342
>         * dwarf2out.c (save_macinfo_strings): Call set_indirect_string
>         on DW_MACINFO_start_file for -gsplit-dwarf -g3
> ---
>  gcc/dwarf2out.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index edf1ac35896..6ae0a4d66b4 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -28280,6 +28280,12 @@ save_macinfo_strings (void)
>                  && (debug_str_section->common.flags & SECTION_MERGE) != 0)
>                set_indirect_string (find_AT_string (ref->info));
>              break;
> +         case DW_MACINFO_start_file:
> +           /* -gsplit-dwarf -g3 will also output filename as indirect
> +              string.  */
> +           if (!dwarf_split_debug_info)
> +             break;
> +           /* Fall through. */
>           case DW_MACRO_define_strp:
>           case DW_MACRO_undef_strp:
>              set_indirect_string (find_AT_string (ref->info));
> --
> 2.17.1
>
H.J. Lu Aug. 23, 2018, 2:38 p.m. UTC | #2
On Thu, Aug 23, 2018 at 5:56 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Wed, Aug 22, 2018 at 9:36 PM H.J. Lu <hongjiu.lu@intel.com> wrote:
>>
>> Since -gsplit-dwarf -g3 will output filename as indirect string, call
>> set_indirect_string on DW_MACINFO_start_file for -gsplit-dwarf -g3.
>>
>> OK for trunk?
>
> Can you add a testcase?
>
>

Here is the updated patch with a testcase.  Before my fix:

/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -m32
-O2 -fno-var-tracking-assignments -gsplit-dwarf -g3 -march=skylake
-mrtm -mabm -S x.c
x.c:14:1: internal compiler error: in output_index_string, at dwarf2out.c:28780
14 | }
   | ^
0xb090e7 output_index_string(indirect_string_node**, unsigned int*)
/export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:28780
0xb09370 output_indirect_strings
/export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:28868
0xb0ed85 dwarf2out_finish
/export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:31563
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

After:

/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -m32
-O2 -fno-var-tracking-assignments -gsplit-dwarf -g3 -march=skylake
-mrtm -mabm -S x.c

OK for trunk?

Thanks.
Richard Biener Aug. 24, 2018, 9:02 a.m. UTC | #3
On Thu, Aug 23, 2018 at 4:38 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Aug 23, 2018 at 5:56 AM, Richard Biener
> <richard.guenther@gmail.com> wrote:
> > On Wed, Aug 22, 2018 at 9:36 PM H.J. Lu <hongjiu.lu@intel.com> wrote:
> >>
> >> Since -gsplit-dwarf -g3 will output filename as indirect string, call
> >> set_indirect_string on DW_MACINFO_start_file for -gsplit-dwarf -g3.
> >>
> >> OK for trunk?
> >
> > Can you add a testcase?
> >
> >
>
> Here is the updated patch with a testcase.  Before my fix:
>
> /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
> -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -m32
> -O2 -fno-var-tracking-assignments -gsplit-dwarf -g3 -march=skylake
> -mrtm -mabm -S x.c
> x.c:14:1: internal compiler error: in output_index_string, at dwarf2out.c:28780
> 14 | }
>    | ^
> 0xb090e7 output_index_string(indirect_string_node**, unsigned int*)
> /export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:28780
> 0xb09370 output_indirect_strings
> /export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:28868
> 0xb0ed85 dwarf2out_finish
> /export/gnu/import/git/sources/gcc/gcc/dwarf2out.c:31563
> Please submit a full bug report,
> with preprocessed source if appropriate.
> Please include the complete backtrace with any bug report.
> See <https://gcc.gnu.org/bugs/> for instructions.
>
> After:
>
> /export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/xgcc
> -B/export/build/gnu/tools-build/gcc-debug/build-x86_64-linux/gcc/ -m32
> -O2 -fno-var-tracking-assignments -gsplit-dwarf -g3 -march=skylake
> -mrtm -mabm -S x.c
>
> OK for trunk?

OK.

Richard.

> Thanks.
>
> --
> H.J.
diff mbox series

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index edf1ac35896..6ae0a4d66b4 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -28280,6 +28280,12 @@  save_macinfo_strings (void)
                 && (debug_str_section->common.flags & SECTION_MERGE) != 0)
               set_indirect_string (find_AT_string (ref->info));
             break;
+	  case DW_MACINFO_start_file:
+	    /* -gsplit-dwarf -g3 will also output filename as indirect
+	       string.  */
+	    if (!dwarf_split_debug_info)
+	      break;
+	    /* Fall through. */
 	  case DW_MACRO_define_strp:
 	  case DW_MACRO_undef_strp:
             set_indirect_string (find_AT_string (ref->info));