Use add_partial_symbol in load_partial_dies
authorTom Tromey <tromey@adacore.com>
Wed, 27 May 2020 17:48:18 +0000 (11:48 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 27 May 2020 17:48:19 +0000 (11:48 -0600)
An earlier patch added the add_partial_symbol helper function to
dwarf2/read.c.  However, a couple of calls to add_psymbol_to_list were
left in place.  It turns out that these calls slow down partial symbol
reading, because they still go via the path that tries to needlessly
demangle already-demangled names.

This patch improves the performance of partial symbol reading by
changing this code to use add_partial_symbol instead.

The run previous to this had times of (see the first patch in the
series for an explanation):

gdb    1.64
libxul 1.99
Ada    2.47

This patch improves the times to:

gdb    1.47
libxul 1.89
Ada    2.39

gdb/ChangeLog
2020-05-27  Tom Tromey  <tromey@adacore.com>

* dwarf2/read.c (load_partial_dies): Use add_partial_symbol.

gdb/ChangeLog
gdb/dwarf2/read.c

index 2548ccdbf633e5b57f0de6ea72ef948fdee593da..90577b7e61eb34431558856c84a258d63991dcf4 100644 (file)
@@ -1,3 +1,7 @@
+2020-05-27  Tom Tromey  <tromey@adacore.com>
+
+       * dwarf2/read.c (load_partial_dies): Use add_partial_symbol.
+
 2020-05-27  Tom Tromey  <tromey@adacore.com>
 
        * dwarf2/abbrev.h (struct abbrev_table) <lookup_abbrev>: Inline.
index 655338d2ef8ad55d6053f80d10e5320e6f9e5081..a62224c0be2ae87d0e8295019640677eef8b4ee9 100644 (file)
@@ -18358,10 +18358,8 @@ load_partial_dies (const struct die_reader_specs *reader,
              || pdi.tag == DW_TAG_subrange_type))
        {
          if (building_psymtab && pdi.raw_name != NULL)
-           add_psymbol_to_list (pdi.name (cu), false,
-                                VAR_DOMAIN, LOC_TYPEDEF, -1,
-                                psymbol_placement::STATIC,
-                                0, cu->language, objfile);
+           add_partial_symbol (&pdi, cu);
+
          info_ptr = locate_pdi_sibling (reader, &pdi, info_ptr);
          continue;
        }
@@ -18392,12 +18390,7 @@ load_partial_dies (const struct die_reader_specs *reader,
          if (pdi.raw_name == NULL)
            complaint (_("malformed enumerator DIE ignored"));
          else if (building_psymtab)
-           add_psymbol_to_list (pdi.name (cu), false,
-                                VAR_DOMAIN, LOC_CONST, -1,
-                                cu->language == language_cplus
-                                ? psymbol_placement::GLOBAL
-                                : psymbol_placement::STATIC,
-                                0, cu->language, objfile);
+           add_partial_symbol (&pdi, cu);
 
          info_ptr = locate_pdi_sibling (reader, &pdi, info_ptr);
          continue;