* Frame information: symbol name and location.
*/
struct SymbolizedFrame {
- SymbolizedFrame() { }
+ SymbolizedFrame() {}
- void set(const std::shared_ptr<ElfFile>& file,
- uintptr_t address,
- Dwarf::LocationInfoMode mode);
+ void set(
+ const std::shared_ptr<ElfFile>& file,
+ uintptr_t address,
+ Dwarf::LocationInfoMode mode);
- void clear() { *this = SymbolizedFrame(); }
+ void clear() {
+ *this = SymbolizedFrame();
+ }
bool found = false;
const char* name = nullptr;
template <size_t N>
struct FrameArray {
- FrameArray() { }
+ FrameArray() {}
size_t frameCount = 0;
uintptr_t addresses[N];
return false;
}
}
-} // namespace detail
+} // namespace detail
// Always inline these functions; they don't do much, and unittests rely
// on them never showing up in a stack trace.
Dwarf::LocationInfoMode::FAST;
explicit Symbolizer(Dwarf::LocationInfoMode mode = kDefaultLocationInfoMode)
- : Symbolizer(nullptr, mode) {}
+ : Symbolizer(nullptr, mode) {}
- explicit Symbolizer(ElfCacheBase* cache,
- Dwarf::LocationInfoMode mode = kDefaultLocationInfoMode);
+ explicit Symbolizer(
+ ElfCacheBase* cache,
+ Dwarf::LocationInfoMode mode = kDefaultLocationInfoMode);
/**
* Symbolize given addresses.
*/
- void symbolize(const uintptr_t* addresses,
- SymbolizedFrame* frames,
- size_t frameCount);
+ void symbolize(
+ const uintptr_t* addresses,
+ SymbolizedFrame* frames,
+ size_t frameCount);
template <size_t N>
void symbolize(FrameArray<N>& fa) {
/**
* Print multiple addresses on separate lines.
*/
- void println(const uintptr_t* addresses,
- const SymbolizedFrame* frames,
- size_t frameCount);
+ void println(
+ const uintptr_t* addresses,
+ const SymbolizedFrame* frames,
+ size_t frameCount);
/**
* Print a string, no endling newline.
*/
- void print(StringPiece sp) { doPrint(sp); }
+ void print(StringPiece sp) {
+ doPrint(sp);
+ }
/**
* Print multiple addresses on separate lines, skipping the first
* skip addresses.
*/
template <size_t N>
- void println(const FrameArray<N>& fa, size_t skip=0) {
+ void println(const FrameArray<N>& fa, size_t skip = 0) {
if (skip < fa.frameCount) {
println(fa.addresses + skip, fa.frames + skip, fa.frameCount - skip);
}
}
- virtual ~SymbolizePrinter() { }
+ virtual ~SymbolizePrinter() {}
enum Options {
// Skip file and line information
protected:
explicit SymbolizePrinter(int options, bool isTty = false)
- : options_(options),
- isTty_(isTty) {
- }
+ : options_(options), isTty_(isTty) {}
const int options_;
const bool isTty_;
*/
class OStreamSymbolizePrinter : public SymbolizePrinter {
public:
- explicit OStreamSymbolizePrinter(std::ostream& out, int options=0);
+ explicit OStreamSymbolizePrinter(std::ostream& out, int options = 0);
+
private:
void doPrint(StringPiece sp) override;
std::ostream& out_;
*/
class FDSymbolizePrinter : public SymbolizePrinter {
public:
- explicit FDSymbolizePrinter(int fd, int options=0,
- size_t bufferSize=0);
+ explicit FDSymbolizePrinter(int fd, int options = 0, size_t bufferSize = 0);
~FDSymbolizePrinter() override;
void flush();
+
private:
void doPrint(StringPiece sp) override;
*/
class FILESymbolizePrinter : public SymbolizePrinter {
public:
- explicit FILESymbolizePrinter(FILE* file, int options=0);
+ explicit FILESymbolizePrinter(FILE* file, int options = 0);
+
private:
void doPrint(StringPiece sp) override;
FILE* const file_ = nullptr;
*/
class StringSymbolizePrinter : public SymbolizePrinter {
public:
- explicit StringSymbolizePrinter(int options=0) : SymbolizePrinter(options) { }
+ explicit StringSymbolizePrinter(int options = 0)
+ : SymbolizePrinter(options) {}
- std::string str() const { return buf_.toStdString(); }
- const fbstring& fbstr() const { return buf_; }
- fbstring moveFbString() { return std::move(buf_); }
+ std::string str() const {
+ return buf_.toStdString();
+ }
+ const fbstring& fbstr() const {
+ return buf_;
+ }
+ fbstring moveFbString() {
+ return std::move(buf_);
+ }
private:
void doPrint(StringPiece sp) override;
std::unique_ptr<FrameArray<kMaxStackTraceDepth>> addresses_;
};
-} // namespace symbolizer
-} // namespace folly
+} // namespace symbolizer
+} // namespace folly