< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate] dpocock-assert branch merged, logging assert() failures


A few months ago I created a branch for changing the way assertions work

It has been merged into master and will be part of 1.10.0 and beyond

A quick summary:

- keep using regular assert() in unit tests, e.g. in resip/stack/test/*.cxx

- keep using regular assert() in contrib and other third party code

- otherwise, use resip_assert()

- autotools (Linux) builds: use the configure option

        --enable-assert-syslog

and a copy of every assertion failure will be logged to syslog

- Windows builds: define LOG_EVENT_AND_ASSERT and a copy of every
assertion failure is logged in the event viewer

- setting NDEBUG will still have the same effect, the program will
proceed after the failure of a resip_assert().  However, if one of the
logging options is enabled, the logging will always take place,
regardless of whether NDEBUG is set or not

- the logging has a slight performance penalty as every assert
expression has to be evaluated even if NDEBUG is set.  So if you don't
want the performance penalty, don't enable the logging, everything will
work the way it did before

This has already been useful for detecting intermittent problems such as
the SSL_ERROR_WANT_WRITE issue:

http://list.resiprocate.org/archive/resiprocate-devel/msg08840.html