[GRASS-dev] grass7 problems with MASK

Soeren Gebbert soerengebbert at googlemail.com
Mon Jan 18 09:50:50 EST 2010


Hello,

2010/1/13 Glynn Clements <glynn at gclements.plus.com>:
>
> Soeren Gebbert wrote:
>
>> Therefor i would like to suggest to establish an environmental
>> variable to enable G_fatal_error() to segfault for better error
>> debugging. I was thinking of a variable in gisrc, but this will
>> result in an infinite G_fatal_error() call-loop, because
>> G_fatal_error() is called in case the environmental variable is not
>> present in gisrc.
>>
>> What would be the best way to implement such an behavior of G_fatal_error()?
>> Any suggestions are welcome.
>
> Use an environment variable rather than a GRASS ($GISRC) variable,
> e.g.
>
>        if (getenv("GRASS_ABORT_ON_ERROR"))
>            abort();
>
> An abort is preferable to trying to create a segfault, as abort() is
> specified by the ANSI/ISO C standard, while generating a segfault
> relies upon undefined behaviour (which means that there is no robust
> way to force a segfault to occur; the most obvious approach is prone
> to being optimised-out).
>
> The default behaviour for SIGABRT is to terminate and dump core, the
> same as for SIGSEGV, so I'm not sure that there's any benefit to a
> segfault. If you really need SIGSEGV, raise(SIGSEGV) might be better
> (but does this signal exist on Windows?).

Regarding the Microsoft Run-Time-Library documentation it should exist:
http://msdn.microsoft.com/de-de/library/5s651ehs(VS.80).aspx

I will add these lines to lib/gis/error.c in grass7.

    if (getenv("GRASS_SIGSEGV_ON_ERROR"))
        raise(SIGSEGV);

Where is the best place to document the new grass environment variable?

Thanks
Soeren

>
> --
> Glynn Clements <glynn at gclements.plus.com>
>


More information about the grass-dev mailing list