sandboxed-api/sandboxed_api/sandbox2/testcases/symbolize_lib.cc
Wiktor Garbacz 64b52ff3b5 Fix stack_trace_test for ARM64
When symbolize.cc is built with unwind tables function from the lib calling into symbolize.cc might be duplicated in stack trace (libunwind fallback to LR)

PiperOrigin-RevId: 514324815
Change-Id: I76ee4ccf5aaf388924714284d9896fa367f5f752
2023-03-06 07:07:55 -08:00

30 lines
752 B
C++

#include "sandboxed_api/sandbox2/testcases/symbolize_lib.h"
#include "absl/base/attributes.h"
ABSL_ATTRIBUTE_NOINLINE
ABSL_ATTRIBUTE_NO_TAIL_CALL
void LibRecurseA(void (*cb)(int), int data, int n);
ABSL_ATTRIBUTE_NOINLINE
ABSL_ATTRIBUTE_NO_TAIL_CALL
void LibCallCallback(void (*cb)(int), int data) { cb(data); }
ABSL_ATTRIBUTE_NOINLINE
ABSL_ATTRIBUTE_NO_TAIL_CALL
void LibRecurseB(void (*cb)(int), int data, int n) {
if (n > 1) {
return LibRecurseA(cb, data, n - 1);
}
return LibCallCallback(cb, data);
}
void LibRecurseA(void (*cb)(int), int data, int n) {
if (n > 1) {
return LibRecurseB(cb, data, n - 1);
}
return LibCallCallback(cb, data);
}
void LibRecurse(void (*cb)(int), int data, int n) { LibRecurseA(cb, data, n); }