From e1fb8f60e9922765d5693a3e219c8d416b6c514f Mon Sep 17 00:00:00 2001 From: Date: Tue, 14 Oct 2008 00:32:16 +0000 Subject: [PATCH] Add __attribute__((noinline)) for StackGrowsDown. This is necessary for recent GCC (4.3). git-svn-id: https://google-glog.googlecode.com/svn/trunk@6 eb4d4688-79bd-11dd-afb4-1d65580434c0 --- src/symbolize_unittest.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/symbolize_unittest.cc b/src/symbolize_unittest.cc index 2405362..e172af9 100644 --- a/src/symbolize_unittest.cc +++ b/src/symbolize_unittest.cc @@ -126,7 +126,7 @@ const char kAlternateStackFillValue = 0x55; // These helper functions look at the alternate stack buffer, and figure // out what portion of this buffer has been touched - this is the stack // consumption of the signal handler running on this alternate stack. -static bool StackGrowsDown(int *x) { +static ATTRIBUTE_NOINLINE bool StackGrowsDown(int *x) { int y; return &y < x; } @@ -277,7 +277,7 @@ void ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() { void *pc = non_inline_func(); const char *symbol = TrySymbolize(pc); CHECK(symbol != NULL); - CHECK_EQ(0, strcmp(symbol, "non_inline_func")); + CHECK_STREQ(symbol, "non_inline_func"); cout << "Test case TestWithPCInsideNonInlineFunction passed." << endl; #endif } @@ -287,7 +287,7 @@ void ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() { void *pc = inline_func(); // Must be inlined. const char *symbol = TrySymbolize(pc); CHECK(symbol != NULL); - CHECK_EQ(0, strcmp(symbol, __FUNCTION__)); + CHECK_STREQ(symbol, __FUNCTION__); cout << "Test case TestWithPCInsideInlineFunction passed." << endl; #endif } @@ -299,7 +299,7 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() { void *return_address = __builtin_return_address(0); const char *symbol = TrySymbolize(return_address); CHECK(symbol != NULL); - CHECK_EQ(0, strcmp(symbol, "main")); + CHECK_STREQ(symbol, "main"); cout << "Test case TestWithReturnAddress passed." << endl; #endif } @@ -307,6 +307,9 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() { int main(int argc, char **argv) { FLAGS_logtostderr = true; InitGoogleLogging(argv[0]); + // We don't want to get affected by the callback interface, that may be + // used to install some callback function at InitGoogle() time. + InstallSymbolizeCallback(NULL); // Symbolize() now only supports ELF binaries. // The test makes sense only if __ELF__ is defined.