Commit e1fb8f60 authored by 's avatar

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
parent bf6108bb
...@@ -126,7 +126,7 @@ const char kAlternateStackFillValue = 0x55; ...@@ -126,7 +126,7 @@ const char kAlternateStackFillValue = 0x55;
// These helper functions look at the alternate stack buffer, and figure // These helper functions look at the alternate stack buffer, and figure
// out what portion of this buffer has been touched - this is the stack // out what portion of this buffer has been touched - this is the stack
// consumption of the signal handler running on this alternate 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; int y;
return &y < x; return &y < x;
} }
...@@ -277,7 +277,7 @@ void ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() { ...@@ -277,7 +277,7 @@ void ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
void *pc = non_inline_func(); void *pc = non_inline_func();
const char *symbol = TrySymbolize(pc); const char *symbol = TrySymbolize(pc);
CHECK(symbol != NULL); CHECK(symbol != NULL);
CHECK_EQ(0, strcmp(symbol, "non_inline_func")); CHECK_STREQ(symbol, "non_inline_func");
cout << "Test case TestWithPCInsideNonInlineFunction passed." << endl; cout << "Test case TestWithPCInsideNonInlineFunction passed." << endl;
#endif #endif
} }
...@@ -287,7 +287,7 @@ void ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() { ...@@ -287,7 +287,7 @@ void ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
void *pc = inline_func(); // Must be inlined. void *pc = inline_func(); // Must be inlined.
const char *symbol = TrySymbolize(pc); const char *symbol = TrySymbolize(pc);
CHECK(symbol != NULL); CHECK(symbol != NULL);
CHECK_EQ(0, strcmp(symbol, __FUNCTION__)); CHECK_STREQ(symbol, __FUNCTION__);
cout << "Test case TestWithPCInsideInlineFunction passed." << endl; cout << "Test case TestWithPCInsideInlineFunction passed." << endl;
#endif #endif
} }
...@@ -299,7 +299,7 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() { ...@@ -299,7 +299,7 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() {
void *return_address = __builtin_return_address(0); void *return_address = __builtin_return_address(0);
const char *symbol = TrySymbolize(return_address); const char *symbol = TrySymbolize(return_address);
CHECK(symbol != NULL); CHECK(symbol != NULL);
CHECK_EQ(0, strcmp(symbol, "main")); CHECK_STREQ(symbol, "main");
cout << "Test case TestWithReturnAddress passed." << endl; cout << "Test case TestWithReturnAddress passed." << endl;
#endif #endif
} }
...@@ -307,6 +307,9 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() { ...@@ -307,6 +307,9 @@ void ATTRIBUTE_NOINLINE TestWithReturnAddress() {
int main(int argc, char **argv) { int main(int argc, char **argv) {
FLAGS_logtostderr = true; FLAGS_logtostderr = true;
InitGoogleLogging(argv[0]); 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. // Symbolize() now only supports ELF binaries.
// The test makes sense only if __ELF__ is defined. // The test makes sense only if __ELF__ is defined.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment