[Vm-dev] '-DNDEBUG=0' and '-DDEBUGVM=1'

Eliot Miranda eliot.miranda at gmail.com
Tue Apr 26 17:40:52 UTC 2011


On Tue, Apr 26, 2011 at 10:29 AM, Igor Stasenko <siguctua at gmail.com> wrote:

>
> On 26 April 2011 19:01, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> >
> >
> >
> > On Tue, Apr 26, 2011 at 6:21 AM, Igor Stasenko <siguctua at gmail.com>
> wrote:
> >>
> >> On 26 April 2011 04:03, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> >> >
> >> >
> >> >
> >> > On Mon, Apr 25, 2011 at 6:39 PM, Igor Stasenko <siguctua at gmail.com>
> wrote:
> >> >>
> >> >> On 26 April 2011 03:05, Mariano Martinez Peck <marianopeck at gmail.com>
> wrote:
> >> >> >
> >> >> > Hi guys. I don't know why but with CMakeVMMaker the asserts are not
> working.  I can see the flags are being set correct in CmakeList.txt:
> >> >> >
> >> >> > add_definitions(-arch i386 -mmacosx-version-min=10.5 -g3 -O0 -msse3
> -funroll-loops -fasm-blocks -finline-functions -mfpmath=sse -march=pentium-m
> -falign-functions=16 -fno-gcse -fno-cse-follow-jumps -std=gnu99
> -DBUILD_FOR_OSX -DUSE_INLINE_MEMORY_ACCESSORS -DLSB_FIRST -DHAVE_SYS_TIME_H
> -DHAVE_NANOSLEEP -DNDEBUG=1 -DDEBUGVM=1 -DCOGMTVM=1 -DUSE_GLOBAL_STRUCT=0
> -DBASE_HEADER_SIZE=4 -DCOGVM)
> >> >> >
> >> >>
> >> >> AFAIK, code checks
> >> >>
> >> >> #ifdef NDEBUG
> >> >>
> >> >>
> >> >> which means
> >> >> 'if defined NDEBUG'
> >> >>
> >> >> and so it doesn't matters if it = 1 or = 0
> >> >> because it is defined, but don't cares which value.
> >> >>
> >> >> Also,
> >> >> NDEBUG and DEBUGVM should be mutually exclusive?
> >> >
> >> > NO!!  NO!!  NO!!  [ :) ].  I said earlier, NDEBUG is a linux-ism for
> enabling asserts.  See /usr/include/assert.h.  So if defined(NDEBUG)
> assert(foo) does nothing, but if !defined(NDEBUG) assert(foo) prints a
> warning and in unix/linux aborts, but in Cog continues.
> >> > DEBUGVM includes some extra code that allows break-pointing jumping
> from the interpreter into machien code.  Arguably it could be eliminated but
> it'll be useful when we port to new ISAs.
> >> > I said all this last week.  Please take note this time :)
> >>
> >>
> >> But hey, i insist that they are mutually exclusive.
> >
> > You can insist all you like but you're wrong.  NDEBUG controls assertions
> and these are orthogonal to the enilopmart debugging introduced by using
> DEBUGVM.  Simple as that.  They are *not* mutually exclusive.
> >
>
> Eliot, i understand this stuff. Now you taking my words too literally.
> I meant to say that for existing cmake configurations they should be
> mutually exclusive.
>

Ah, agreed :)  Sorry :)


>
> But for current variants for release we should have:
>  a) turn debugging off  (-DDEBUGVM=0)
>  b) suppress assertions (-DNDEBUG)
>
> and when building VM for debugging we doing otherwise:
>  - turn all debugging on (-DDEBUGVM=1)
>  - enable assertions (omit defining -DNDEBUG)
>
> so in the above two configurations its easy to see that these two
> options are mutually exclusive.
>
> And of course, in case of need, one can create configuration where you
> can use different combination of these two flags, but the above two is
> most logical choice for release and debug versions of VM configs.
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110426/e407f553/attachment.htm


More information about the Vm-dev mailing list