Re[4]: [Gc] Re: Valgrind patch

Ivan Maidanski ivmai at
Wed Mar 10 23:22:01 PST 2010

Thu, 11 Mar 2010 01:08:52 -0600 письмо от No Itisnt <theseaisinhere at>:

> > Wrong patch (because GC_get_stack_base() should be used only if HAVE_GET_STACK_BASE, and there should be "#else" instead of "#endif"). I understand the logic of your patch but my above question is still in force.
> It uses defined(GC_LINUX_THREAD) && !defined(HAVE_GET_STACK_BASE)
> because that is the condition for GC_get_stack_base being defined with
> pthread_attr_getstack.

No, HAVE_GET_STACK_BASE is defined after defining GC_get_stack_base() in every case (and it is checked to prevent the duplicate definition). You don't need to check HAVE_GET_STACK_BASE because GC_get_stack_base() is always defined (but it could return GC_UNIMPLEMENTED - see gc.h comments).

> Here is one that uses #else.

Well, in case you check GC_get_stack_base() result (for GC_UNIMPLEMENTED), I was wrong saying "endif" should be replaced with "else" here.

> >> >> And, my question is: why are we not using pthread_attr_getstack() for GC_get_main_stack_base() on Linux at present?

Well, the question is really for Hans, not you...

> I don't know why, that's why my original patch was wrapped in an
> environment variable, in case pthread_attr_getstack was somehow
> undesirable. It returns a slightly higher base, but that does not
> appear to make a difference.
> ATTACHMENT: application/x-patch (valgrind3.patch)

More information about the Gc mailing list