提交 c09a0acd 编写于 作者: H Heikki Linnakangas

Remove FOnStack function, it doesn't work without frame pointers.

If you compile with -fomit-frame-pointer, which is the default on recent
versions of gcc, the stack unwinding code in FOnStack will not work. This
is just a non-critical debugging aid, so let's just remove it altogether.
上级 ef457558
......@@ -5,7 +5,7 @@ project(gpopt LANGUAGES CXX C)
set(GPORCA_VERSION_MAJOR 2)
set(GPORCA_VERSION_MINOR 40)
set(GPORCA_VERSION_PATCH 0)
set(GPORCA_VERSION_PATCH 1)
set(GPORCA_VERSION_STRING "${GPORCA_VERSION_MAJOR}.${GPORCA_VERSION_MINOR}.${GPORCA_VERSION_PATCH}")
# Whenever an ABI-breaking change is made to GPORCA, this should be incremented.
......
......@@ -133,9 +133,6 @@ namespace gpos
// yield and sleep (time in muSec)
// note that in some platforms the minimum sleep interval is 1ms
void USleep(ULONG);
// check if given pointer is on stack; only reliable on x86
BOOL FOnStack(const void *);
// add two unsigned long long values, throw an exception if overflow occurs
ULLONG UllAdd(ULLONG ullFst, ULLONG ullSnd);
......
......@@ -7,6 +7,7 @@
//
// @doc:
// Implementation of class of all objects that must reside on the heap;
// There used to be an assertion for that here, but it was too fragile.
//---------------------------------------------------------------------------
#include "gpos/utils.h"
......@@ -25,10 +26,6 @@ using namespace gpos;
//---------------------------------------------------------------------------
CHeapObject::CHeapObject()
{
#if (GPOS_i386 || GPOS_i686 || GPOS_x86_64)
GPOS_ASSERT(false == gpos::FOnStack(this) &&
"Object incorrectly allocated (stack/heap)");
#endif // (GPOS_i386 || GPOS_i686 || GPOS_x86_64)
}
......
......@@ -7,6 +7,7 @@
//
// @doc:
// Implementation of classes of all objects that must reside on the stack;
// There used to be an assertion for that here, but it was too fragile.
//---------------------------------------------------------------------------
#include "gpos/utils.h"
......@@ -25,10 +26,6 @@ using namespace gpos;
//---------------------------------------------------------------------------
CStackObject::CStackObject()
{
#if (GPOS_i386 || GPOS_i686 || GPOS_x86_64)
GPOS_ASSERT(true == gpos::FOnStack(this) &&
"Object incorrectly allocated (stack/heap)");
#endif // (GPOS_i386 || GPOS_i686 || GPOS_x86_64)
}
......
......@@ -214,50 +214,5 @@ gpos::UllMultiply
return ullRes;
}
#ifdef GPOS_DEBUG
#if (GPOS_i386 || GPOS_i686 || GPOS_x86_64)
//---------------------------------------------------------------------------
// @function:
// CAllocatedObject::FOnStack
//
// @doc:
// Check if given pointer is inside the current call stack by retrieving
// (1) the stack pointer and (2) walk up to X stack frames up using the
// base/frame pointer;
// The pointer to check must be less than the base pointer and greater
// than the stack pointer;
//
// NOTE: this works only for x86 architectures; on everything else, this
// test is much weaker and test only the stack pointer;
//
//---------------------------------------------------------------------------
BOOL
gpos::FOnStack
(
const void *pv
)
{
ULONG_PTR ulp = (ULONG_PTR) pv;
// stack pointer
ULONG_PTR ulpSp = 0;
GPOS_GET_STACK_POINTER(ulpSp);
// base pointer
ULONG_PTR ulpBase = 0;
GPOS_GET_FRAME_POINTER(ulpBase);
// search up to N stack frames
for(ULONG i = 0; i < GPOS_SEARCH_STACK_FRAMES && ulpBase != 0 && ulpBase < ulp; i++)
{
ulpBase = *((ULONG_PTR*) ulpBase);
}
return ulpBase > ulp && ulp > ulpSp;
}
#endif // (GPOS_i386 || GPOS_i686 || GPOS_x86_64)
#endif // GPOS_DEBUG
// EOF
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册