Ugh, I guess it’s the back quote? Because it works on Windows. I’ll just remove that particular argument<br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 8, 2018 at 4:19 AM Kristina Brooks via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Er, sorry, what I meant is, I fixed that particular warning in <a href="https://reviews.llvm.org/rL343957" rel="noreferrer" target="_blank">https://reviews.llvm.org/rL343957</a>. Just<br>
wanted to disambiguate it from Zachary's earlier fix for a different warning.<br>
<br>
On 08/10/2018 12:10, Kristina Brooks via llvm-commits wrote:<br>
> I already fixed the warning in <a href="https://reviews.llvm.org/rL343951" rel="noreferrer" target="_blank">https://reviews.llvm.org/rL343951</a>. The test file<br>
> seems to be malformed though so all buildbots have been failing on it (I think<br>
> there's a syntax error in the RUN directive in the test you added).<br>
> <br>
> Thanks.<br>
> <br>
> On 08/10/2018 11:42, Zachary Turner via llvm-commits wrote:<br>
>> I’ll have to fix this in a couple hours as I don’t have computer access at the moment, if you want to unblock you can<br>
>> just cast to a uint32. Sorry!<br>
>> On Sun, Oct 7, 2018 at 11:24 PM Mikael Holmén <<a href="mailto:mikael.holmen@ericsson.com" target="_blank">mikael.holmen@ericsson.com</a> <mailto:<a href="mailto:mikael.holmen@ericsson.com" target="_blank">mikael.holmen@ericsson.com</a>>> wrote:<br>
>><br>
>> Hi Zachary,<br>
>><br>
>> I get the following with clang 3.6:<br>
>><br>
>> ../lib/DebugInfo/PDB/Native/GlobalsStream.cpp:61:33: error: comparison<br>
>> of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned<br>
>> int') [-Werror,-Wsign-compare]<br>
>> if (CompressedBucketIndex + 1 < GlobalsTable.HashBuckets.size())<br>
>> ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>
>> 1 error generated.<br>
>><br>
>> I saw that you fixed something in r343952 and r343953 but now I get this<br>
>> warnign.<br>
>><br>
>> Regards,<br>
>> Mikael<br>
>><br>
>> On 10/08/2018 06:19 AM, Zachary Turner via llvm-commits wrote:<br>
>> > Author: zturner<br>
>> > Date: Sun Oct 7 21:19:16 2018<br>
>> > New Revision: 343951<br>
>> ><br>
>> > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=343951&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=343951&view=rev</a><br>
>> > Log:<br>
>> > [PDB] Add the ability to lookup global symbols by name.<br>
>> ><br>
>> > The Globals table is a hash table keyed on symbol name, so<br>
>> > it's possible to lookup symbols by name in O(1) time. Add<br>
>> > a function to the globals stream to do this, and add an option<br>
>> > to llvm-pdbutil to exercise this, then use it to write some<br>
>> > tests to verify correctness.<br>
>> ><br>
>> > Added:<br>
>> > llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test<br>
>> > Modified:<br>
>> > llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h<br>
>> > llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiStream.h<br>
>> > llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h<br>
>> > llvm/trunk/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h<br>
>> > llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp<br>
>> > llvm/trunk/lib/DebugInfo/PDB/Native/DbiStream.cpp<br>
>> > llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp<br>
>> > llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp<br>
>> > llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp<br>
>> > llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp<br>
>> > llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h<br>
>> ><br>
>> > Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h (original)<br>
>> > +++ llvm/trunk/include/llvm/DebugInfo/CodeView/SymbolRecord.h Sun Oct 7 21:19:16 2018<br>
>> > @@ -358,6 +358,7 @@ public:<br>
>> > // S_PUB32<br>
>> > class PublicSym32 : public SymbolRecord {<br>
>> > public:<br>
>> > + PublicSym32() : SymbolRecord(SymbolRecordKind::PublicSym32) {}<br>
>> > explicit PublicSym32(SymbolRecordKind Kind) : SymbolRecord(Kind) {}<br>
>> > explicit PublicSym32(uint32_t RecordOffset)<br>
>> > : SymbolRecord(SymbolRecordKind::PublicSym32),<br>
>> > @@ -636,6 +637,7 @@ public:<br>
>> > // S_OBJNAME<br>
>> > class ObjNameSym : public SymbolRecord {<br>
>> > public:<br>
>> > + explicit ObjNameSym() : SymbolRecord(SymbolRecordKind::ObjNameSym) {}<br>
>> > explicit ObjNameSym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}<br>
>> > ObjNameSym(uint32_t RecordOffset)<br>
>> > : SymbolRecord(SymbolRecordKind::ObjNameSym), RecordOffset(RecordOffset) {<br>
>> > @@ -718,6 +720,7 @@ public:<br>
>> > // S_COMPILE3<br>
>> > class Compile3Sym : public SymbolRecord {<br>
>> > public:<br>
>> > + Compile3Sym() : SymbolRecord(SymbolRecordKind::Compile3Sym) {}<br>
>> > explicit Compile3Sym(SymbolRecordKind Kind) : SymbolRecord(Kind) {}<br>
>> > Compile3Sym(uint32_t RecordOffset)<br>
>> > : SymbolRecord(SymbolRecordKind::Compile3Sym),<br>
>> > @@ -739,8 +742,17 @@ public:<br>
>> > Flags = CompileSym3Flags((uint32_t(Flags) & 0xFFFFFF00) | uint32_t(Lang));<br>
>> > }<br>
>> > <br>
>> > - uint8_t getLanguage() const { return static_cast<uint32_t>(Flags) & 0xFF; }<br>
>> > - uint32_t getFlags() const { return static_cast<uint32_t>(Flags) & ~0xFF; }<br>
>> > + SourceLanguage getLanguage() const {<br>
>> > + return static_cast<SourceLanguage>(static_cast<uint32_t>(Flags) & 0xFF);<br>
>> > + }<br>
>> > + CompileSym3Flags getFlags() const {<br>
>> > + return static_cast<CompileSym3Flags>(static_cast<uint32_t>(Flags) & ~0xFF);<br>
>> > + }<br>
>> > +<br>
>> > + bool hasOptimizations() const {<br>
>> > + return CompileSym3Flags::None !=<br>
>> > + (getFlags() & (CompileSym3Flags::PGO | CompileSym3Flags::LTCG));<br>
>> > + }<br>
>> > <br>
>> > uint32_t RecordOffset;<br>
>> > };<br>
>> ><br>
>> > Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiStream.h<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiStream.h?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiStream.h?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiStream.h (original)<br>
>> > +++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/DbiStream.h Sun Oct 7 21:19:16 2018<br>
>> > @@ -78,7 +78,7 @@ public:<br>
>> > <br>
>> > const DbiModuleList &modules() const;<br>
>> > <br>
>> > - FixedStreamArray<object::coff_section> getSectionHeaders();<br>
>> > + FixedStreamArray<object::coff_section> getSectionHeaders() const;<br>
>> > <br>
>> > FixedStreamArray<object::FpoData> getFpoRecords();<br>
>> > <br>
>> ><br>
>> > Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h (original)<br>
>> > +++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/GlobalsStream.h Sun Oct 7 21:19:16 2018<br>
>> > @@ -10,18 +10,20 @@<br>
>> > #ifndef LLVM_DEBUGINFO_PDB_RAW_GLOBALS_STREAM_H<br>
>> > #define LLVM_DEBUGINFO_PDB_RAW_GLOBALS_STREAM_H<br>
>> > <br>
>> > +#include "llvm/ADT/iterator.h"<br>
>> > +#include "llvm/DebugInfo/CodeView/SymbolRecord.h"<br>
>> > #include "llvm/DebugInfo/MSF/MappedBlockStream.h"<br>
>> > #include "llvm/DebugInfo/PDB/Native/RawConstants.h"<br>
>> > #include "llvm/DebugInfo/PDB/Native/RawTypes.h"<br>
>> > #include "llvm/DebugInfo/PDB/PDBTypes.h"<br>
>> > #include "llvm/Support/BinaryStreamArray.h"<br>
>> > #include "llvm/Support/Error.h"<br>
>> > -#include "llvm/ADT/iterator.h"<br>
>> > <br>
>> > namespace llvm {<br>
>> > namespace pdb {<br>
>> > class DbiStream;<br>
>> > class PDBFile;<br>
>> > +class SymbolStream;<br>
>> > <br>
>> > /// Iterator over hash records producing symbol record offsets. Abstracts away<br>
>> > /// the fact that symbol record offsets on disk are off-by-one.<br>
>> > @@ -50,8 +52,9 @@ class GSIHashTable {<br>
>> > public:<br>
>> > const GSIHashHeader *HashHdr;<br>
>> > FixedStreamArray<PSHashRecord> HashRecords;<br>
>> > - ArrayRef<uint8_t> HashBitmap;<br>
>> > + ArrayRef<uint32_t> HashBitmap;<br>
>> > FixedStreamArray<support::ulittle32_t> HashBuckets;<br>
>> > + std::array<int32_t, IPHR_HASH + 1> BucketMap;<br>
>> > <br>
>> > Error read(BinaryStreamReader &Reader);<br>
>> > <br>
>> > @@ -72,6 +75,9 @@ public:<br>
>> > const GSIHashTable &getGlobalsTable() const { return GlobalsTable; }<br>
>> > Error reload();<br>
>> > <br>
>> > + std::vector<std::pair<uint32_t, codeview::CVSymbol>><br>
>> > + findRecordsByName(StringRef Name, const SymbolStream &Symbols) const;<br>
>> > +<br>
>> > private:<br>
>> > GSIHashTable GlobalsTable;<br>
>> > std::unique_ptr<msf::MappedBlockStream> Stream;<br>
>> ><br>
>> > Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h (original)<br>
>> > +++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/ModuleDebugStream.h Sun Oct 7 21:19:16 2018<br>
>> > @@ -15,6 +15,7 @@<br>
>> > #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"<br>
>> > #include "llvm/DebugInfo/CodeView/SymbolRecord.h"<br>
>> > #include "llvm/DebugInfo/MSF/MappedBlockStream.h"<br>
>> > +#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"<br>
>> > #include "llvm/Support/BinaryStreamRef.h"<br>
>> > #include "llvm/Support/Error.h"<br>
>> > #include <cstdint><br>
>> > @@ -51,6 +52,8 @@ public:<br>
>> > <br>
>> > ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = delete;<br>
>> > <br>
>> > + codeview::CVSymbol readSymbolAtOffset(uint32_t Offset) const;<br>
>> > +<br>
>> > iterator_range<DebugSubsectionIterator> subsections() const;<br>
>> > codeview::DebugSubsectionArray getSubsectionsArray() const {<br>
>> > return Subsections;<br>
>> > @@ -64,7 +67,7 @@ public:<br>
>> > findChecksumsSubsection() const;<br>
>> > <br>
>> > private:<br>
>> > - const DbiModuleDescriptor &Mod;<br>
>> > + DbiModuleDescriptor Mod;<br>
>> > <br>
>> > uint32_t Signature;<br>
>> > <br>
>> ><br>
>> > Modified: llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp (original)<br>
>> > +++ llvm/trunk/lib/DebugInfo/CodeView/SymbolDumper.cpp Sun Oct 7 21:19:16 2018<br>
>> > @@ -262,7 +262,8 @@ Error CVSymbolDumperImpl::visitKnownReco<br>
>> > Error CVSymbolDumperImpl::visitKnownRecord(CVSymbol &CVR,<br>
>> > Compile3Sym &Compile3) {<br>
>> > W.printEnum("Language", Compile3.getLanguage(), getSourceLanguageNames());<br>
>> > - W.printFlags("Flags", Compile3.getFlags(), getCompileSym3FlagNames());<br>
>> > + W.printFlags("Flags", uint32_t(Compile3.getFlags()),<br>
>> > + getCompileSym3FlagNames());<br>
>> > W.printEnum("Machine", unsigned(Compile3.Machine), getCPUTypeNames());<br>
>> > CompilationCPUType = Compile3.Machine;<br>
>> > std::string FrontendVersion;<br>
>> ><br>
>> > Modified: llvm/trunk/lib/DebugInfo/PDB/Native/DbiStream.cpp<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/DbiStream.cpp?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/DbiStream.cpp?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/lib/DebugInfo/PDB/Native/DbiStream.cpp (original)<br>
>> > +++ llvm/trunk/lib/DebugInfo/PDB/Native/DbiStream.cpp Sun Oct 7 21:19:16 2018<br>
>> > @@ -197,7 +197,7 @@ PDB_Machine DbiStream::getMachineType()<br>
>> > return static_cast<PDB_Machine>(Machine);<br>
>> > }<br>
>> > <br>
>> > -FixedStreamArray<object::coff_section> DbiStream::getSectionHeaders() {<br>
>> > +FixedStreamArray<object::coff_section> DbiStream::getSectionHeaders() const {<br>
>> > return SectionHeaders;<br>
>> > }<br>
>> > <br>
>> ><br>
>> > Modified: llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp (original)<br>
>> > +++ llvm/trunk/lib/DebugInfo/PDB/Native/GlobalsStream.cpp Sun Oct 7 21:19:16 2018<br>
>> > @@ -20,7 +20,11 @@<br>
>> > //===----------------------------------------------------------------------===//<br>
>> > <br>
>> > #include "llvm/DebugInfo/PDB/Native/GlobalsStream.h"<br>
>> > +<br>
>> > +#include "llvm/DebugInfo/CodeView/RecordName.h"<br>
>> > +#include "llvm/DebugInfo/PDB/Native/Hash.h"<br>
>> > #include "llvm/DebugInfo/PDB/Native/RawError.h"<br>
>> > +#include "llvm/DebugInfo/PDB/Native/SymbolStream.h"<br>
>> > #include "llvm/Support/BinaryStreamReader.h"<br>
>> > #include "llvm/Support/Error.h"<br>
>> > #include <algorithm><br>
>> > @@ -41,6 +45,35 @@ Error GlobalsStream::reload() {<br>
>> > return Error::success();<br>
>> > }<br>
>> > <br>
>> > +std::vector<std::pair<uint32_t, codeview::CVSymbol>><br>
>> > +GlobalsStream::findRecordsByName(StringRef Name,<br>
>> > + const SymbolStream &Symbols) const {<br>
>> > + std::vector<std::pair<uint32_t, codeview::CVSymbol>> Result;<br>
>> > +<br>
>> > + // Hash the name to figure out which bucket this goes into.<br>
>> > + size_t ExpandedBucketIndex = hashStringV1(Name) % IPHR_HASH;<br>
>> > + uint32_t CompressedBucketIndex = GlobalsTable.BucketMap[ExpandedBucketIndex];<br>
>> > + if (CompressedBucketIndex == -1)<br>
>> > + return Result;<br>
>> > +<br>
>> > + uint32_t ChainStartOffset = GlobalsTable.HashBuckets[CompressedBucketIndex];<br>
>> > + uint32_t NextChainStart = GlobalsTable.HashBuckets.size();<br>
>> > + if (CompressedBucketIndex + 1 < GlobalsTable.HashBuckets.size())<br>
>> > + NextChainStart = GlobalsTable.HashBuckets[CompressedBucketIndex + 1];<br>
>> > + ChainStartOffset /= 12;<br>
>> > + NextChainStart /= 12;<br>
>> > +<br>
>> > + while (ChainStartOffset < NextChainStart) {<br>
>> > + PSHashRecord PSH = GlobalsTable.HashRecords[ChainStartOffset];<br>
>> > + uint32_t Off = PSH.Off - 1;<br>
>> > + codeview::CVSymbol Record = Symbols.readRecord(Off);<br>
>> > + if (codeview::getSymbolName(Record) == Name)<br>
>> > + Result.push_back(std::make_pair(Off, std::move(Record)));<br>
>> > + ++ChainStartOffset;<br>
>> > + }<br>
>> > + return Result;<br>
>> > +}<br>
>> > +<br>
>> > static Error checkHashHdrVersion(const GSIHashHeader *HashHdr) {<br>
>> > if (HashHdr->VerHdr != GSIHashHeader::HdrVersion)<br>
>> > return make_error<RawError>(<br>
>> > @@ -86,7 +119,8 @@ static Error readGSIHashRecords(FixedStr<br>
>> > <br>
>> > static Error<br>
>> > readGSIHashBuckets(FixedStreamArray<support::ulittle32_t> &HashBuckets,<br>
>> > - ArrayRef<uint8_t> &HashBitmap, const GSIHashHeader *HashHdr,<br>
>> > + ArrayRef<uint32_t> &HashBitmap, const GSIHashHeader *HashHdr,<br>
>> > + MutableArrayRef<int32_t> BucketMap,<br>
>> > BinaryStreamReader &Reader) {<br>
>> > if (auto EC = checkHashHdrVersion(HashHdr))<br>
>> > return EC;<br>
>> > @@ -94,13 +128,27 @@ readGSIHashBuckets(FixedStreamArray<supp<br>
>> > // Before the actual hash buckets, there is a bitmap of length determined by<br>
>> > // IPHR_HASH.<br>
>> > size_t BitmapSizeInBits = alignTo(IPHR_HASH + 1, 32);<br>
>> > - uint32_t NumBitmapEntries = BitmapSizeInBits / 8;<br>
>> > - if (auto EC = Reader.readBytes(HashBitmap, NumBitmapEntries))<br>
>> > + uint32_t NumBitmapEntries = BitmapSizeInBits / 32;<br>
>> > + if (auto EC = Reader.readArray(HashBitmap, NumBitmapEntries))<br>
>> > return joinErrors(std::move(EC),<br>
>> > make_error<RawError>(raw_error_code::corrupt_file,<br>
>> > "Could not read a bitmap."));<br>
>> > + uint32_t NumBuckets1 = 0;<br>
>> > + uint32_t CompressedBucketIdx = 0;<br>
>> > + for (uint32_t I = 0; I <= IPHR_HASH; ++I) {<br>
>> > + uint8_t WordIdx = I / 32;<br>
>> > + uint8_t BitIdx = I % 32;<br>
>> > + bool IsSet = HashBitmap[WordIdx] & (1U << BitIdx);<br>
>> > + if (IsSet) {<br>
>> > + ++NumBuckets1;<br>
>> > + BucketMap[I] = CompressedBucketIdx++;<br>
>> > + } else {<br>
>> > + BucketMap[I] = -1;<br>
>> > + }<br>
>> > + }<br>
>> > +<br>
>> > uint32_t NumBuckets = 0;<br>
>> > - for (uint8_t B : HashBitmap)<br>
>> > + for (uint32_t B : HashBitmap)<br>
>> > NumBuckets += countPopulation(B);<br>
>> > <br>
>> > // Hash buckets follow.<br>
>> > @@ -118,7 +166,8 @@ Error GSIHashTable::read(BinaryStreamRea<br>
>> > if (auto EC = readGSIHashRecords(HashRecords, HashHdr, Reader))<br>
>> > return EC;<br>
>> > if (HashHdr->HrSize > 0)<br>
>> > - if (auto EC = readGSIHashBuckets(HashBuckets, HashBitmap, HashHdr, Reader))<br>
>> > + if (auto EC = readGSIHashBuckets(HashBuckets, HashBitmap, HashHdr,<br>
>> > + BucketMap, Reader))<br>
>> > return EC;<br>
>> > return Error::success();<br>
>> > }<br>
>> ><br>
>> > Modified: llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp (original)<br>
>> > +++ llvm/trunk/lib/DebugInfo/PDB/Native/ModuleDebugStream.cpp Sun Oct 7 21:19:16 2018<br>
>> > @@ -97,6 +97,14 @@ ModuleDebugStreamRef::symbols(bool *HadE<br>
>> > return make_range(SymbolArray.begin(HadError), SymbolArray.end());<br>
>> > }<br>
>> > <br>
>> > +CVSymbol ModuleDebugStreamRef::readSymbolAtOffset(uint32_t Offset) const {<br>
>> > + // Offsets include the size of the 4-byte magic at the beginning, but lookup<br>
>> > + // doesn't take that into account, so subtract it here.<br>
>> > + auto Iter = SymbolArray.at(Offset - 4);<br>
>> > + assert(Iter != SymbolArray.end());<br>
>> > + return *Iter;<br>
>> > +}<br>
>> > +<br>
>> > iterator_range<ModuleDebugStreamRef::DebugSubsectionIterator><br>
>> > ModuleDebugStreamRef::subsections() const {<br>
>> > return make_range(Subsections.begin(), Subsections.end());<br>
>> ><br>
>> > Added: llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test<br>
>> > URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test?rev=343951&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test?rev=343951&view=auto</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test (added)<br>
>> > +++ llvm/trunk/test/DebugInfo/PDB/pdbdump-global-lookup.test Sun Oct 7 21:19:16 2018<br>
>> > @@ -0,0 +1,22 @@<br>
>> > +; RUN: llvm-pdbutil dump -globals \<br>
>> > +; RUN: -global-name="operator delete" \<br>
>> > +; RUN: -global-name=main \<br>
>> > +; RUN: -global-name=abcdefg \<br>
>> > +; RUN: -global-name="Base2::`vbase destructor'" \<br>
>> > +; RUN: %p/Inputs/every-function.pdb | FileCheck %s<br>
>> > +<br>
>> > +CHECK: Global Symbols<br>
>> > +CHECK-NEXT: ============================================================<br>
>> > +CHECK-NEXT: Global Name `operator delete`<br>
>> > +CHECK-NEXT: 1516 | S_PROCREF [size = 32] `operator delete`<br>
>> > +CHECK-NEXT: module = 1, sum name = 0, offset = 324<br>
>> > +CHECK-NEXT: 1484 | S_PROCREF [size = 32] `operator delete`<br>
>> > +CHECK-NEXT: module = 1, sum name = 0, offset = 184<br>
>> > +CHECK-NEXT: Global Name `main`<br>
>> > +CHECK-NEXT: 2016 | S_PROCREF [size = 20] `main`<br>
>> > +CHECK-NEXT: module = 1, sum name = 0, offset = 1952<br>
>> > +CHECK-NEXT: Global Name `abcdefg`<br>
>> > +CHECK-NEXT: (no matching records found)<br>
>> > +CHECK-NEXT: Global Name `Base2::`vbase destructor'`<br>
>> > +CHECK-NEXT: 2288 | S_PROCREF [size = 40] `Base2::`vbase destructor'`<br>
>> > +CHECK-NEXT: module = 1, sum name = 0, offset = 2852<br>
>> ><br>
>> > Modified: llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp (original)<br>
>> > +++ llvm/trunk/tools/llvm-pdbutil/DumpOutputStyle.cpp Sun Oct 7 21:19:16 2018<br>
>> > @@ -1572,8 +1572,40 @@ Error DumpOutputStyle::dumpGlobals() {<br>
>> > ExitOnError Err("Error dumping globals stream: ");<br>
>> > auto &Globals = Err(getPdb().getPDBGlobalsStream());<br>
>> > <br>
>> > - const GSIHashTable &Table = Globals.getGlobalsTable();<br>
>> > - Err(dumpSymbolsFromGSI(Table, opts::dump::DumpGlobalExtras));<br>
>> > + if (opts::dump::DumpGlobalNames.empty()) {<br>
>> > + const GSIHashTable &Table = Globals.getGlobalsTable();<br>
>> > + Err(dumpSymbolsFromGSI(Table, opts::dump::DumpGlobalExtras));<br>
>> > + } else {<br>
>> > + SymbolStream &SymRecords = cantFail(getPdb().getPDBSymbolStream());<br>
>> > + auto &Types = File.types();<br>
>> > + auto &Ids = File.ids();<br>
>> > +<br>
>> > + SymbolVisitorCallbackPipeline Pipeline;<br>
>> > + SymbolDeserializer Deserializer(nullptr, CodeViewContainer::Pdb);<br>
>> > + MinimalSymbolDumper Dumper(P, opts::dump::DumpSymRecordBytes, Ids, Types);<br>
>> > +<br>
>> > + Pipeline.addCallbackToPipeline(Deserializer);<br>
>> > + Pipeline.addCallbackToPipeline(Dumper);<br>
>> > + CVSymbolVisitor Visitor(Pipeline);<br>
>> > +<br>
>> > + using ResultEntryType = std::pair<uint32_t, CVSymbol>;<br>
>> > + for (StringRef Name : opts::dump::DumpGlobalNames) {<br>
>> > + AutoIndent Indent(P);<br>
>> > + P.formatLine("Global Name `{0}`", Name);<br>
>> > + std::vector<ResultEntryType> Results =<br>
>> > + Globals.findRecordsByName(Name, SymRecords);<br>
>> > + if (Results.empty()) {<br>
>> > + AutoIndent Indent(P);<br>
>> > + P.printLine("(no matching records found)");<br>
>> > + continue;<br>
>> > + }<br>
>> > +<br>
>> > + for (ResultEntryType Result : Results) {<br>
>> > + if (auto E = Visitor.visitSymbolRecord(Result.second, Result.first))<br>
>> > + return E;<br>
>> > + }<br>
>> > + }<br>
>> > + }<br>
>> > return Error::success();<br>
>> > }<br>
>> > <br>
>> > @@ -1676,7 +1708,10 @@ Error DumpOutputStyle::dumpSymbolsFromGS<br>
>> > <br>
>> > // Return early if we aren't dumping public hash table and address map info.<br>
>> > if (HashExtras) {<br>
>> > - P.formatBinary("Hash Bitmap", Table.HashBitmap, 0);<br>
>> > + ArrayRef<uint8_t> BitmapBytes(<br>
>> > + reinterpret_cast<const uint8_t *>(Table.HashBitmap.data()),<br>
>> > + Table.HashBitmap.size() * sizeof(uint32_t));<br>
>> > + P.formatBinary("Hash Bitmap", BitmapBytes, 0);<br>
>> > <br>
>> > P.formatLine("Hash Entries");<br>
>> > {<br>
>> ><br>
>> > Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp (original)<br>
>> > +++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp Sun Oct 7 21:19:16 2018<br>
>> > @@ -526,6 +526,11 @@ cl::opt<bool> DumpGlobals("globals", cl:<br>
>> > cl::cat(SymbolOptions), cl::sub(DumpSubcommand));<br>
>> > cl::opt<bool> DumpGlobalExtras("global-extras", cl::desc("dump Globals hashes"),<br>
>> > cl::cat(SymbolOptions), cl::sub(DumpSubcommand));<br>
>> > +cl::list<std::string> DumpGlobalNames(<br>
>> > + "global-name",<br>
>> > + cl::desc(<br>
>> > + "With -globals, only dump globals whose name matches the given value"),<br>
>> > + cl::cat(SymbolOptions), cl::sub(DumpSubcommand), cl::ZeroOrMore);<br>
>> > cl::opt<bool> DumpPublics("publics", cl::desc("dump Publics stream data"),<br>
>> > cl::cat(SymbolOptions), cl::sub(DumpSubcommand));<br>
>> > cl::opt<bool> DumpPublicExtras("public-extras",<br>
>> ><br>
>> > Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h<br>
>> > URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h?rev=343951&r1=343950&r2=343951&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h?rev=343951&r1=343950&r2=343951&view=diff</a><br>
>> > ==============================================================================<br>
>> > --- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h (original)<br>
>> > +++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.h Sun Oct 7 21:19:16 2018<br>
>> > @@ -169,6 +169,7 @@ extern llvm::cl::opt<bool> DumpSymbols;<br>
>> > extern llvm::cl::opt<bool> DumpSymRecordBytes;<br>
>> > extern llvm::cl::opt<bool> DumpGSIRecords;<br>
>> > extern llvm::cl::opt<bool> DumpGlobals;<br>
>> > +extern llvm::cl::list<std::string> DumpGlobalNames;<br>
>> > extern llvm::cl::opt<bool> DumpGlobalExtras;<br>
>> > extern llvm::cl::opt<bool> DumpPublics;<br>
>> > extern llvm::cl::opt<bool> DumpPublicExtras;<br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > llvm-commits mailing list<br>
>> > <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a> <mailto:<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>><br>
>> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
>> ><br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
>><br>
> <br>
> <br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
> <br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>