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
This commit is contained in:
Wiktor Garbacz 2023-03-06 00:21:29 -08:00 committed by Copybara-Service
parent 550b26587f
commit 64b52ff3b5
2 changed files with 7 additions and 2 deletions

View File

@ -96,6 +96,7 @@ void SymbolizationWorksCommon(TestCase param) {
EXPECT_THAT(result.stack_trace(),
Contains(StartsWith("RecurseB")).Times(5));
} else if (param.testmode == 3) {
EXPECT_THAT(result.stack_trace(), Contains(StartsWith("LibCallCallback")));
EXPECT_THAT(result.stack_trace(), Contains(StartsWith("LibRecurse")));
EXPECT_THAT(result.stack_trace(),
Contains(StartsWith("LibRecurseA")).Times(5));

View File

@ -6,20 +6,24 @@ 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 cb(data);
return LibCallCallback(cb, data);
}
void LibRecurseA(void (*cb)(int), int data, int n) {
if (n > 1) {
return LibRecurseB(cb, data, n - 1);
}
return cb(data);
return LibCallCallback(cb, data);
}
void LibRecurse(void (*cb)(int), int data, int n) { LibRecurseA(cb, data, n); }