public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] users/jkratoch/dwarf5gcc-indexcxx-debugnames: Merge branch 'dwarf5gcc-indexcxx' into dwarf5gcc-indexcxx-debugnames Date: Sun, 25 Dec 2016 16:57:00 -0000 [thread overview] Message-ID: <20161225165737.51580.qmail@sourceware.org> (raw) The branch, users/jkratoch/dwarf5gcc-indexcxx-debugnames has been updated via 844ada9b6a5230911df26ebb692839b15c462823 (commit) via 8f9fb12f5b33de7c6219500254ed37b901ab01e6 (commit) via fe67053b845cfe05d3063707c6896262e2084926 (commit) via 5ac952da2deb837686c10a52c179501294594b30 (commit) from 008befe725efec8e18eedc4200cfbe765affbc0e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 844ada9b6a5230911df26ebb692839b15c462823 Merge: fe67053 8f9fb12 Author: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Sun Dec 25 17:55:53 2016 +0100 Merge branch 'dwarf5gcc-indexcxx' into dwarf5gcc-indexcxx-debugnames commit fe67053b845cfe05d3063707c6896262e2084926 Author: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Sun Dec 25 17:47:06 2016 +0100 . commit 5ac952da2deb837686c10a52c179501294594b30 Author: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Sun Dec 25 17:20:13 2016 +0100 . ----------------------------------------------------------------------- Summary of changes: gdb/contrib/gdb-add-index.sh | 16 ++++++++-- gdb/dwarf2read.c | 63 ++++++++++++++++++++++++++++-------------- include/dwarf2.h | 5 ++- 3 files changed, 59 insertions(+), 25 deletions(-) First 500 lines of diff: diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh index cca7153..725aa65 100755 --- a/gdb/contrib/gdb-add-index.sh +++ b/gdb/contrib/gdb-add-index.sh @@ -38,10 +38,12 @@ fi dir="${file%/*}" test "$dir" = "$file" && dir="." index="${file}.gdb-index" +debugstr="${file}.debug_str" +debugstrmerge="${file}.debug_str.merge" -rm -f $index +rm -f $index $debugstr $debugstrmerge # Ensure intermediate index file is removed when we exit. -trap "rm -f $index" 0 +trap "rm -f $index $debugstr $debugstrmerge" 0 $GDB --batch -nx -iex 'set auto-load no' \ -ex "file $file" -ex "save gdb-index $dir" || { @@ -58,8 +60,16 @@ $GDB --batch -nx -iex 'set auto-load no' \ status=0 if test -f "$index"; then + # Older GDBs did not create: ${file}.debug_str + test ! -f "$debugstr" && touch "$debugstr" + $OBJCOPY --dump-section .debug_str="$debugstrmerge" "$file" /dev/null + cat "$debugstr" >>"$debugstrmerge" + $OBJCOPY --add-section .gdb_index="$index" \ - --set-section-flags .gdb_index=readonly "$file" "$file" + --set-section-flags .gdb_index=readonly \ + --update-section .debug_str="$debugstrmerge" \ + "$file" "$file" + status=$? else echo "$myname: No index was created for $file" 1>&2 diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 1608339..f3cf417 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -23193,6 +23193,15 @@ public: } }; +namespace std { + template<class T0,class T1> struct hash<pair<T0,T1>> { + size_t operator() (const pair<T0,T1> &key) const { + return std::hash<T0>() (key.first) + ^std::hash<T1>() (key.second); + } + }; +} + class DebugNamesNameTable { private: @@ -23201,8 +23210,9 @@ private: public: const char *name; int tag, cu_index; - Name(const char *name_, int tag_, int cu_index_) - :name(name_),tag(tag_),cu_index(cu_index_) + bool is_static; + Name(const char *name_, int tag_, int cu_index_, bool is_static_) + :name(name_), tag(tag_), cu_index(cu_index_), is_static (is_static_) {} }; std::unordered_multimap<uint32_t, Name> hash_to_name; @@ -23264,7 +23274,8 @@ private: DwarfTmpl<uint32_t> dwarf32; DwarfTmpl<uint64_t> dwarf64; OffsetVec &name_table_string_offs, &name_table_entry_offs; - std::unordered_set<int> tags_used; + std::unordered_map<std::pair<int, bool>, int> tag_isstatic_to_idx; + int idx_next = 1; DataBuf abbrev_table, entry_pool; DebugStrLookup debugstrlookup; static uint32_t @@ -23320,7 +23331,7 @@ public: { } void - insert (const partial_symbol *psym, int cu_index) + insert (const partial_symbol *psym, int cu_index, bool is_static) { const int tag (psymbol_tag (psym)); if (!tag) @@ -23328,7 +23339,8 @@ public: const char *name (SYMBOL_SEARCH_NAME (psym)); const uint32_t hash (djb_hash (reinterpret_cast<const unsigned char *> (name))); - hash_to_name.emplace (hash, Name (name, psymbol_tag (psym), cu_index)); + hash_to_name.emplace (hash, Name (name, psymbol_tag (psym), cu_index, + is_static)); } void build () @@ -23350,24 +23362,29 @@ public: hash_table.push_back (hash); name_table_string_offs.push_back (debugstrlookup.lookup (name.name)); name_table_entry_offs.push_back (entry_pool.size ()); + int &idx(tag_isstatic_to_idx[std::make_pair (name.tag, name.is_static)]); + if (!idx) { + idx = idx_next++; + // DW_TAG_* numerical value is used also as the value of the index tag. + abbrev_table.add_unsigned_leb128 (idx); + abbrev_table.add_unsigned_leb128 (name.tag); + abbrev_table.add_unsigned_leb128 (DW_IDX_compile_unit); + abbrev_table.add_unsigned_leb128 (DW_FORM_udata); + abbrev_table.add_unsigned_leb128 (name.is_static + ? DW_IDX_GNU_static + : DW_IDX_GNU_external); + abbrev_table.add_unsigned_leb128 (DW_FORM_flag_present); + // Terminate attributes list. + abbrev_table.add_unsigned_leb128 (0); + abbrev_table.add_unsigned_leb128 (0); + } // DW_TAG_* numerical value is used also as the value of the index tag. - entry_pool.add_unsigned_leb128 (name.tag); + entry_pool.add_unsigned_leb128 (idx); entry_pool.add_unsigned_leb128 (name.cu_index); + // Terminate the list of CUs. entry_pool.add_unsigned_leb128 (0); - tags_used.insert (name.tag); } gdb_assert (hash_table.size () == hash_to_name.size ()); - for (const auto tag:tags_used) - { - // DW_TAG_* numerical value is used also as the value of the index tag. - abbrev_table.add_unsigned_leb128 (tag); - abbrev_table.add_unsigned_leb128 (tag); - abbrev_table.add_unsigned_leb128 (DW_IDX_compile_unit); - abbrev_table.add_unsigned_leb128 (DW_FORM_udata); - // Terminate attributes list. - abbrev_table.add_unsigned_leb128 (0); - abbrev_table.add_unsigned_leb128 (0); - } // Terminate tags list. abbrev_table.add_unsigned_leb128 (0); } @@ -23410,7 +23427,7 @@ private: /* Only add a given psymbol once. */ if (psyms_seen.insert (psym).second) - insert (psym, cu_index); + insert (psym, cu_index, is_static); } } public: @@ -23638,8 +23655,9 @@ write_debug_names (struct objfile *objfile, FILE *out_file, FILE *out_file_str) per_cu.offset.sect_off); } + const gdb_byte augmentation[] = { 'G', 'D', 'B', 0 }; const offset_type bytes_of_header ((dwarf5_is_dwarf64 ? 12 : 4) - + 2 + 2 + 7 * 4); + + 2 + 2 + 7 * 4 + sizeof (augmentation)); size_t expected_bytes (0); expected_bytes += bytes_of_header; expected_bytes += cu_list.size (); @@ -23697,7 +23715,10 @@ write_debug_names (struct objfile *objfile, FILE *out_file, FILE *out_file_str) /* augmentation_string_size - The size in bytes of the augmentation string. This value is rounded up to a multiple of 4. */ - store_unsigned_integer (header.add_size (4), 4, dwarf5_byte_order, 0); + static_assert (sizeof (augmentation) % 4 == 0); + store_unsigned_integer (header.add_size (4), 4, dwarf5_byte_order, + sizeof (augmentation)); + header.add_data (augmentation); gdb_assert (header.size () == bytes_of_header); diff --git a/include/dwarf2.h b/include/dwarf2.h index ca8ff3b..8490fa0 100644 --- a/include/dwarf2.h +++ b/include/dwarf2.h @@ -429,7 +429,10 @@ enum dwarf_name_index_attribute DW_IDX_parent = 4, DW_IDX_type_hash = 5, DW_IDX_lo_user = 0x2000, - DW_IDX_hi_user = 0x3fff + DW_IDX_hi_user = 0x3fff, + + DW_IDX_GNU_static = 0x2000, + DW_IDX_GNU_external = 0x2001 }; /* Range list entry kinds in .debug_rnglists* section. */ hooks/post-receive -- Repository for Project Archer.
next reply other threads:[~2016-12-25 16:57 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-12-25 16:57 jkratoch [this message] -- strict thread matches above, loose matches on Subject: below -- 2016-12-24 20:30 jkratoch
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20161225165737.51580.qmail@sourceware.org \ --to=jkratoch@sourceware.org \ --cc=archer-commits@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).