MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / backtrace

Method backtrace

src/backward.h:865–891  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

863 }
864
865 _Unwind_Reason_Code backtrace(_Unwind_Context* ctx)
866 {
867 if (_index >= 0 && static_cast<size_t>(_index) >= _depth)
868 return _URC_END_OF_STACK;
869
870 int ip_before_instruction = 0;
871 uintptr_t ip = _Unwind_GetIPInfo(ctx, &ip_before_instruction);
872
873 if (!ip_before_instruction) {
874 // calculating 0-1 for unsigned, looks like a possible bug to sanitiziers,
875 // so let's do it explicitly:
876 if (ip == 0) {
877 ip = std::numeric_limits<uintptr_t>::max(); // set it to 0xffff... (as
878 // from casting 0-1)
879 }
880 else {
881 ip -= 1; // else just normally decrement it (no overflow/underflow will
882 // happen)
883 }
884 }
885
886 if (_index >= 0) { // ignore first frame.
887 (*_f)(static_cast<size_t>(_index), reinterpret_cast<void*>(ip));
888 }
889 _index += 1;
890 return _URC_NO_REASON;
891 }
892};
893
894template <typename F>

Callers 1

backtrace_trampolineMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected