proxygen
folly::symbolizer::AddressFormatter Class Reference

#include <Symbolizer.h>

Public Member Functions

 AddressFormatter ()
 
StringPiece format (uintptr_t address)
 

Private Attributes

char buf_ [sizeof(bufTemplate)]
 

Static Private Attributes

static constexpr char bufTemplate [] = " @ 0000000000000000"
 

Detailed Description

Format one address in the way it's usually printed by SymbolizePrinter. Async-signal-safe.

Definition at line 163 of file Symbolizer.h.

Constructor & Destructor Documentation

folly::symbolizer::AddressFormatter::AddressFormatter ( )

Definition at line 190 of file Symbolizer.cpp.

190  {
191  memcpy(buf_, bufTemplate, sizeof(buf_));
192 }
static constexpr char bufTemplate[]
Definition: Symbolizer.h:173
char buf_[sizeof(bufTemplate)]
Definition: Symbolizer.h:174

Member Function Documentation

folly::StringPiece folly::symbolizer::AddressFormatter::format ( uintptr_t  address)

Format the address. Returns an internal buffer.

Definition at line 194 of file Symbolizer.cpp.

References folly::test::end().

Referenced by folly::symbolizer::SymbolizePrinter::print(), folly::symbolizer::SafeStackTracePrinter::printStackTrace(), and folly::symbolizer::FastStackTracePrinter::printStackTrace().

194  {
195  // Can't use sprintf, not async-signal-safe
196  static_assert(sizeof(uintptr_t) <= 8, "huge uintptr_t?");
197  char* end = buf_ + sizeof(buf_) - 1 - (16 - 2 * sizeof(uintptr_t));
198  char* p = end;
199  *p-- = '\0';
200  while (address != 0) {
201  *p-- = kHexChars[address & 0xf];
202  address >>= 4;
203  }
204 
205  return folly::StringPiece(buf_, end);
206 }
auto end(TestAdlIterable &instance)
Definition: ForeachTest.cpp:62
char buf_[sizeof(bufTemplate)]
Definition: Symbolizer.h:174
Range< const char * > StringPiece

Member Data Documentation

char folly::symbolizer::AddressFormatter::buf_[sizeof(bufTemplate)]
private

Definition at line 174 of file Symbolizer.h.

constexpr char folly::symbolizer::AddressFormatter::bufTemplate = " @ 0000000000000000"
staticprivate

Definition at line 173 of file Symbolizer.h.

Referenced by folly::symbolizer::Symbolizer::symbolize().


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