Author: markj
Date: Wed Jun 26 16:38:30 2019
New Revision: 349424
URL: https://svnweb.freebsd.org/changeset/base/349424

Log:
  libdwarf: Use the cached strtab pointer when reading string attributes.
  
  Previously we would perform a linear search of the DWARF section
  list for ".debug_str".  However, libdwarf always caches a pointer to
  the strtab image in its debug descriptor.  Using it gives a modest
  performance improvement when iterating over the attributes of each
  DIE.
  
  Reviewed by:  emaste
  MFC after:    1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D20759

Modified:
  head/contrib/elftoolchain/libdwarf/libdwarf_attr.c

Modified: head/contrib/elftoolchain/libdwarf/libdwarf_attr.c
==============================================================================
--- head/contrib/elftoolchain/libdwarf/libdwarf_attr.c  Wed Jun 26 16:35:37 
2019        (r349423)
+++ head/contrib/elftoolchain/libdwarf/libdwarf_attr.c  Wed Jun 26 16:38:30 
2019        (r349424)
@@ -100,7 +100,6 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u
     uint64_t form, int indirect, Dwarf_Error *error)
 {
        struct _Dwarf_Attribute atref;
-       Dwarf_Section *str;
        int ret;
 
        ret = DW_DLE_NONE;
@@ -183,9 +182,7 @@ _dwarf_attr_init(Dwarf_Debug dbg, Dwarf_Section *ds, u
                break;
        case DW_FORM_strp:
                atref.u[0].u64 = dbg->read(ds->ds_data, offsetp, dwarf_size);
-               str = _dwarf_find_section(dbg, ".debug_str");
-               assert(str != NULL);
-               atref.u[1].s = (char *) str->ds_data + atref.u[0].u64;
+               atref.u[1].s = _dwarf_strtab_get_table(dbg) + atref.u[0].u64;
                break;
        case DW_FORM_ref_sig8:
                atref.u[0].u64 = 8;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to