|
|
|
@ -35,10 +35,29 @@ |
|
|
|
|
|
|
|
|
|
using testing::Contains; |
|
|
|
|
|
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
#define ABSL_SYMBOLIZE_TEST_NOINLINE __declspec(noinline) |
|
|
|
|
#else |
|
|
|
|
#define ABSL_SYMBOLIZE_TEST_NOINLINE ABSL_ATTRIBUTE_NOINLINE |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Functions to symbolize. Use C linkage to avoid mangled names.
|
|
|
|
|
extern "C" { |
|
|
|
|
void nonstatic_func() { ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); } |
|
|
|
|
static void static_func() { ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); } |
|
|
|
|
ABSL_SYMBOLIZE_TEST_NOINLINE void nonstatic_func() { |
|
|
|
|
// The next line makes this a unique function to prevent the compiler from
|
|
|
|
|
// folding identical functions together.
|
|
|
|
|
volatile int x = __LINE__; |
|
|
|
|
static_cast<void>(x); |
|
|
|
|
ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ABSL_SYMBOLIZE_TEST_NOINLINE static void static_func() { |
|
|
|
|
// The next line makes this a unique function to prevent the compiler from
|
|
|
|
|
// folding identical functions together.
|
|
|
|
|
volatile int x = __LINE__; |
|
|
|
|
static_cast<void>(x); |
|
|
|
|
ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); |
|
|
|
|
} |
|
|
|
|
} // extern "C"
|
|
|
|
|
|
|
|
|
|
struct Foo { |
|
|
|
@ -46,7 +65,11 @@ struct Foo { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// A C++ method that should have a mangled name.
|
|
|
|
|
void ABSL_ATTRIBUTE_NOINLINE Foo::func(int) { |
|
|
|
|
ABSL_SYMBOLIZE_TEST_NOINLINE void Foo::func(int) { |
|
|
|
|
// The next line makes this a unique function to prevent the compiler from
|
|
|
|
|
// folding identical functions together.
|
|
|
|
|
volatile int x = __LINE__; |
|
|
|
|
static_cast<void>(x); |
|
|
|
|
ABSL_BLOCK_TAIL_CALL_OPTIMIZATION(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -449,7 +472,7 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithReturnAddress() { |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#elif defined(_WIN32) && defined(_DEBUG) |
|
|
|
|
#elif defined(_WIN32) |
|
|
|
|
|
|
|
|
|
TEST(Symbolize, Basics) { |
|
|
|
|
EXPECT_STREQ("nonstatic_func", TrySymbolize((void *)(&nonstatic_func))); |
|
|
|
|