Commit 64041397 authored by Shinichiro Hamaji's avatar Shinichiro Hamaji Committed by Fumitoshi Ukai

Use `static` to define CheckStackTrace on non-GNU (#429)

for `&CheckStackAddress`, VisualStudio emits address of a trampoline like PLT, 
not the actual address of `CheckStackTrace`.

We need address of `CheckStackTrace` to guess the address range of the function.
`static` function seems to return the actual address of the function.

Fixes #421 
parent 7f91846c
......@@ -180,6 +180,15 @@ static void ATTRIBUTE_NOINLINE CheckStackTrace1(int i) {
CheckStackTrace2(j);
DECLARE_ADDRESS_LABEL(end);
}
#ifndef __GNUC__
// On non-GNU environment, we use the address of `CheckStackTrace` to
// guess the address range of this function. This guess is wrong for
// non-static function on Windows. This is probably because
// `&CheckStackTrace` returns the address of a trampoline like PLT,
// not the actual address of `CheckStackTrace`.
// See https://github.com/google/glog/issues/421 for the detail.
static
#endif
void ATTRIBUTE_NOINLINE CheckStackTrace(int i) {
INIT_ADDRESS_RANGE(CheckStackTrace, start, end, &expected_range[5]);
DECLARE_ADDRESS_LABEL(start);
......
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