[Vm-dev] How to think about -DNDEBUG on linux64 w/ 32 bit compat
eliot.miranda at gmail.com
Sun Jul 6 04:28:46 UTC 2014
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
> /....oscogvm/src/vm/gcc3x-cointerp.c:9098:1: error: conflicting types for
> 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
for GCC-compliant compilers), allowing all static functions to be called
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__) &&
# define NoDbgRegParms __attribute__ ((regparm (0)))
# define NoDbgRegParms /*empty*/
so the idea is that on debug & assert builds, e.g.
static void addNewMethodToCache(sqInt classObj) NoDbgRegParms;
static void addNewMethodToCache(sqInt classObj) __attribute__ ((regparm
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...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev