lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Debug code


From: David Haas
Subject: Re: [lwip-users] Debug code
Date: Tue, 25 Feb 2003 08:49:00 -0500
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3b) Gecko/20030224

I know why its there (although I am sure there is a better way to do it).

ip_addr_debug_print is a function call. It is generic and does not test any particular debug flag. So when it is called, it must be in a #if SOMETHING_DEBUG #endif section.
It should probably be a macro which tests the debug flag.

David.


Zschocke, Florian wrote:

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.


_______________________________________________
lwip-users mailing list
address@hidden
http://mail.nongnu.org/mailman/listinfo/lwip-users








reply via email to

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