diff mbox

[Google,4.7] Fix for Google Ref: b/8028506 (issue7142053)

Message ID 20130118184528.97A18A1657@sterling.mtv.corp.google.com
State New
Headers show

Commit Message

Sterling Augustine Jan. 18, 2013, 6:45 p.m. UTC
commit dc0b9bc855444332e7a3b1f3473a70ce0c72d66c
Author: Sterling Augustine <saugustine@google.com>
Date:   Fri Jan 18 10:38:30 2013 -0800

    Fix for Google Ref: b/8028506
    
    Calling find_AT_string can resize the debug_str hash table, even if the
    string is already present in the hash table--go figure.  So after indices
    have been assigned, and the hash table is exactly three-quarters full,
    calling find_AT_string is verboten.
    
    This change moves some calls around such that the above scenario never
    happens, all strings will be found and assigned prior to indices being
    assigned.

M	gcc/dwarf2out.c

Tested:
    With full bootstrap and fission testing.

--
This patch is available for review at http://codereview.appspot.com/7142053

Comments

Cary Coutant Jan. 18, 2013, 7:04 p.m. UTC | #1
> commit dc0b9bc855444332e7a3b1f3473a70ce0c72d66c
> Author: Sterling Augustine <saugustine@google.com>
> Date:   Fri Jan 18 10:38:30 2013 -0800
>
>     Fix for Google Ref: b/8028506
>
>     Calling find_AT_string can resize the debug_str hash table, even if the
>     string is already present in the hash table--go figure.  So after indices
>     have been assigned, and the hash table is exactly three-quarters full,
>     calling find_AT_string is verboten.
>
>     This change moves some calls around such that the above scenario never
>     happens, all strings will be found and assigned prior to indices being
>     assigned.
>
> M       gcc/dwarf2out.c

OK for google/gcc-4_7.

I'll be filing an upstream bug for this problem, and I'd like to get
this fix into 4.8 as well.

-cary
Sterling Augustine Jan. 18, 2013, 9:50 p.m. UTC | #2
On Fri, Jan 18, 2013 at 11:04 AM, Cary Coutant <ccoutant@google.com> wrote:
>> commit dc0b9bc855444332e7a3b1f3473a70ce0c72d66c
>> Author: Sterling Augustine <saugustine@google.com>
>> Date:   Fri Jan 18 10:38:30 2013 -0800
>>
>>     Fix for Google Ref: b/8028506
>>
>>     Calling find_AT_string can resize the debug_str hash table, even if the
>>     string is already present in the hash table--go figure.  So after indices
>>     have been assigned, and the hash table is exactly three-quarters full,
>>     calling find_AT_string is verboten.
>>
>>     This change moves some calls around such that the above scenario never
>>     happens, all strings will be found and assigned prior to indices being
>>     assigned.
>>
>> M       gcc/dwarf2out.c
>
> OK for google/gcc-4_7.
>
> I'll be filing an upstream bug for this problem, and I'd like to get
> this fix into 4.8 as well.
>
> -cary

Committed as posted. Thanks. These do need to go into trunk, as they
complicate using fission.

Sterling
diff mbox

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 5ca22b2..5099c39 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -9407,9 +9407,6 @@  output_skeleton_debug_sections (dw_die_ref comp_unit)
   remove_AT (comp_unit, DW_AT_producer);
   remove_AT (comp_unit, DW_AT_language);
 
-  /* Add attributes common to skeleton compile_units and type_units.  */
-  add_top_level_skeleton_die_attrs (comp_unit);
-
   switch_to_section (debug_skeleton_info_section);
   ASM_OUTPUT_LABEL (asm_out_file, debug_skeleton_info_section_label);
 
@@ -24087,6 +24084,10 @@  dwarf2out_finish (const char *filename)
   if (dwarf_split_debug_info)
     {
       unsigned int index = 0;
+      /* Before we assign string indexes, we need to add the string
+	 attributes to the skeleton compile unit and type units.  */
+      add_top_level_skeleton_die_attrs (main_comp_unit_die);
+      (void) get_skeleton_type_unit ();
       htab_traverse_noresize (debug_str_hash, index_string, &index);
     }