domain-controller: update watch stamp after sending notifications.

Update proxy table watch stamps after table changes have been
synced to the corresponding client. Failing to do so causes all
transactions to trigger notifications to all clients regardless
of what they have subscribed to.
core: added 'debug mm dump' console command for dumping unfreed objects.
common: added support for runtime refcounting error detection.

Added support for detecting when object references have been
overzelaously dropped below a reference count of zero. Print
an error message with the offending unref that triggered the
condition (wich is of course not necessarily the bug itself).

refcounting error detection can be disabled during compilation.
lua-utils: added mrp_lua_call{stack,trace}.
lua-utils: add support for dynamically collected Lua objects.

This patch tries to address a number of limitations in the
Murphy Lua object infrastructure that currently prevents us
from creating Lua objects with expected Lua object lifecycle
characteristics and subject to normal Lua garbage-collection
rules.

This patch is monsterous in size and I already regret having
squashed it beyond what would have been more reasonable. I'm
still reluctant to go through the trouble of splitting it up
again to more self-contained orthogonal chunks, as the patch
only touches lua-utils/objects.[hc]. Instead I sum up here
the logically distincts parts the patch is made of:

1) Introduce dynamic classes and implement their necessary
   behavior. This involves introducing the DYNAMIC flag, as
   well as providing versions of the simple CLASSDEF macros
   that take also a flag as it is expected that many of the
   simple classes will need to be dynamic.

   Implementing the necessary behaviour touches object
   creation, destruction (including userdata destuction),
   and pushing. As part of the necessary changes, dynamic
   objects can not be pushed by reference any more (since
   they do not install global self-references). Therefore,
   objects have been modified so that two Lua objects can
   share a (refcounted) userdata_t (the essence of a Murphy
   Lua object) by adding a layer of indirection. IOW, now
   instead of a userdata_t being directly allocated as a Lua
   (userdata) object on the stack, the corresponding Lua
   (userdata) object now contains a pointer to a reference
   counted userdata_t (Murphy Lua object). Sorry about the
   confusing terminology, for once I'm not the one to be
   blamed... Anyway, now pushing a dynamic object becomes
   merely creating a new Lua object pointing to the same
   userdata_t and increasing the refcount of the latter.
   Popping/destroying simply becomes decreasing the refcount
   and freeing the object when the last reference is gone.
   Dynamic objects are not supposed to be explictly destroyed
   and indeed the explicit destructor will refuse to do
   lifecyclewise anything to dynamic objects. It will print
   an error if th eexplicit destructor is ever called with a
   dynamic object.

   Note that if you use the more recently introduced but
   arguably slightly more complex MRP_LUA_DEFINE_CLASS macros
   to declare your classes, even Lua extensions of your objects
   keep working as before. For classes created with the original
   macros, things might not work as you'd expect (but this
   should be really trivial to fix by switching static objects
   over to the newer explicit extension mechanism/infra).

2) Slight cleanups and fixes to the object-infra/userdata_t.
   userdata has been slightly modified to collect all the
   various references under a single refs structure with luatbl
   replaced by refs.self, exttbl replaced by refs.ext and reftbl
   replaced by refs.priv. The reference and extension table
   cleanup functions have been (hopefully) fixed to properly let
   go of all per-object references upon object destruction.
   MRP_LUA_CLASS_PRIVREFS has been made implicit and removed
   altogether. Hence, all the explicit referencing functions now
   operate on private references on a per object basis.

3) The object create/push/destroy/pop/unref code pathes have
   now been planted with more thorough debug messages for better
   debuggability.

4) Two functions have been added for debug-dumping both static and
   dynamic object instances in a unified format.

Here are a few more words about the various bits this patch is
comprised of...

The patch loosens the assumptions about whether instances of
all Lua classes always need to be implicitly self-referencing.
Since most of our classes and objects are still configuration
objects or Lua scripting extensions to C objects, neither of
wich are supposed to be destroyed from Lua, we default to self-
referencing classes. Instances of such classes always get a
global reference automatically installed, essentially making
them static and preventing garbage collection from taking place
until they are explicitly destroyed (which also removes their
global reference).

With this patch in place, one can now mark a class dyanmic thus
opting out from implicit self-referencing on a per class basis.
This happens by setting the flag MRP_LUA_CLASS_DYNAMIC for the
class definition. Instances of such classes will not auto-
matically create a globally reachable self-reference into the
registry and hence will be subject to more natural Lua object
lifecycle rules. Once all reference to such an object go out of
scope the object will be garbage collected and destroyed.

Added a level of indirection between murphy Lua objects and their
userdata. Instead of userdata being directly allocated by Lua and
being part of the Lua object itself, userdata is now allocated as
a separate reference-counted chunk of memory. A Lua object now is
just metadata plus a pointer to the separately allocated userdata.

Pushing an object instance on the Lua stack now does not require
keeping a Lua reference to the object. Instead, a new Lua object
(Lua userdata) is created, made to point to the existing userdata
and the userdata reference count is increased. The destructor for
userdata_t has been modified to decrease the reference count of
the object and only destroy it when the last reference is gone.

With this new scheme, several Lua (userdata) objects can exist for
the same userdata (Murphy Lua object), each keeping its own reference
in the userdata reference count. The constructor, push and destructor
have been set up to reference count the potentially shared userdata
so that once all Lua instances representing (pointing to) the same
object instance go out of scope and get collected, the object instance
itself is destroyed.

These changes should be completely transparent to all existing object
implementations. Self-referencing objects still keep a global reference
to themselves in the registry just like they used to preventing the
initially created object to ever get out of scope. Self-referencing
objects are still pushed to the Lua stack by reference.
common: added mrp_json_clone for creating a private copy of a JSON object.
lua-bindings: mark Lua JSON class to opt-out from implicit self-referencing.

JSON Lua objects should definitely not be self-referencing. They are
not going to get explicitly destroyed from C. Rather they should obey
the normal Lua scoping/object lifecycle rules and get garbage-collected
accordingly.
lua-bindings: clone JSON objects when setting them as Lua JSON members.

Create a private copy (by cloning) of JSON objects when setting
them as members of a Lua JSON object. Otherwise the same object
would end up being set (and without the necessary extra refcounts)
as members of several Lua JSON objects. This would wreak havoc when
those objects get destroyed, eventually double-freeing a shared
JSON member.
resource-lua: plant the necessary funcbridge gettop/settop wrappers.
lua-timer: get rid of a compiler warning.
lua-deferred: get rid of a compiler warning.
lua-sighandler: get rid of a compiler warning.
test-plugin: get rid of a compiler warning.
lua-utils: fix a few snprintf-related formatted printing warnings.
lua-utils: obey format string for object dumping.
lua-utils: properly release references from refs.priv and refs.ext.
lua-utils: removed #if 0'd code.
lua-utils: exttbl and reftbl cleanup fixes, call user destructor earlier.

Fix bad exttbl cleanup thinko (exttbl is an ordinary table, not
a table of references). Change reftbl cleanup to simply remove
our reference to reftbl. Also moved invoking the user-provided
destructor a bit earlier before reftbl and extbl are cleaned up.

Explicit cleanup of reftbl (by explicitly looping through reftb
and removing all references found there) reliably triggers an
assert in the Lua garbage-collector. I'm quite puzzled why this
happens. Maybe it has something to do with being called from the
garbage-collector... though I checked the documentation about
finalizers and did not find a word about any limitations what
one would be allowed to do from a finalizers. For the time being
we just drop our reference to reftbl, which should be good enough
as it should remove all references from the table once that is
collected. This needs further head-scratching and eyeballing...
lua-timer: fixes, explicit start/stop, removed 'data' member.

Added support for explicitly stopping and starting an otherwise
fully functional timer (IOW both interval and callback set). Also
removed the userdata-like 'data' members as pointless. Since Lua
timer is an extensible object, one can set data as an extended
Lua attribute just as well. No need to special-case it out...

Removed all attempts to self-destruct the object by explicitly
calling mrp_lua_destroy_object as Lua timer is now marked dynamic.

Timers are now automatically disabled if invoking the callback
fails.
lua-sighandler: fixes, explicit enable/disable, removed 'data' member.

Added support for explicitly enabling/disabling signal handlers.
Removed 'userdata'-like data member as pointless. Since Lua
sighander is an extensible object, one can set data as an extended
Lua attribute just as well. No need to special-case it out...

Signal handlers are now automatically disabled if invoking the
associated callback fails.