[Vm-dev] How to think about -DNDEBUG on linux64 w/ 32 bit compat libs

Eliot Miranda eliot.miranda at gmail.com
Sun Jul 6 04:28:46 UTC 2014


Hi Tim,


On Thu, Jul 3, 2014 at 1:58 PM, gettimothy <gettimothy at zoho.com> wrote:
>
>
> Hi all.
>
> If you could point me in the right direction to think this through, I
would be much obliged.
>
> in oscogvm/build.linux32x86/squeak.cog.v3/build.debug
>
> I must add the -DNDEBUG flag in order to compile (i.e. disable
assertions). If I enable assertions compilation fails  early.


The question is why does compilation fail?  Of course one cannot accept
defining -NDEBUG to Debug builds because... the point of debug builds is to
debug, and the primary information in the VM for debugging is assertions.


>
>
> I am not sure how to think about this.
>
> I don't know if these are appropriate errors or not, but here are the
first two
>
>
>
> /....oscogvm/src/vm/gcc3x-cointerp.c:9098:1: error: conflicting types for
'activateCoggedNewMethod'
> activateCoggedNewMethod(sqInt inInterpreter)
> ^
> /....oscogvm/src/vm/gcc3x-cointerp.c:367:13: note: previous declaration
of 'activateCoggedNewMethod' was here
> static void activateCoggedNewMethod(sqInt inInterpreter) NoDbgRegParms;


This is orthogonal to assertions.  The idea is to add an optional pragma
that will prevent the compiler optimizing the calling convention for static
methods so on cannot use them from gdb (most annoying).  here's the checkin
comment from r2922:

In non-production VMs add an attribute to disable register parameters (at
least
for GCC-compliant compilers), allowing all static functions to be called
from
gdb even in the -O1 assert VMs.

So the thing to do is work out why NoDbgRegParms is being defined as
something that causes an error.

here's the relevant code from e.g. src/vm/gcc3x-cointerp.c

/*** Function Prototypes ***/


#if defined(PRODUCTION) && !PRODUCTION && defined(__GNUC__) &&
!defined(NoDbgRegParms)
# define NoDbgRegParms __attribute__ ((regparm (0)))
#endif

#if !defined(NoDbgRegParms)
# define NoDbgRegParms /*empty*/
#endif

so the idea is that on debug & assert builds, e.g.

static void addNewMethodToCache(sqInt classObj) NoDbgRegParms;

becomes

static void addNewMethodToCache(sqInt classObj) __attribute__ ((regparm
(0)));

so that classObj won't be passed in a register and hence one can call the
function successfully from within gdb (useful for printing routines
etc), but that on production builds it becomes

static void addNewMethodToCache(sqInt classObj);

So we can have our cake and debug it, so to speak.

I'm confused as to how the CMake stuff can interfere with this simple
scheme.  t's just simple #defines after all...
--
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20140705/34170c72/attachment.htm


More information about the Vm-dev mailing list