35 std::list<llvm::Regex> &IncludeFilters,
36 std::list<llvm::Regex> &ExcludeFilters) {
40 auto match_pred = [Item](
llvm::Regex &
R) {
return R.match(Item); };
44 if (!IncludeFilters.empty() && !
any_of(IncludeFilters, match_pred))
47 if (
any_of(ExcludeFilters, match_pred))
60 SetFilters(ExcludeTypeFilters, Filters.
ExcludeTypes.begin(),
67 SetFilters(IncludeTypeFilters, Filters.
IncludeTypes.begin(),
77 Amount = IndentSpaces;
78 CurrentIndent += Amount;
83 Amount = IndentSpaces;
84 CurrentIndent = std::max<int>(0, CurrentIndent - Amount);
114 CurrentIndent + IndentSpaces,
true);
128 CurrentIndent + IndentSpaces,
true);
145 std::vector<Run> Runs;
153 Runs.emplace_back(CurrentBlock);
155 Run *CurrentRun = &Runs.back();
157 if (NextBlock < CurrentBlock || (NextBlock - CurrentBlock > 1)) {
158 Runs.emplace_back(NextBlock);
159 CurrentRun = &Runs.back();
163 CurrentRun->ByteLen += Used;
164 StreamBytesRemaining -= Used;
165 CurrentBlock = NextBlock;
172 for (
const auto &R : Runs) {
174 return std::make_pair(R,
Offset);
184 if (StreamIdx >= File.getNumStreams()) {
185 formatLine(
"Stream {0}: Not present", StreamIdx);
188 if (
Size +
Offset > File.getStreamByteSize(StreamIdx)) {
190 "Stream {0}: Invalid offset and size, range out of stream bounds",
195 auto S = File.createIndexedStream(StreamIdx);
198 formatLine(
"Stream {0}: Not present", StreamIdx);
203 (
Size == 0) ? S->getLength() : std::min(
Offset +
Size, S->getLength());
206 formatLine(
"Stream {0}: {1} (dumping {2:N} / {3:N} bytes)", StreamIdx,
207 StreamPurpose,
Size, S->getLength());
214 auto Layout = File.getStreamLayout(StreamIdx);
232 std::tie(FoundRun, RunOffset) =
findRun(Substream.
Offset, Runs);
233 assert(FoundRun.ByteLen >= RunOffset);
234 uint64_t Len = FoundRun.ByteLen - RunOffset;
236 uint64_t Base = FoundRun.Block * File.getBlockSize() + RunOffset;
240 CurrentIndent + IndentSpaces,
true);
262 std::min(L,
static_cast<uint64_t>(File.getBlockSize()));
266 BaseOffset *= File.getBlockSize();
268 CurrentIndent + IndentSpaces,
true);
278 if (IsItemExcluded(TypeName, IncludeTypeFilters, ExcludeTypeFilters))
286 return IsItemExcluded(SymbolName, IncludeSymbolFilters, ExcludeSymbolFilters);
290 return IsItemExcluded(CompilandName, IncludeCompilandFilters,
291 ExcludeCompilandFilters);
DenseMap< Block *, BlockRelaxAux > Blocks
static std::pair< Run, uint64_t > findRun(uint64_t Offset, ArrayRef< Run > Runs)
static std::vector< Run > computeBlockRuns(uint32_t BlockSize, const msf::MSFStreamLayout &Layout)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static const int BlockSize
static ManagedStatic< cl::opt< cl::boolOrDefault >, CreateUseColor > UseColor
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Provides read only access to a subclass of BinaryStream.
Error readBytes(ArrayRef< uint8_t > &Buffer, uint32_t Size)
Read Size bytes from the underlying stream at the current offset and and set Buffer to the resulting ...
uint64_t bytesRemaining() const
RefType drop_front(uint64_t N) const
Return a new BinaryStreamRef with the first N elements removed.
RefType keep_front(uint64_t N) const
Return a new BinaryStreamRef with only the first N elements remaining.
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Describes the layout of a stream in an MSF layout.
std::vector< support::ulittle32_t > Blocks
void print(const Twine &T)
void printLine(const Twine &T)
void Unindent(uint32_t Amount=0)
void formatMsfStreamData(StringRef Label, PDBFile &File, uint32_t StreamIdx, StringRef StreamPurpose, uint64_t Offset, uint64_t Size)
bool IsSymbolExcluded(llvm::StringRef SymbolName)
LinePrinter(int Indent, bool UseColor, raw_ostream &Stream, const FilterOptions &Filters)
void formatMsfStreamBlocks(PDBFile &File, const msf::MSFStreamLayout &Stream)
void formatLine(const char *Fmt, Ts &&...Items)
void formatBinary(StringRef Label, ArrayRef< uint8_t > Data, uint64_t StartOffset)
bool IsTypeExcluded(llvm::StringRef TypeName, uint64_t Size)
bool IsClassExcluded(const ClassLayout &Class)
bool IsCompilandExcluded(llvm::StringRef CompilandName)
void Indent(uint32_t Amount=0)
WithColor(LinePrinter &P, PDB_ColorItem C)
This class implements an extremely fast bulk output stream that can only output to a stream.
static constexpr Colors YELLOW
static constexpr Colors CYAN
virtual raw_ostream & changeColor(enum Colors Color, bool Bold=false, bool BG=false)
Changes the foreground color of text that will be output from this point forward.
virtual raw_ostream & resetColor()
Resets the colors to terminal defaults.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
static constexpr Colors MAGENTA
static constexpr Colors GREEN
static constexpr Colors RED
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
auto formatv(const char *Fmt, Ts &&...Vals) -> formatv_object< decltype(std::make_tuple(support::detail::build_format_adapter(std::forward< Ts >(Vals))...))>
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
FormattedBytes format_bytes_with_ascii(ArrayRef< uint8_t > Bytes, std::optional< uint64_t > FirstByteOffset=std::nullopt, uint32_t NumPerLine=16, uint8_t ByteGroupSize=4, uint32_t IndentLevel=0, bool Upper=false)
support::detail::AlignAdapter< T > fmt_align(T &&Item, AlignStyle Where, size_t Amount, char Fill=' ')
void consumeError(Error Err)
Consume a Error without doing anything.
std::list< std::string > IncludeCompilands
std::list< std::string > IncludeTypes
std::list< std::string > IncludeSymbols
std::list< std::string > ExcludeTypes
uint32_t PaddingThreshold
std::list< std::string > ExcludeCompilands
std::list< std::string > ExcludeSymbols
BinaryStreamRef StreamData