lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Debug code


From: Zschocke, Florian
Subject: [lwip-users] Debug code
Date: Tue, 25 Feb 2003 12:34:16 +0100

Hi list!

In the lwIP sources I find lots of constructs like this:

#if SOCKETS_DEBUG
  DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d, addr=", s));
  ip_addr_debug_print(&local_addr);
  DEBUGF(SOCKETS_DEBUG, (" port=%u)\n", ntohs(local_port)));
#endif

I am wondering why the above is enclosed in a #if xxx_DEBUG - #endif region.
I somehow doubt that this is to minimize object size since there are plenty
of DEBUGF() macros spread over the lwIP code which are not protected in such
a way and will thus be expanded. Can't the protection in the example above
be done away with?

What I am after is to get rid of the usage of
#if xxx_DEBUG
...
#endif
in the code. What we try to do is use the existing debugging functions to
implement a run-time debug system instead of compile-time. This requires me
to define the xxx_DEBUG defines to variables instead of constants which
breaks the mentioned #if-#endif regions.

Regards,
Florian.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]