[llvm] r321883 - [PDB] Correctly link S_FILESTATIC records.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 8 12:53:59 PST 2018
Yes, I know what the problem is. I should have a fix soon
On Mon, Jan 8, 2018 at 12:16 PM Zachary Turner <zturner at google.com> wrote:
> Thanks! That gives me a hint. Will confirm after lunch
> On Mon, Jan 8, 2018 at 12:15 PM Evgenii Stepanov <
> eugeni.stepanov at gmail.com> wrote:
>
>> I put an explicit check in MutableBinaryByteStream::writeBytes and got
>> this. Does it make sense?
>>
>> Uninitialized bytes in __msan_check_mem_is_initialized at offset 0
>> inside [0x70600000008a, 2)
>> ==219859==WARNING: MemorySanitizer: use-of-uninitialized-value
>> #0 0x1de06d2 in llvm::MutableBinaryByteStream::writeBytes(unsigned
>> int, llvm::ArrayRef<unsigned char>)
>> /code/llvm-project/llvm/include/llvm/Support/BinaryByteStream.h:123:5
>> #1 0x1dcf6a6 in llvm::WritableBinaryStreamRef::writeBytes(unsigned
>> int, llvm::ArrayRef<unsigned char>) const
>> /code/llvm-project/llvm/lib/Support/BinaryStreamRef.cpp:123:24
>> #2 0x1de2dba in
>> llvm::BinaryStreamWriter::writeBytes(llvm::ArrayRef<unsigned char>)
>> /code/llvm-project/llvm/lib/Support/BinaryStreamWriter.cpp:29:24
>> #3 0x28d697c in llvm::Error
>>
>> llvm::BinaryStreamWriter::writeObject<llvm::support::detail::packed_endian_specific_integral<unsigned
>> short, (llvm::support::endianness)1, 1ul>
>> >(llvm::support::detail::packed_endian_specific_integral<unsigned
>> short, (llvm::support::endianness)1, 1ul> const&)
>> /code/llvm-project/llvm/include/llvm/Support/BinaryStreamWriter.h:127:12
>> #4 0x28a2e88 in llvm::Error
>>
>> llvm::codeview::CodeViewRecordIO::mapObject<llvm::support::detail::packed_endian_specific_integral<unsigned
>> short, (llvm::support::endianness)1, 1ul>
>> >(llvm::support::detail::packed_endian_specific_integral<unsigned
>> short, (llvm::support::endianness)1, 1ul>&)
>>
>> /code/llvm-project/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h:51:22
>> #5 0x28a42ea in
>>
>> llvm::codeview::SymbolRecordMapping::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::SymbolKind>&,
>> llvm::codeview::DefRangeRegisterSym&)
>>
>> /code/llvm-project/llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp:264:3
>> #6 0x10413b8 in llvm::Error
>>
>> llvm::codeview::SymbolSerializer::visitKnownRecordImpl<llvm::codeview::DefRangeRegisterSym>(llvm::codeview::CVRecord<llvm::codeview::SymbolKind>&,
>> llvm::codeview::DefRangeRegisterSym&)
>>
>> /code/llvm-project/llvm/include/llvm/DebugInfo/CodeView/SymbolSerializer.h:77:20
>> #7 0x1040fb0 in
>>
>> llvm::codeview::SymbolSerializer::visitKnownRecord(llvm::codeview::CVRecord<llvm::codeview::SymbolKind>&,
>> llvm::codeview::DefRangeRegisterSym&)
>>
>> /code/llvm-project/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def:221:1
>> #8 0x1040a0e in
>> llvm::codeview::CVRecord<llvm::codeview::SymbolKind>
>>
>> llvm::codeview::SymbolSerializer::writeOneSymbol<llvm::codeview::DefRangeRegisterSym>(llvm::codeview::DefRangeRegisterSym&,
>> llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&,
>> llvm::codeview::CodeViewContainer)
>>
>> /code/llvm-project/llvm/include/llvm/DebugInfo/CodeView/SymbolSerializer.h:59:29
>> #9 0x103fcc6 in
>>
>> llvm::CodeViewYAML::detail::SymbolRecordImpl<llvm::codeview::DefRangeRegisterSym>::toCodeViewSymbol(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
>> 4096ul, 4096ul>&, llvm::codeview::CodeViewContainer) const
>> /code/llvm-project/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp:209:12
>> #10 0xed62a1 in
>>
>> llvm::CodeViewYAML::SymbolRecord::toCodeViewSymbol(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
>> 4096ul, 4096ul>&, llvm::codeview::CodeViewContainer) const
>> /code/llvm-project/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp:522:18
>> #11 0xe07cd6 in (anonymous
>>
>> namespace)::YAMLSymbolsSubsection::toCodeViewSubsection(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
>> 4096ul, 4096ul>&, llvm::codeview::StringsAndChecksums const&) const
>>
>> /code/llvm-project/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp:495:13
>> #12 0xbc0730 in
>>
>> llvm::CodeViewYAML::toCodeViewSubsectionList(llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,
>> 4096ul, 4096ul>&,
>> llvm::ArrayRef<llvm::CodeViewYAML::YAMLDebugSubsection>,
>> llvm::codeview::StringsAndChecksums const&)
>>
>> /code/llvm-project/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp:757:26
>> #13 0x69e9ff in
>> toDebugS(llvm::ArrayRef<llvm::CodeViewYAML::YAMLDebugSubsection>,
>> llvm::codeview::StringsAndChecksums const&,
>> llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096ul, 4096ul>&)
>> /code/llvm-project/llvm/tools/yaml2obj/yaml2coff.cpp:178:11
>> #14 0x6444c3 in layoutCOFF(COFFParser&)
>> /code/llvm-project/llvm/tools/yaml2obj/yaml2coff.cpp:232:13
>> #15 0x638021 in yaml2coff(llvm::COFFYAML::Object&,
>> llvm::raw_ostream&)
>> /code/llvm-project/llvm/tools/yaml2obj/yaml2coff.cpp:605:8
>> #16 0x5afcd6 in convertYAML(llvm::yaml::Input&,
>> llvm::raw_ostream&)
>> /code/llvm-project/llvm/tools/yaml2obj/yaml2obj.cpp:59:16
>> #17 0x5a84e8 in main
>> /code/llvm-project/llvm/tools/yaml2obj/yaml2obj.cpp:94:13
>> #18 0x7fcc2e6baf44 in __libc_start_main
>> /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:287
>> #19 0x532918 in _start (/code/build-llvm-msan/bin/yaml2obj+0x532918)
>>
>> Uninitialized value was created by a heap allocation
>> #0 0x59c9a9 in operator new(unsigned long)
>> /code/llvm-project/compiler-rt/lib/msan/msan_new_delete.cc:45:35
>> #1 0x114d6d4 in __allocate
>> /code/build-libcxx-msan//include/c++/v1/new:226:10
>> #2 0x114d6d4 in allocate
>> /code/build-libcxx-msan//include/c++/v1/memory:1747
>> #3 0x114d6d4 in
>>
>> std::__1::shared_ptr<llvm::CodeViewYAML::detail::SymbolRecordImpl<llvm::codeview::DefRangeRegisterSym>
>> >
>> std::__1::shared_ptr<llvm::CodeViewYAML::detail::SymbolRecordImpl<llvm::codeview::DefRangeRegisterSym>
>> >::make_shared<llvm::codeview::SymbolKind&>(llvm::codeview::SymbolKind&)
>> /code/build-libcxx-msan//include/c++/v1/memory:4223
>> #4 0xf038fa in
>>
>> make_shared<llvm::CodeViewYAML::detail::SymbolRecordImpl<llvm::codeview::DefRangeRegisterSym>,
>> llvm::codeview::SymbolKind &>
>> /code/build-libcxx-msan//include/c++/v1/memory:4594:12
>> #5 0xf038fa in
>>
>> _ZL19mapSymbolRecordImplIN4llvm12CodeViewYAML6detail16SymbolRecordImplINS0_8codeview19DefRangeRegisterSymEEEEvRNS0_4yaml2IOEPKcNS4_10SymbolKindERNS1_12SymbolRecordE
>> /code/llvm-project/llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp:566
>> #6 0xed804f in
>>
>> llvm::yaml::MappingTraits<llvm::CodeViewYAML::SymbolRecord>::mapping(llvm::yaml::IO&,
>> llvm::CodeViewYAML::SymbolRecord&)
>>
>> /code/llvm-project/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def:221:1
>> #7 0xe0e11c in void
>>
>> llvm::yaml::detail::doMapping<llvm::CodeViewYAML::SymbolRecord>(llvm::yaml::IO&,
>> llvm::CodeViewYAML::SymbolRecord&, llvm::yaml::EmptyContext&)
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:800:3
>> #8 0xe0d34b in
>>
>> _ZN4llvm4yaml7yamlizeINS_12CodeViewYAML12SymbolRecordENS0_12EmptyContextEEENSt3__19enable_ifIXsr24unvalidatedMappingTraitsIT_T0_EE5valueEvE4typeERNS0_2IOERS7_bRS8_
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:899:5
>> #9 0xe0c69a in
>>
>> _ZN4llvm4yaml7yamlizeINSt3__16vectorINS_12CodeViewYAML12SymbolRecordENS2_9allocatorIS5_EEEENS0_12EmptyContextEEENS2_9enable_ifIXsr18has_SequenceTraitsIT_EE5valueEvE4typeERNS0_2IOERSB_bRT0_
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:946:9
>> #10 0xe0b702 in void
>>
>> llvm::yaml::IO::processKey<std::__1::vector<llvm::CodeViewYAML::SymbolRecord,
>> std::__1::allocator<llvm::CodeViewYAML::SymbolRecord> >,
>> llvm::yaml::EmptyContext>(char const*,
>> std::__1::vector<llvm::CodeViewYAML::SymbolRecord,
>> std::__1::allocator<llvm::CodeViewYAML::SymbolRecord> >&, bool,
>> llvm::yaml::EmptyContext&)
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:783:7
>> #11 0xe0ae32 in void
>>
>> llvm::yaml::IO::mapRequired<std::__1::vector<llvm::CodeViewYAML::SymbolRecord,
>> std::__1::allocator<llvm::CodeViewYAML::SymbolRecord> > >(char const*,
>> std::__1::vector<llvm::CodeViewYAML::SymbolRecord,
>> std::__1::allocator<llvm::CodeViewYAML::SymbolRecord> >&)
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:692:11
>> #12 0xe05806 in (anonymous
>> namespace)::YAMLSymbolsSubsection::map(llvm::yaml::IO&)
>> /code/llvm-project/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp:353:6
>> #13 0xbb742f in
>>
>> llvm::yaml::MappingTraits<llvm::CodeViewYAML::YAMLDebugSubsection>::mapping(llvm::yaml::IO&,
>> llvm::CodeViewYAML::YAMLDebugSubsection&)
>>
>> /code/llvm-project/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp:399:26
>> #14 0x1a075dc in void
>>
>> llvm::yaml::detail::doMapping<llvm::CodeViewYAML::YAMLDebugSubsection>(llvm::yaml::IO&,
>> llvm::CodeViewYAML::YAMLDebugSubsection&, llvm::yaml::EmptyContext&)
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:800:3
>> #15 0x1a0680b in
>>
>> _ZN4llvm4yaml7yamlizeINS_12CodeViewYAML19YAMLDebugSubsectionENS0_12EmptyContextEEENSt3__19enable_ifIXsr24unvalidatedMappingTraitsIT_T0_EE5valueEvE4typeERNS0_2IOERS7_bRS8_
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:899:5
>> #16 0x1a05b5a in
>>
>> _ZN4llvm4yaml7yamlizeINSt3__16vectorINS_12CodeViewYAML19YAMLDebugSubsectionENS2_9allocatorIS5_EEEENS0_12EmptyContextEEENS2_9enable_ifIXsr18has_SequenceTraitsIT_EE5valueEvE4typeERNS0_2IOERSB_bRT0_
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:946:9
>> #17 0x1a04bc2 in void
>>
>> llvm::yaml::IO::processKey<std::__1::vector<llvm::CodeViewYAML::YAMLDebugSubsection,
>> std::__1::allocator<llvm::CodeViewYAML::YAMLDebugSubsection> >,
>> llvm::yaml::EmptyContext>(char const*,
>> std::__1::vector<llvm::CodeViewYAML::YAMLDebugSubsection,
>> std::__1::allocator<llvm::CodeViewYAML::YAMLDebugSubsection> >&, bool,
>> llvm::yaml::EmptyContext&)
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:783:7
>> #18 0x1a042fb in
>>
>> _ZN4llvm4yaml2IO22mapOptionalWithContextINSt3__16vectorINS_12CodeViewYAML19YAMLDebugSubsectionENS3_9allocatorIS6_EEEENS0_12EmptyContextEEENS3_9enable_ifIXsr18has_SequenceTraitsIT_EE5valueEvE4typeEPKcRSC_RT0_
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:717:11
>> #19 0x19cbf96 in void
>>
>> llvm::yaml::IO::mapOptional<std::__1::vector<llvm::CodeViewYAML::YAMLDebugSubsection,
>> std::__1::allocator<llvm::CodeViewYAML::YAMLDebugSubsection> > >(char
>> const*, std::__1::vector<llvm::CodeViewYAML::YAMLDebugSubsection,
>> std::__1::allocator<llvm::CodeViewYAML::YAMLDebugSubsection> >&)
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:702:5
>> #20 0x19c89bb in
>>
>> llvm::yaml::MappingTraits<llvm::COFFYAML::Section>::mapping(llvm::yaml::IO&,
>> llvm::COFFYAML::Section&)
>> /code/llvm-project/llvm/lib/ObjectYAML/COFFYAML.cpp:570:8
>> #21 0x1a5d9bc in void
>> llvm::yaml::detail::doMapping<llvm::COFFYAML::Section>(llvm::yaml::IO&,
>> llvm::COFFYAML::Section&, llvm::yaml::EmptyContext&)
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:800:3
>> #22 0x1a5cbdb in
>>
>> _ZN4llvm4yaml7yamlizeINS_8COFFYAML7SectionENS0_12EmptyContextEEENSt3__19enable_ifIXsr24unvalidatedMappingTraitsIT_T0_EE5valueEvE4typeERNS0_2IOERS7_bRS8_
>> /code/llvm-project/llvm/include/llvm/Support/YAMLTraits.h:899:5
>>
>> On Mon, Jan 8, 2018 at 11:50 AM, Zachary Turner <zturner at google.com>
>> wrote:
>> > In the meantime I'm trying to reproduce this on my linux box. I have an
>> > idea how to track it down if I can get a repro.
>> >
>> > On Mon, Jan 8, 2018 at 11:32 AM Zachary Turner <zturner at google.com>
>> wrote:
>> >>
>> >> We were just discussing this in another thread. And I mentioned that
>> this
>> >> is the exact same bug that happened several months ago. At the time,
>> you
>> >> sent me this mail:
>> >>
>> >> ---
>> >> This is the write to the byte before the first uninitialized.
>> >>
>> >> #0 __memmove_ssse3_back () at
>> >> ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2720
>> >> #1 0x000000000044bb4c in __msan_memcpy () at
>> >> /code/llvm/projects/compiler-rt/lib/msan/msan_interceptors.cc:1455
>> >> #2 0x00000000007a3999 in writeBytes () at
>> >> /code/llvm/include/llvm/Support/BinaryByteStream.h:121
>> >> #3 writeBytes () at /code/llvm/lib/Support/BinaryStreamRef.cpp:59
>> >> #4 0x00000000007a2f91 in writeBytes () at
>> >> /code/llvm/lib/Support/BinaryStreamRef.cpp:129
>> >> #5 0x00000000007a46fe in writeBytes () at
>> >> /code/llvm/lib/Support/BinaryStreamWriter.cpp:29
>> >> #6 0x00000000008de26e in commit () at
>> >> /code/llvm/lib/DebugInfo/CodeView/DebugSymbolsSubsection.cpp:25
>> >> #7 0x000000000051bb9e in commit () at
>> >> /code/llvm/lib/DebugInfo/CodeView/DebugSubsectionRecord.cpp:77
>> >> #8 0x00000000004a50e1 in toDebugS () at
>> >> /code/llvm/tools/yaml2obj/yaml2coff.cpp:193
>> >> #9 layoutCOFF () at /code/llvm/tools/yaml2obj/yaml2coff.cpp:232
>> >> #10 yaml2coff () at /code/llvm/tools/yaml2obj/yaml2coff.cpp:602
>> >> #11 0x000000000049b3e7 in convertYAML () at
>> >> /code/llvm/tools/yaml2obj/yaml2obj.cpp:59
>> >> #12 main () at /code/llvm/tools/yaml2obj/yaml2obj.cpp:94
>> >>
>> >> There are no writes to the uninitialized byte, accoring to gdb.
>> >> ---
>> >>
>> >> I don't know how you came up with this stack trace, but if it's not too
>> >> much work, would you be able to generate a similar stack trace for
>> this one?
>> >>
>> >> On Mon, Jan 8, 2018 at 11:24 AM Evgenii Stepanov
>> >> <eugeni.stepanov at gmail.com> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> MSan is not happy with this change:
>> >>>
>> >>>
>> http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/12211
>> >>>
>> >>> Uninitialized bytes in __interceptor_write at offset 316 inside
>> >>> [0x720000085000, 1998)
>> >>> ==5173==WARNING: MemorySanitizer: use-of-uninitialized-value
>> >>> #0 0x6cf04d in llvm::raw_fd_ostream::write_impl(char const*,
>> >>> unsigned long)
>> >>>
>> /b/sanitizer-x86_64-linux-fast/build/llvm/lib/Support/raw_ostream.cpp:600:19
>> >>> #1 0x4aaa8b in flush
>> >>>
>> >>>
>> /b/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Support/raw_ostream.h:142:7
>> >>> #2 0x4aaa8b in main
>> >>>
>> /b/sanitizer-x86_64-linux-fast/build/llvm/tools/yaml2obj/yaml2obj.cpp:98
>> >>> #3 0x7f5d8f8b92b0 in __libc_start_main
>> >>> (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
>> >>> #4 0x43cd19 in _start
>> >>>
>> >>>
>> (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/yaml2obj+0x43cd19)
>> >>>
>> >>>
>> >>> On Fri, Jan 5, 2018 at 11:12 AM, Zachary Turner via llvm-commits
>> >>> <llvm-commits at lists.llvm.org> wrote:
>> >>> > Author: zturner
>> >>> > Date: Fri Jan 5 11:12:40 2018
>> >>> > New Revision: 321883
>> >>> >
>> >>> > URL: http://llvm.org/viewvc/llvm-project?rev=321883&view=rev
>> >>> > Log:
>> >>> > [PDB] Correctly link S_FILESTATIC records.
>> >>> >
>> >>> > This is not a record type that clang currently generates,
>> >>> > but it is a record that is encountered in object files generated
>> >>> > by cl. This record is unusual in that it refers directly to
>> >>> > the string table instead of indirectly to the string table via
>> >>> > the FileChecksums table. Because of this, it was previously
>> >>> > overlooked and we weren't remapping the string indices at all.
>> >>> > This would lead to crashes in MSVC when trying to display a
>> >>> > variable whose debug info involved an S_FILESTATIC.
>> >>> >
>> >>> > Original bug report by Alexander Ganea
>> >>> >
>> >>> > Differential Revision: https://reviews.llvm.org/D41718
>> >>> >
>> >>> > Modified:
>> >>> > llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp
>> >>> > llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.h
>> >>> > llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
>> >>> > llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.h
>> >>> >
>> >>> > Modified: llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp
>> >>> > URL:
>> >>> >
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp?rev=321883&r1=321882&r2=321883&view=diff
>> >>> >
>> >>> >
>> ==============================================================================
>> >>> > --- llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp (original)
>> >>> > +++ llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp Fri Jan 5
>> >>> > 11:12:40 2018
>> >>> > @@ -848,14 +848,7 @@ Error DumpOutputStyle::dumpXme() {
>> >>> > return Error::success();
>> >>> > }
>> >>> >
>> >>> > -Error DumpOutputStyle::dumpStringTable() {
>> >>> > - printHeader(P, "String Table");
>> >>> > -
>> >>> > - if (File.isObj()) {
>> >>> > - P.formatLine("Dumping string table is not supported for object
>> >>> > files");
>> >>> > - return Error::success();
>> >>> > - }
>> >>> > -
>> >>> > +Error DumpOutputStyle::dumpStringTableFromPdb() {
>> >>> > AutoIndent Indent(P);
>> >>> > auto IS = getPdb().getStringTable();
>> >>> > if (!IS) {
>> >>> > @@ -895,6 +888,36 @@ Error DumpOutputStyle::dumpStringTable()
>> >>> > return Error::success();
>> >>> > }
>> >>> >
>> >>> > +Error DumpOutputStyle::dumpStringTableFromObj() {
>> >>> > + iterateModuleSubsections<DebugStringTableSubsectionRef>(
>> >>> > + File, PrintScope{P, 4},
>> >>> > + [&](uint32_t Modi, const SymbolGroup &Strings,
>> >>> > + DebugStringTableSubsectionRef &Strings2) {
>> >>> > + BinaryStreamRef StringTableBuffer = Strings2.getBuffer();
>> >>> > + BinaryStreamReader Reader(StringTableBuffer);
>> >>> > + while (Reader.bytesRemaining() > 0) {
>> >>> > + StringRef Str;
>> >>> > + uint32_t Offset = Reader.getOffset();
>> >>> > + cantFail(Reader.readCString(Str));
>> >>> > + if (Str.empty())
>> >>> > + continue;
>> >>> > +
>> >>> > + P.formatLine("{0} | {1}", fmt_align(Offset,
>> >>> > AlignStyle::Right, 4),
>> >>> > + Str);
>> >>> > + }
>> >>> > + });
>> >>> > + return Error::success();
>> >>> > +}
>> >>> > +
>> >>> > +Error DumpOutputStyle::dumpStringTable() {
>> >>> > + printHeader(P, "String Table");
>> >>> > +
>> >>> > + if (File.isPdb())
>> >>> > + return dumpStringTableFromPdb();
>> >>> > +
>> >>> > + return dumpStringTableFromObj();
>> >>> > +}
>> >>> > +
>> >>> > static void buildDepSet(LazyRandomTypeCollection &Types,
>> >>> > ArrayRef<TypeIndex> Indices,
>> >>> > std::map<TypeIndex, CVType> &DepSet) {
>> >>> > @@ -1124,6 +1147,7 @@ Error DumpOutputStyle::dumpModuleSymsFor
>> >>> > File, PrintScope{P, 2},
>> >>> > [&](uint32_t Modi, const SymbolGroup &Strings,
>> >>> > DebugSymbolsSubsectionRef &Symbols) {
>> >>> > + Dumper.setSymbolGroup(&Strings);
>> >>> > for (auto Symbol : Symbols) {
>> >>> > if (auto EC = Visitor.visitSymbolRecord(Symbol)) {
>> >>> > SymbolError = llvm::make_unique<Error>(std::move(EC));
>> >>> > @@ -1165,8 +1189,8 @@ Error DumpOutputStyle::dumpModuleSymsFor
>> >>> >
>> >>> > SymbolVisitorCallbackPipeline Pipeline;
>> >>> > SymbolDeserializer Deserializer(nullptr,
>> >>> > CodeViewContainer::Pdb);
>> >>> > - MinimalSymbolDumper Dumper(P,
>> opts::dump::DumpSymRecordBytes,
>> >>> > Ids,
>> >>> > - Types);
>> >>> > + MinimalSymbolDumper Dumper(P,
>> opts::dump::DumpSymRecordBytes,
>> >>> > Strings,
>> >>> > + Ids, Types);
>> >>> >
>> >>> > Pipeline.addCallbackToPipeline(Deserializer);
>> >>> > Pipeline.addCallbackToPipeline(Dumper);
>> >>> >
>> >>> > Modified: llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.h
>> >>> > URL:
>> >>> >
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.h?rev=321883&r1=321882&r2=321883&view=diff
>> >>> >
>> >>> >
>> ==============================================================================
>> >>> > --- llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.h (original)
>> >>> > +++ llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.h Fri Jan 5
>> 11:12:40
>> >>> > 2018
>> >>> > @@ -75,6 +75,8 @@ private:
>> >>> > Error dumpSymbolStats();
>> >>> > Error dumpUdtStats();
>> >>> > Error dumpStringTable();
>> >>> > + Error dumpStringTableFromPdb();
>> >>> > + Error dumpStringTableFromObj();
>> >>> > Error dumpLines();
>> >>> > Error dumpInlineeLines();
>> >>> > Error dumpXmi();
>> >>> >
>> >>> > Modified: llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp
>> >>> > URL:
>> >>> >
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp?rev=321883&r1=321882&r2=321883&view=diff
>> >>> >
>> >>> >
>> ==============================================================================
>> >>> > --- llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp (original)
>> >>> > +++ llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.cpp Fri Jan 5
>> >>> > 11:12:40 2018
>> >>> > @@ -10,6 +10,7 @@
>> >>> > #include "MinimalSymbolDumper.h"
>> >>> >
>> >>> > #include "FormatUtil.h"
>> >>> > +#include "InputFile.h"
>> >>> > #include "LinePrinter.h"
>> >>> >
>> >>> > #include "llvm/DebugInfo/CodeView/CVRecord.h"
>> >>> > @@ -18,6 +19,7 @@
>> >>> > #include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
>> >>> > #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
>> >>> > #include "llvm/DebugInfo/CodeView/TypeRecord.h"
>> >>> > +#include "llvm/DebugInfo/PDB/Native/PDBStringTable.h"
>> >>> > #include "llvm/Support/FormatVariadic.h"
>> >>> >
>> >>> > using namespace llvm;
>> >>> > @@ -450,6 +452,17 @@ Error MinimalSymbolDumper::visitKnownRec
>> >>> > Error MinimalSymbolDumper::visitKnownRecord(CVSymbol &CVR,
>> >>> > FileStaticSym &FS) {
>> >>> > P.format(" `{0}`", FS.Name);
>> >>> > AutoIndent Indent(P, 7);
>> >>> > + if (SymGroup) {
>> >>> > + Expected<StringRef> FileName =
>> >>> > + SymGroup->getNameFromStringTable(FS.ModFilenameOffset);
>> >>> > + if (FileName) {
>> >>> > + P.formatLine("type = {0}, file name = {1} ({2}), flags =
>> {3}",
>> >>> > + typeIndex(FS.Index), FS.ModFilenameOffset,
>> >>> > *FileName,
>> >>> > + formatLocalSymFlags(P.getIndentLevel() + 9,
>> >>> > FS.Flags));
>> >>> > + }
>> >>> > + return Error::success();
>> >>> > + }
>> >>> > +
>> >>> > P.formatLine("type = {0}, file name offset = {1}, flags = {2}",
>> >>> > typeIndex(FS.Index), FS.ModFilenameOffset,
>> >>> > formatLocalSymFlags(P.getIndentLevel() + 9,
>> FS.Flags));
>> >>> >
>> >>> > Modified: llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.h
>> >>> > URL:
>> >>> >
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.h?rev=321883&r1=321882&r2=321883&view=diff
>> >>> >
>> >>> >
>> ==============================================================================
>> >>> > --- llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.h (original)
>> >>> > +++ llvm/trunk/tools/llvm-pdbutil/MinimalSymbolDumper.h Fri Jan 5
>> >>> > 11:12:40 2018
>> >>> > @@ -19,6 +19,7 @@ class LazyRandomTypeCollection;
>> >>> >
>> >>> > namespace pdb {
>> >>> > class LinePrinter;
>> >>> > +class SymbolGroup;
>> >>> >
>> >>> > class MinimalSymbolDumper : public
>> codeview::SymbolVisitorCallbacks {
>> >>> > public:
>> >>> > @@ -26,11 +27,19 @@ public:
>> >>> > codeview::LazyRandomTypeCollection &Ids,
>> >>> > codeview::LazyRandomTypeCollection &Types)
>> >>> > : P(P), RecordBytes(RecordBytes), Ids(Ids), Types(Types) {}
>> >>> > + MinimalSymbolDumper(LinePrinter &P, bool RecordBytes,
>> >>> > + const SymbolGroup &SymGroup,
>> >>> > + codeview::LazyRandomTypeCollection &Ids,
>> >>> > + codeview::LazyRandomTypeCollection &Types)
>> >>> > + : P(P), RecordBytes(RecordBytes), SymGroup(&SymGroup),
>> Ids(Ids),
>> >>> > + Types(Types) {}
>> >>> >
>> >>> > Error visitSymbolBegin(codeview::CVSymbol &Record) override;
>> >>> > Error visitSymbolBegin(codeview::CVSymbol &Record, uint32_t
>> Offset)
>> >>> > override;
>> >>> > Error visitSymbolEnd(codeview::CVSymbol &Record) override;
>> >>> >
>> >>> > + void setSymbolGroup(const SymbolGroup *Group) { SymGroup =
>> Group; }
>> >>> > +
>> >>> > #define SYMBOL_RECORD(EnumName, EnumVal, Name)
>> >>> > \
>> >>> > virtual Error visitKnownRecord(codeview::CVSymbol &CVR,
>> >>> > \
>> >>> > codeview::Name &Record) override;
>> >>> > @@ -45,6 +54,7 @@ private:
>> >>> >
>> >>> > LinePrinter &P;
>> >>> > bool RecordBytes;
>> >>> > + const SymbolGroup *SymGroup = nullptr;
>> >>> > codeview::LazyRandomTypeCollection &Ids;
>> >>> > codeview::LazyRandomTypeCollection &Types;
>> >>> > };
>> >>> >
>> >>> >
>> >>> > _______________________________________________
>> >>> > llvm-commits mailing list
>> >>> > llvm-commits at lists.llvm.org
>> >>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180108/d75bd0d7/attachment-0001.html>
More information about the llvm-commits
mailing list