19 #define UNW_LOCAL_ONLY 1 20 #include <libunwind.h> 23 namespace symbolizer {
27 sizeof(uintptr_t) ==
sizeof(
void*),
"uintptr_t / pointer size mismatch");
31 int r = unw_backtrace(reinterpret_cast<void**>(addresses), maxAddresses);
32 return r < 0 ? -1 : r;
36 inline bool getFrameInfo(unw_cursor_t* cursor, uintptr_t& ip) {
38 if (unw_get_reg(cursor, UNW_REG_IP, &uip) < 0) {
41 int r = unw_is_signal_frame(cursor);
54 if (maxAddresses == 0) {
58 if (unw_getcontext(&context) < 0) {
62 if (unw_init_local(&cursor, &context) < 0) {
65 if (!getFrameInfo(&cursor, *addresses)) {
70 for (; count != maxAddresses; ++
count, ++addresses) {
71 int r = unw_step(&cursor);
78 if (!getFrameInfo(&cursor, *addresses)) {
ssize_t getStackTraceSafe(uintptr_t *addresses, size_t maxAddresses)
—— Concurrent Priority Queue Implementation ——
ssize_t getStackTrace(uintptr_t *addresses, size_t maxAddresses)