MCPcopy Create free account
hub / github.com/apache/impala / StringifyToHex

Method StringifyToHex

be/src/kudu/util/debug-util.cc:626–650  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

624}
625
626void StackTrace::StringifyToHex(char* buf, size_t size, int flags) const {
627 char* dst = buf;
628
629 // Reserve kHexEntryLength for the first iteration of the loop, 1 byte for a
630 // space (which we may not need if there's just one frame), and 1 for a nul
631 // terminator.
632 char* limit = dst + size - kHexEntryLength - 2;
633 for (int i = 0; i < num_frames_ && dst < limit; i++) {
634 if (i != 0) {
635 *dst++ = ' ';
636 }
637 if (flags & HEX_0X_PREFIX) {
638 *dst++ = '0';
639 *dst++ = 'x';
640 }
641 // See note in Symbolize() below about why we subtract 1 from each address here.
642 uintptr_t addr = reinterpret_cast<uintptr_t>(frames_[i]);
643 if (addr > 0 && !(flags & NO_FIX_CALLER_ADDRESSES)) {
644 addr--;
645 }
646 FastHex64ToBuffer(addr, dst);
647 dst += kHexEntryLength;
648 }
649 *dst = '\0';
650}
651
652string StackTrace::ToHexString(int flags) const {
653 // Each frame requires kHexEntryLength, plus a space

Callers 2

HexStackTraceToStringFunction · 0.80

Calls 1

FastHex64ToBufferFunction · 0.85

Tested by

no test coverage detected