[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] RFC: debug and asserts (And: dynamic debug works for us
From: |
Leon Woestenberg |
Subject: |
Re: [lwip-devel] RFC: debug and asserts (And: dynamic debug works for us) |
Date: |
Wed, 5 Nov 2003 01:11:40 +0100 |
Hello all,
Agreed on 1, 2, disagree on 3 for the reasons already given by others.
> > 3) Make debug and assert be checked with #if not #ifdef for
> > consistency again.
>
> Objection. As I keep repeating the current usage of debug checking in the
> code is a pain if you want to use dynamic debug switches as we do in our
> system. But as that complaint hasn't lead to changes so far, I guess you
may
> feel free to ignore my objection. :) (It would also mean larger changes).
>
We have been using dynamic debug switches without any problem in lwIP.
I think we did it by overriding the *_DEBUG macro's by #defining them
to be global external variables in lwipopts.h.
For example in lwipopts.h (and this is from heart):
extern u16_t dynamic debug;
#define UDP_DEBUG (dynamic_debug & 0x1)
#define TCP_DEBUG (dynamic_debug & 0x2)
We could then switch the variable bits as we like and this has worked for
us. We no longer use it in that way now, but I can dig up some old code
with a bit of luck.
Regards
Leon.