X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fexperimental%2Fsymbolizer%2FSymbolizer.h;h=5a87f90b6b689c9364e3e82ff0c0467468760f87;hp=5595a53b67994270c9588de1561899ee7b41db1f;hb=af7e70660f867873638ef2ce5bb33b19771bdd41;hpb=a9ba07eb94a5b85985859568789559882ad0e33d diff --git a/folly/experimental/symbolizer/Symbolizer.h b/folly/experimental/symbolizer/Symbolizer.h index 5595a53b..5a87f90b 100644 --- a/folly/experimental/symbolizer/Symbolizer.h +++ b/folly/experimental/symbolizer/Symbolizer.h @@ -128,6 +128,24 @@ class Symbolizer { ElfCacheBase* cache_; }; +/** + * Format one address in the way it's usually printer by SymbolizePrinter. + * Async-signal-safe. + */ +class AddressFormatter { + public: + AddressFormatter(); + + /** + * Format the address. Returns an internal buffer. + */ + StringPiece format(uintptr_t address); + + private: + static constexpr char bufTemplate[] = " @ 0000000000000000"; + char buf_[sizeof(bufTemplate)]; +}; + /** * Print a list of symbolized addresses. Base class. */