proxygen
folly::symbolizer::Dwarf::Section Class Reference

Public Member Functions

 Section ()
 
 Section (folly::StringPiece d)
 
bool next (folly::StringPiece &chunk)
 
bool is64Bit () const
 

Private Attributes

bool is64Bit_
 
folly::StringPiece data_
 

Detailed Description

Definition at line 151 of file Dwarf.h.

Constructor & Destructor Documentation

folly::symbolizer::Dwarf::Section::Section ( )
inline

Definition at line 153 of file Dwarf.h.

References cpp.ast::next().

153 : is64Bit_(false) {}

Member Function Documentation

bool folly::symbolizer::Dwarf::Section::is64Bit ( ) const
inline
bool folly::symbolizer::Dwarf::Section::next ( folly::StringPiece chunk)

Definition at line 284 of file Dwarf.cpp.

References folly::Range< Iter >::data(), data_, folly::Range< Iter >::empty(), folly::Range< Iter >::end(), FOLLY_SAFE_CHECK, folly::Range< Iter >::reset(), folly::Range< Iter >::size(), and uint32_t.

Referenced by folly::symbolizer::Dwarf::findDebugInfoOffset(), folly::symbolizer::Dwarf::findLocation(), and folly::symbolizer::Dwarf::LineNumberVM::LineNumberVM().

284  {
285  chunk = data_;
286  if (chunk.empty()) {
287  return false;
288  }
289 
290  // Initial length is a uint32_t value for a 32-bit section, and
291  // a 96-bit value (0xffffffff followed by the 64-bit length) for a 64-bit
292  // section.
293  auto initialLength = read<uint32_t>(chunk);
294  is64Bit_ = (initialLength == (uint32_t)-1);
295  auto length = is64Bit_ ? read<uint64_t>(chunk) : initialLength;
296  FOLLY_SAFE_CHECK(length <= chunk.size(), "invalid DWARF section");
297  chunk.reset(chunk.data(), length);
298  data_.assign(chunk.end(), data_.end());
299  return true;
300 }
folly::StringPiece data_
Definition: Dwarf.h:169
constexpr size_type size() const
Definition: Range.h:431
constexpr bool empty() const
Definition: Range.h:443
constexpr Iter data() const
Definition: Range.h:446
void assign(Iter start, Iter end)
Definition: Range.h:416
#define FOLLY_SAFE_CHECK(expr, msg)
Definition: SafeAssert.h:35
constexpr Iter end() const
Definition: Range.h:455
void reset(Iter start, size_type size)
Definition: Range.h:421

Member Data Documentation

folly::StringPiece folly::symbolizer::Dwarf::Section::data_
private

Definition at line 169 of file Dwarf.h.

bool folly::symbolizer::Dwarf::Section::is64Bit_
private

Definition at line 168 of file Dwarf.h.


The documentation for this class was generated from the following files: