bloaty.h
Go to the documentation of this file.
1 // Copyright 2016 Google Inc. All Rights Reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 // This file contains APIs for use within Bloaty. None of these APIs have any
16 // guarantees whatsoever about their stability! The public API for bloaty is
17 // its command-line interface.
18 
19 #ifndef BLOATY_H_
20 #define BLOATY_H_
21 
22 #include <stdlib.h>
23 #define __STDC_LIMIT_MACROS
24 #define __STDC_FORMAT_MACROS
25 #include <stdint.h>
26 #include <inttypes.h>
27 
28 #include <memory>
29 #include <set>
30 #include <string>
31 #include <unordered_map>
32 #include <vector>
33 
34 #include "absl/strings/string_view.h"
35 #include "absl/strings/strip.h"
36 #include "capstone/capstone.h"
37 
38 #include "dwarf/debug_info.h"
39 #include "bloaty.pb.h"
40 #include "range_map.h"
41 #include "re.h"
42 
43 namespace bloaty {
44 
45 extern int verbose_level;
46 
47 class NameMunger;
48 class Options;
49 struct DualMap;
50 struct DisassemblyInfo;
51 
52 enum class DataSource {
55  kInlines,
57  kRawRanges,
58  kSections,
59  kSegments,
60 
61  // We always set this to one of the concrete symbol types below before
62  // setting it on a sink.
63  kSymbols,
64 
68 };
69 
70 class InputFile {
71  public:
73  InputFile(const InputFile&) = delete;
74  InputFile& operator=(const InputFile&) = delete;
75  virtual ~InputFile() {}
76 
77  const std::string& filename() const { return filename_; }
78  absl::string_view data() const { return data_; }
79 
80  private:
82 
83  protected:
85 };
86 
88  public:
89  virtual ~InputFileFactory() {}
90 
91  // Throws if the file could not be opened.
92  virtual std::unique_ptr<InputFile> OpenFile(
93  const std::string& filename) const = 0;
94 };
95 
97  public:
98  std::unique_ptr<InputFile> OpenFile(
99  const std::string& filename) const override;
100 };
101 
102 // NOTE: all sizes are uint64, even on 32-bit platforms:
103 // - 32-bit platforms can have files >4GB in some cases.
104 // - for object files (not executables/shared libs) we pack both a section
105 // index and an address into the "vmaddr" value, and we need enough bits to
106 // safely do this.
107 
108 // A RangeSink allows data sources to assign labels to ranges of VM address
109 // space and/or file offsets.
110 class RangeSink {
111 public:
112  RangeSink(const InputFile *file, const Options &options,
113  DataSource data_source, const DualMap *translator,
115  RangeSink(const RangeSink &) = delete;
116  RangeSink &operator=(const RangeSink &) = delete;
117  ~RangeSink();
118 
119  const Options &options() const { return options_; }
120 
121  void AddOutput(DualMap *map, const NameMunger *munger);
122 
123  DataSource data_source() const { return data_source_; }
124  const InputFile &input_file() const { return *file_; }
125  bool IsBaseMap() const { return translator_ == nullptr; }
126 
127  // If vmsize or filesize is zero, this mapping is presumed not to exist in
128  // that domain. For example, .bss mappings don't exist in the file, and
129  // .debug_* mappings don't exist in memory.
130  void AddRange(const char *analyzer, absl::string_view name, uint64_t vmaddr,
131  uint64_t vmsize, uint64_t fileoff, uint64_t filesize);
132 
133  void AddRange(const char *analyzer, absl::string_view name, uint64_t vmaddr,
134  uint64_t vmsize, absl::string_view file_range) {
135  AddRange(analyzer, name, vmaddr, vmsize,
136  file_range.data() - file_->data().data(), file_range.size());
137  }
138 
139  void AddFileRange(const char* analyzer, absl::string_view name,
140  uint64_t fileoff, uint64_t filesize);
141 
142  // Like AddFileRange(), but the label is whatever label was previously
143  // assigned to VM address |label_from_vmaddr|. If no existing label is
144  // assigned to |label_from_vmaddr|, this function does nothing.
145  void AddFileRangeForVMAddr(const char* analyzer, uint64_t label_from_vmaddr,
146  absl::string_view file_range);
147  void AddVMRangeForVMAddr(const char* analyzer, uint64_t label_from_vmaddr,
149 
150  // Applies this label from |from_file_range| to |file_range|, but only if the
151  // entire |from_file_range| has a single label. If not, this does nothing.
152  void AddFileRangeForFileRange(const char* analyzer,
153  absl::string_view from_file_range,
154  absl::string_view file_range);
155 
156  void AddFileRange(const char* analyzer, absl::string_view name,
157  absl::string_view file_range) {
158  // When separate debug files are being used, the DWARF analyzer will try to
159  // add sections of the debug file. We want to prevent this because we only
160  // want to profile the main file (not the debug file), so we filter these
161  // out. This approach is simple to implement, but does result in some
162  // useless work being done. We may want to avoid doing this useless work in
163  // the first place.
164  if (FileContainsPointer(file_range.data())) {
165  AddFileRange(analyzer, name, file_range.data() - file_->data().data(),
166  file_range.size());
167  }
168  }
169 
170  // The VM-only functions below may not be used to populate the base map!
171 
172  // Adds a region to the memory map. It should not overlap any previous
173  // region added with Add(), but it should overlap the base memory map.
174  void AddVMRange(const char* analyzer, uint64_t vmaddr, uint64_t vmsize,
175  const std::string& name);
176 
177  // Like Add(), but allows that this addr/size might have previously been added
178  // already under a different name. If so, this name becomes an alias of the
179  // previous name.
180  //
181  // This is for things like symbol tables that sometimes map multiple names to
182  // the same physical function.
183  void AddVMRangeAllowAlias(const char* analyzer, uint64_t vmaddr,
184  uint64_t size, const std::string& name);
185 
186  // Like Add(), but allows that this addr/size might have previously been added
187  // already under a different name. If so, this add is simply ignored.
188  //
189  // This is for cases like sourcefiles. Sometimes a single function appears to
190  // come from multiple source files. But if it does, we don't want to alias
191  // the entire source file to another, because it's probably only part of the
192  // source file that overlaps.
193  void AddVMRangeIgnoreDuplicate(const char* analyzer, uint64_t vmaddr,
194  uint64_t size, const std::string& name);
195 
196  const DualMap& MapAtIndex(size_t index) const {
197  return *outputs_[index].first;
198  }
199 
200  // Translates the given pointer (which must be within the range of
201  // input_file().data()) to a VM address.
202  uint64_t TranslateFileToVM(const char* ptr);
204 
205  // Decompresses zlib-formatted data and returns the decompressed data.
206  // Since the decompressed data is not actually part of the file, any
207  // Add*Range() calls to this region will be no-ops.
209  uint64_t uncompressed_size);
210 
212 
213  private:
214  bool FileContainsPointer(const void* ptr) const {
216  return ptr >= file_data.data() && ptr < file_data.data() + file_data.size();
217  }
218 
219  bool ContainsVerboseVMAddr(uint64_t vmaddr, uint64_t vmsize);
220  bool ContainsVerboseFileOffset(uint64_t fileoff, uint64_t filesize);
221  bool IsVerboseForVMRange(uint64_t vmaddr, uint64_t vmsize);
222  bool IsVerboseForFileRange(uint64_t fileoff, uint64_t filesize);
223 
224  const InputFile* file_;
225  const Options options_;
228  std::vector<std::pair<DualMap*, const NameMunger*>> outputs_;
230 };
231 
232 // NameMunger //////////////////////////////////////////////////////////////////
233 
234 // Use to transform input names according to the user's configuration.
235 // For example, the user can use regexes.
236 class NameMunger {
237  public:
239  NameMunger(const NameMunger&) = delete;
240  NameMunger& operator=(const NameMunger&) = delete;
241 
242  // Adds a regex that will be applied to all names. All regexes will be
243  // applied in sequence.
244  void AddRegex(const std::string& regex, const std::string& replacement);
246 
247  bool IsEmpty() const { return regexes_.empty(); }
248 
249  private:
250  std::vector<std::pair<std::unique_ptr<ReImpl>, std::string>> regexes_;
251 };
252 
253 typedef std::map<absl::string_view, std::pair<uint64_t, uint64_t>> SymbolTable;
254 
255 // Represents an object/executable file in a format like ELF, Mach-O, PE, etc.
256 // To support a new file type, implement this interface.
257 class ObjectFile {
258  public:
259  ObjectFile(std::unique_ptr<InputFile> file_data)
260  : file_data_(std::move(file_data)), debug_file_(this) {}
261  virtual ~ObjectFile() {}
262 
263  virtual std::string GetBuildId() const = 0;
264 
265  // Process this file, pushing data to |sinks| as appropriate for each data
266  // source. If any debug files match the build id for this file, it will be
267  // given here, otherwise it is |this|.
268  virtual void ProcessFile(const std::vector<RangeSink*>& sinks) const = 0;
269 
270  virtual bool GetDisassemblyInfo(absl::string_view symbol,
271  DataSource symbol_source,
272  DisassemblyInfo* info) const = 0;
273 
274  const InputFile& file_data() const { return *file_data_; }
275 
276  // Sets the debug file for |this|. |file| must outlive this instance.
278  assert(debug_file_->GetBuildId() == GetBuildId());
279  debug_file_ = file;
280  }
281 
282  const ObjectFile& debug_file() const { return *debug_file_; }
283 
284  private:
285  std::unique_ptr<InputFile> file_data_;
287 };
288 
289 std::unique_ptr<ObjectFile> TryOpenELFFile(std::unique_ptr<InputFile>& file);
290 std::unique_ptr<ObjectFile> TryOpenMachOFile(std::unique_ptr<InputFile>& file);
291 std::unique_ptr<ObjectFile> TryOpenWebAssemblyFile(std::unique_ptr<InputFile>& file);
292 std::unique_ptr<ObjectFile> TryOpenPEFile(std::unique_ptr<InputFile>& file);
293 
294 // Provided by dwarf.cc. To use these, a module should fill in a dwarf::File
295 // and then call these functions.
296 void ReadDWARFCompileUnits(const dwarf::File& file, const DualMap& map,
297  RangeSink* sink);
299  bool include_line);
302 
303 // Demangle C++ symbols according to the Itanium ABI. The |source| argument
304 // controls what demangling mode we are using.
306 
307 
308 // DualMap /////////////////////////////////////////////////////////////////////
309 
310 // Contains a RangeMap for VM space and file space for a given file.
311 
312 struct DualMap {
315 };
316 
323 };
324 
327 
328 // Top-level API ///////////////////////////////////////////////////////////////
329 
330 // This should only be used by main.cc and unit tests.
331 
332 class Rollup;
333 
334 struct RollupRow {
336 
344  double vmpercent;
345  double filepercent;
346  std::vector<RollupRow> sorted_children;
347 
348  static bool Compare(const RollupRow& a, const RollupRow& b) {
349  // Sort value high-to-low.
350  if (a.sortkey != b.sortkey) {
351  return a.sortkey > b.sortkey;
352  }
353  // Sort name low to high.
354  return a.name < b.name;
355  }
356 };
357 
358 enum class OutputFormat {
359  kPrettyPrint,
360  kCSV,
361  kTSV,
362 };
363 
364 enum class ShowDomain {
365  kShowFile,
366  kShowVM,
367  kShowBoth,
368 };
369 
372  size_t max_label_len = 80;
374 };
375 
376 struct RollupOutput {
377  public:
378  RollupOutput() : toplevel_row_("TOTAL") {}
379  RollupOutput(const RollupOutput&) = delete;
380  RollupOutput& operator=(const RollupOutput&) = delete;
381 
383  source_names_.emplace_back(std::string(name));
384  }
385 
386  const std::vector<std::string>& source_names() const { return source_names_; }
387  void Print(const OutputOptions& options, std::ostream* out);
388  void SetDisassembly(absl::string_view disassembly) {
389  disassembly_ = std::string(disassembly);
390  }
391 
393 
394  // For debugging.
395  const RollupRow& toplevel_row() const { return toplevel_row_; }
396  bool diff_mode() const { return diff_mode_; }
397 
398  private:
399  friend class Rollup;
400 
401  std::vector<std::string> source_names_;
404 
405  // When we are in diff mode, rollup sizes are relative to the baseline.
406  bool diff_mode_ = false;
407 
408  static bool IsSame(const std::string& a, const std::string& b);
409  void PrettyPrint(const OutputOptions& options, std::ostream* out) const;
410  void PrintToCSV(std::ostream* out, bool tabs) const;
411  void PrettyPrintRow(const RollupRow& row, size_t indent,
412  const OutputOptions& options, std::ostream* out) const;
413  void PrettyPrintTree(const RollupRow& row, size_t indent,
414  const OutputOptions& options, std::ostream* out) const;
415  void PrintRowToCSV(const RollupRow& row,
416  std::vector<std::string> parent_labels,
417  std::ostream* out, bool tabs) const;
418  void PrintTreeToCSV(const RollupRow& row,
419  std::vector<std::string> parent_labels,
420  std::ostream* out, bool tabs) const;
421 };
422 
423 bool ParseOptions(bool skip_unknown, int* argc, char** argv[], Options* options,
424  OutputOptions* output_options, std::string* error);
425 bool BloatyMain(const Options& options, const InputFileFactory& file_factory,
427 
428 } // namespace bloaty
429 
430 #endif
ptr
char * ptr
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:45
bloaty::RangeSink::AddFileRangeForFileRange
void AddFileRangeForFileRange(const char *analyzer, absl::string_view from_file_range, absl::string_view file_range)
Definition: bloaty.cc:1139
bloaty::RangeSink::AddFileRange
void AddFileRange(const char *analyzer, absl::string_view name, uint64_t fileoff, uint64_t filesize)
Definition: bloaty.cc:1088
bloaty::RollupRow::filepercent
double filepercent
Definition: bloaty.h:345
bloaty::RangeSink::arena_
google::protobuf::Arena * arena_
Definition: bloaty.h:229
bloaty::NameMunger::regexes_
std::vector< std::pair< std::unique_ptr< ReImpl >, std::string > > regexes_
Definition: bloaty.h:250
filename
const char * filename
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:135
bloaty
Definition: bloaty.cc:69
bloaty::RollupOutput::RollupOutput
RollupOutput()
Definition: bloaty.h:378
gen_build_yaml.out
dictionary out
Definition: src/benchmark/gen_build_yaml.py:24
Arena
struct Arena Arena
Definition: third_party/bloaty/third_party/protobuf/src/google/protobuf/arena.h:189
bloaty::OutputFormat
OutputFormat
Definition: bloaty.h:358
bloaty::RollupOutput::diff_mode_
bool diff_mode_
Definition: bloaty.h:406
bloaty::RangeSink::translator_
const DualMap * translator_
Definition: bloaty.h:227
bloaty::RollupOutput::source_names_
std::vector< std::string > source_names_
Definition: bloaty.h:401
bloaty::InputFileFactory::OpenFile
virtual std::unique_ptr< InputFile > OpenFile(const std::string &filename) const =0
bloaty::DisassemblyInfo::symbol_map
DualMap symbol_map
Definition: bloaty.h:319
bloaty::NameMunger::operator=
NameMunger & operator=(const NameMunger &)=delete
file
const grpc_generator::File * file
Definition: python_private_generator.h:38
bloaty::InputFile::filename
const std::string & filename() const
Definition: bloaty.h:77
bloaty::NameMunger::Munge
std::string Munge(absl::string_view name) const
Definition: bloaty.cc:213
bloaty::OutputFormat::kTSV
@ kTSV
bloaty::RangeSink::MapAtIndex
const DualMap & MapAtIndex(size_t index) const
Definition: bloaty.h:196
bloaty::NameMunger::NameMunger
NameMunger()
Definition: bloaty.h:238
bloaty::ObjectFile
Definition: bloaty.h:257
bloaty::RollupOutput::PrettyPrint
void PrettyPrint(const OutputOptions &options, std::ostream *out) const
Definition: bloaty.cc:755
bloaty::DataSource::kShortSymbols
@ kShortSymbols
bloaty::verbose_level
int verbose_level
Definition: bloaty.cc:74
bloaty::DualMap::vm_map
RangeMap vm_map
Definition: bloaty.h:313
bloaty::RangeMap::kUnknownSize
static constexpr uint64_t kUnknownSize
Definition: range_map.h:154
options
double_dict options[]
Definition: capstone_test.c:55
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
bloaty::RollupOutput::source_names
const std::vector< std::string > & source_names() const
Definition: bloaty.h:386
bloaty::ObjectFile::~ObjectFile
virtual ~ObjectFile()
Definition: bloaty.h:261
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
error
grpc_error_handle error
Definition: retry_filter.cc:499
bloaty::DisassembleFunction
std::string DisassembleFunction(const DisassemblyInfo &info)
Definition: disassemble.cc:135
bloaty::BloatyMain
bool BloatyMain(const Options &options, const InputFileFactory &file_factory, RollupOutput *output, std::string *error)
Definition: bloaty.cc:2196
bloaty::DataSource::kArchiveMembers
@ kArchiveMembers
file
Definition: bloaty/third_party/zlib/examples/gzappend.c:170
cs_arch
cs_arch
Architecture type.
Definition: capstone.h:74
bloaty::RollupOutput
Definition: bloaty.h:376
setup.name
name
Definition: setup.py:542
bloaty::RollupOutput::operator=
RollupOutput & operator=(const RollupOutput &)=delete
bloaty::RollupOutput::GetDisassembly
absl::string_view GetDisassembly()
Definition: bloaty.h:392
bloaty::RangeSink::AddVMRange
void AddVMRange(const char *analyzer, uint64_t vmaddr, uint64_t vmsize, const std::string &name)
Definition: bloaty.cc:1197
bloaty::RangeSink::IsVerboseForFileRange
bool IsVerboseForFileRange(uint64_t fileoff, uint64_t filesize)
Definition: bloaty.cc:1053
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
bloaty::RangeSink::AddFileRange
void AddFileRange(const char *analyzer, absl::string_view name, absl::string_view file_range)
Definition: bloaty.h:156
python_utils.upload_rbe_results.indent
indent
Definition: upload_rbe_results.py:183
bloaty::DisassemblyInfo::mode
cs_mode mode
Definition: bloaty.h:321
name_
const std::string name_
Definition: priority.cc:233
bloaty::RangeSink::operator=
RangeSink & operator=(const RangeSink &)=delete
bloaty::DisassemblyInfo::start_address
uint64_t start_address
Definition: bloaty.h:322
bloaty::DataSource::kSegments
@ kSegments
map
zval * map
Definition: php/ext/google/protobuf/encode_decode.c:480
bloaty::RollupOutput::diff_mode
bool diff_mode() const
Definition: bloaty.h:396
bloaty::RollupRow::filesize
int64_t filesize
Definition: bloaty.h:339
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
bloaty::ObjectFile::file_data_
std::unique_ptr< InputFile > file_data_
Definition: bloaty.h:285
versiongenerate.file_data
string file_data
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/xcode/Scripts/versiongenerate.py:84
bloaty::RangeMap
Definition: range_map.h:46
bloaty::InputFile::~InputFile
virtual ~InputFile()
Definition: bloaty.h:75
bloaty::RangeSink::TranslateVMToFile
absl::string_view TranslateVMToFile(uint64_t address)
Definition: bloaty.cc:1282
bloaty::RangeSink::data_source
DataSource data_source() const
Definition: bloaty.h:123
cs_mode
cs_mode
Mode type.
Definition: capstone.h:103
bloaty::ObjectFile::ProcessFile
virtual void ProcessFile(const std::vector< RangeSink * > &sinks) const =0
bloaty::DisassemblyInfo::arch
cs_arch arch
Definition: bloaty.h:320
bloaty::ObjectFile::GetBuildId
virtual std::string GetBuildId() const =0
capstone.h
bloaty::ItaniumDemangle
std::string ItaniumDemangle(string_view symbol, DataSource source)
Definition: bloaty.cc:169
bloaty::RangeSink::AddFileRangeForVMAddr
void AddFileRangeForVMAddr(const char *analyzer, uint64_t label_from_vmaddr, absl::string_view file_range)
Definition: bloaty.cc:1112
bloaty::RangeSink::file_
const InputFile * file_
Definition: bloaty.h:224
bloaty::ObjectFile::file_data
const InputFile & file_data() const
Definition: bloaty.h:274
bloaty::RollupOutput::PrintToCSV
void PrintToCSV(std::ostream *out, bool tabs) const
Definition: bloaty.cc:844
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
bloaty::RangeSink::kUnknownSize
static constexpr uint64_t kUnknownSize
Definition: bloaty.h:211
bloaty::RangeSink::outputs_
std::vector< std::pair< DualMap *, const NameMunger * > > outputs_
Definition: bloaty.h:228
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
absl::string_view::size
constexpr size_type size() const noexcept
Definition: abseil-cpp/absl/strings/string_view.h:277
bloaty::TryOpenPEFile
std::unique_ptr< ObjectFile > TryOpenPEFile(std::unique_ptr< InputFile > &file)
Definition: pe.cc:276
gmock_output_test.output
output
Definition: bloaty/third_party/googletest/googlemock/test/gmock_output_test.py:175
bloaty::OutputOptions
Definition: bloaty.h:370
bloaty::OutputFormat::kCSV
@ kCSV
bloaty::OutputFormat::kPrettyPrint
@ kPrettyPrint
bloaty::RollupRow::other_count
int64_t other_count
Definition: bloaty.h:342
bloaty::RangeSink::RangeSink
RangeSink(const InputFile *file, const Options &options, DataSource data_source, const DualMap *translator, google::protobuf::Arena *arena)
Definition: bloaty.cc:999
bloaty::DataSource::kRawRanges
@ kRawRanges
bloaty::NameMunger
Definition: bloaty.h:236
bloaty::InputFile::operator=
InputFile & operator=(const InputFile &)=delete
bloaty::ParseOptions
bool ParseOptions(bool skip_unknown, int *argc, char **argv[], Options *options, OutputOptions *output_options, std::string *error)
Definition: bloaty.cc:2138
bloaty::ObjectFile::debug_file_
const ObjectFile * debug_file_
Definition: bloaty.h:286
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
bloaty::RangeSink::data_source_
DataSource data_source_
Definition: bloaty.h:226
bloaty::RangeSink::IsBaseMap
bool IsBaseMap() const
Definition: bloaty.h:125
bloaty::OutputOptions::output_format
OutputFormat output_format
Definition: bloaty.h:371
bloaty::InputFile::data_
absl::string_view data_
Definition: bloaty.h:84
bloaty::RollupOutput::toplevel_row_
RollupRow toplevel_row_
Definition: bloaty.h:402
bloaty::RollupRow::sorted_children
std::vector< RollupRow > sorted_children
Definition: bloaty.h:346
bloaty::RollupOutput::PrintTreeToCSV
void PrintTreeToCSV(const RollupRow &row, std::vector< std::string > parent_labels, std::ostream *out, bool tabs) const
Definition: bloaty.cc:826
bloaty::RollupOutput::SetDisassembly
void SetDisassembly(absl::string_view disassembly)
Definition: bloaty.h:388
bloaty::RangeSink
Definition: bloaty.h:110
bloaty::DataSource::kCompileUnits
@ kCompileUnits
bloaty::ReadEhFrameHdr
void ReadEhFrameHdr(absl::string_view contents, RangeSink *sink)
Definition: eh_frame.cc:230
bloaty::Rollup
Definition: bloaty.cc:253
bloaty::DataSource::kInlines
@ kInlines
bloaty::DataSource
DataSource
Definition: bloaty.h:52
bloaty::RollupOutput::AddDataSourceName
void AddDataSourceName(absl::string_view name)
Definition: bloaty.h:382
b
uint64_t b
Definition: abseil-cpp/absl/container/internal/layout_test.cc:53
bloaty::ShowDomain::kShowBoth
@ kShowBoth
bloaty::RollupRow::name
std::string name
Definition: bloaty.h:337
stdint.h
bloaty::DualMap
Definition: bloaty.h:312
bloaty::RangeSink::input_file
const InputFile & input_file() const
Definition: bloaty.h:124
re.h
bloaty::TryOpenELFFile
std::unique_ptr< ObjectFile > TryOpenELFFile(std::unique_ptr< InputFile > &file)
Definition: elf.cc:1403
bloaty::DisassemblyInfo::text
absl::string_view text
Definition: bloaty.h:318
bloaty::RollupOutput::PrettyPrintTree
void PrettyPrintTree(const RollupRow &row, size_t indent, const OutputOptions &options, std::ostream *out) const
Definition: bloaty.cc:734
bloaty::TryOpenWebAssemblyFile
std::unique_ptr< ObjectFile > TryOpenWebAssemblyFile(std::unique_ptr< InputFile > &file)
Definition: webassembly.cc:380
bloaty::RollupRow::vmsize
int64_t vmsize
Definition: bloaty.h:338
bloaty::RangeSink::ContainsVerboseVMAddr
bool ContainsVerboseVMAddr(uint64_t vmaddr, uint64_t vmsize)
Definition: bloaty.cc:1010
bloaty::RangeSink::AddVMRangeForVMAddr
void AddVMRangeForVMAddr(const char *analyzer, uint64_t label_from_vmaddr, uint64_t addr, uint64_t size)
Definition: bloaty.cc:1170
bloaty::ObjectFile::debug_file
const ObjectFile & debug_file() const
Definition: bloaty.h:282
bloaty::RangeSink::ZlibDecompress
absl::string_view ZlibDecompress(absl::string_view contents, uint64_t uncompressed_size)
Definition: bloaty.cc:1292
bloaty::InputFileFactory::~InputFileFactory
virtual ~InputFileFactory()
Definition: bloaty.h:89
contents
string_view contents
Definition: elf.cc:597
bloaty::InputFile::filename_
const std::string filename_
Definition: bloaty.h:81
bloaty::RollupOutput::toplevel_row
const RollupRow & toplevel_row() const
Definition: bloaty.h:395
bloaty::RollupRow::RollupRow
RollupRow(const std::string &name_)
Definition: bloaty.h:335
bloaty::RangeSink::AddRange
void AddRange(const char *analyzer, absl::string_view name, uint64_t vmaddr, uint64_t vmsize, absl::string_view file_range)
Definition: bloaty.h:133
bloaty::DualMap::file_map
RangeMap file_map
Definition: bloaty.h:314
bloaty::DataSource::kSymbols
@ kSymbols
sink
FormatSinkImpl * sink
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:450
bloaty::InputFile::InputFile
InputFile(const std::string &filename)
Definition: bloaty.h:72
bloaty::DisassembleFindReferences
void DisassembleFindReferences(const DisassemblyInfo &info, RangeSink *sink)
Definition: disassemble.cc:43
bloaty::DataSource::kInputFiles
@ kInputFiles
bloaty::NameMunger::AddRegex
void AddRegex(const std::string &regex, const std::string &replacement)
Definition: bloaty.cc:208
bloaty::RangeSink::FileContainsPointer
bool FileContainsPointer(const void *ptr) const
Definition: bloaty.h:214
index
int index
Definition: bloaty/third_party/protobuf/php/ext/google/protobuf/protobuf.h:1184
bloaty::RangeSink::IsVerboseForVMRange
bool IsVerboseForVMRange(uint64_t vmaddr, uint64_t vmsize)
Definition: bloaty.cc:1022
debug_info.h
bloaty::MmapInputFileFactory
Definition: bloaty.h:96
std
Definition: grpcpp/impl/codegen/async_unary_call.h:407
bloaty::RangeSink::options_
const Options options_
Definition: bloaty.h:225
bloaty::ShowDomain::kShowVM
@ kShowVM
bloaty::DisassemblyInfo
Definition: bloaty.h:317
bloaty::TryOpenMachOFile
std::unique_ptr< ObjectFile > TryOpenMachOFile(std::unique_ptr< InputFile > &file)
Definition: macho.cc:610
bloaty::ReadEhFrame
void ReadEhFrame(absl::string_view contents, RangeSink *sink)
Definition: eh_frame.cc:125
bloaty::SymbolTable
std::map< absl::string_view, std::pair< uint64_t, uint64_t > > SymbolTable
Definition: bloaty.h:253
bloaty::RangeSink::AddRange
void AddRange(const char *analyzer, absl::string_view name, uint64_t vmaddr, uint64_t vmsize, uint64_t fileoff, uint64_t filesize)
Definition: bloaty.cc:1232
bloaty::RollupOutput::Print
void Print(const OutputOptions &options, std::ostream *out)
Definition: bloaty.cc:673
range_map.h
bloaty::ObjectFile::ObjectFile
ObjectFile(std::unique_ptr< InputFile > file_data)
Definition: bloaty.h:259
bloaty::ObjectFile::set_debug_file
void set_debug_file(const ObjectFile *file)
Definition: bloaty.h:277
bloaty::RangeSink::~RangeSink
~RangeSink()
Definition: bloaty.cc:1005
bloaty::ShowDomain::kShowFile
@ kShowFile
bloaty::RangeSink::AddVMRangeAllowAlias
void AddVMRangeAllowAlias(const char *analyzer, uint64_t vmaddr, uint64_t size, const std::string &name)
Definition: bloaty.cc:1218
bloaty::DataSource::kFullSymbols
@ kFullSymbols
bloaty::RollupRow::Compare
static bool Compare(const RollupRow &a, const RollupRow &b)
Definition: bloaty.h:348
bloaty::RangeSink::AddVMRangeIgnoreDuplicate
void AddVMRangeIgnoreDuplicate(const char *analyzer, uint64_t vmaddr, uint64_t size, const std::string &name)
Definition: bloaty.cc:1225
bloaty::InputFile::data
absl::string_view data() const
Definition: bloaty.h:78
bloaty::DataSource::kRawSymbols
@ kRawSymbols
bloaty::RollupRow::vmpercent
double vmpercent
Definition: bloaty.h:344
bloaty::NameMunger::IsEmpty
bool IsEmpty() const
Definition: bloaty.h:247
bloaty::RollupRow::filtered_filesize
int64_t filtered_filesize
Definition: bloaty.h:341
bloaty::RangeSink::options
const Options & options() const
Definition: bloaty.h:119
bloaty::ShowDomain
ShowDomain
Definition: bloaty.h:364
size
voidpf void uLong size
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:136
bloaty::MmapInputFileFactory::OpenFile
std::unique_ptr< InputFile > OpenFile(const std::string &filename) const override
Definition: bloaty.cc:919
bloaty::RollupRow
Definition: bloaty.h:334
bloaty::OutputOptions::max_label_len
size_t max_label_len
Definition: bloaty.h:372
bloaty::RollupOutput::IsSame
static bool IsSame(const std::string &a, const std::string &b)
Definition: bloaty.cc:722
absl::string_view::data
constexpr const_pointer data() const noexcept
Definition: abseil-cpp/absl/strings/string_view.h:336
bloaty::RangeSink::ContainsVerboseFileOffset
bool ContainsVerboseFileOffset(uint64_t fileoff, uint64_t filesize)
Definition: bloaty.cc:1016
bloaty::ObjectFile::GetDisassemblyInfo
virtual bool GetDisassemblyInfo(absl::string_view symbol, DataSource symbol_source, DisassemblyInfo *info) const =0
bloaty::dwarf::File
Definition: debug_info.h:64
bloaty::RollupRow::sortkey
int64_t sortkey
Definition: bloaty.h:343
bloaty::RollupOutput::PrettyPrintRow
void PrettyPrintRow(const RollupRow &row, size_t indent, const OutputOptions &options, std::ostream *out) const
Definition: bloaty.cc:695
addr
struct sockaddr_in addr
Definition: libuv/docs/code/tcp-echo-server/main.c:10
bloaty::RollupOutput::PrintRowToCSV
void PrintRowToCSV(const RollupRow &row, std::vector< std::string > parent_labels, std::ostream *out, bool tabs) const
Definition: bloaty.cc:811
bloaty::RangeSink::TranslateFileToVM
uint64_t TranslateFileToVM(const char *ptr)
Definition: bloaty.cc:1269
bloaty::ReadDWARFInlines
void ReadDWARFInlines(const dwarf::File &file, RangeSink *sink, bool include_line)
Definition: dwarf.cc:691
bloaty::InputFile
Definition: bloaty.h:70
bloaty::RangeSink::AddOutput
void AddOutput(DualMap *map, const NameMunger *munger)
Definition: bloaty.cc:1084
bloaty::RollupRow::filtered_vmsize
int64_t filtered_vmsize
Definition: bloaty.h:340
bloaty::RollupOutput::disassembly_
std::string disassembly_
Definition: bloaty.h:403
bloaty::OutputOptions::show
ShowDomain show
Definition: bloaty.h:373
bloaty::ReadDWARFCompileUnits
void ReadDWARFCompileUnits(const dwarf::File &file, const DualMap &map, RangeSink *sink)
Definition: dwarf.cc:630
bloaty::DataSource::kSections
@ kSections
bloaty::InputFileFactory
Definition: bloaty.h:87


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:39