lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Fwd: RE: useful tips for lwip debug


From: Shawn He
Subject: [lwip-users] Fwd: RE: useful tips for lwip debug
Date: Tue, 2 Mar 2004 09:18:32 -0800 (PST)

Here is a discussion about lwip debug message flag
process, feel free to point out any mistakes or share
any comments. As for the definitions of the parameters
that are used in macro LWIP_DEBUGF within debug.h
file, I still believe that defining DBG_TYPES_ON and
DBG_MIN_LEVEL in opt.h file after including debug.h
file is too late which causes the problem that the two
parameters are actually undefined when the macro is
processed, and probably the reason most time the macro
doesn't behave the way as people would expect it. For
other parameters that are used when calling the macro,
there is no problem to define them in the opt.h file.

--- David Aldrich <address@hidden>
wrote:
> From: David Aldrich
> <address@hidden>
> To: "'Shawn He'" <address@hidden>
> Subject: RE: useful tips for lwip debug
> Date: Tue, 2 Mar 2004 15:22:18 -0000
> 
> Hi Shawn
> 
> Thanks very much for your reply.  Please send it to
> the LWIP users mail
> list - I am sure that other people will find it
> helpful.  I have made
> some comments inline below.
> 
> David
> 
> > -----Original Message-----
> > From: Shawn He [mailto:address@hidden 
> > Sent: Monday, March 01, 2004 7:39 PM
> > To: address@hidden
> > Subject: useful tips for lwip debug
> > 
> > 
> > Hi David,
> > 
> > I have been working on LWIP for the past 6-7
> weeks,
> > and I encountered similar problem with debug
> messaging
> > as you did. From reading the code, I think the
> debug
> > message combines three parts (or three
> parameters):
> > type, functionality and severity. It's
> unfortunately
> > that not all the lwip source code stick with that
> > convention, and you may not get some of the
> printout
> > if you just try to turn on flags on certain debug
> > messages in these files without modifying them in
> the
> > code.  To only add new debug messages for your own
> > code might be easier, what you need to do is
> > following:
> > 1. define LWIP_DEBUG at the beginning of debug.h
> file
> > or another file that would be loaded before
> debug.h
> > file
> 
> [David] Yes.  A convenient way to do this is to add
> -DLWIP_DEBUG to
> CCFLAGS in the LWIP makefile.
> 
> > 2. define DBG_MIN_LEVEL to a value (0-3) that you
> > like, 0 usually means print out everything, and
> the
> > higher value the more severity degree, and this
> has to
> > be defined before the macros in the debug.h
> 
> [David].  Yes, I agree with you about the function
> of DBG_MIN_LEVEL, but
> I disagree that it must be defined before the macros
> in debug.h.  My
> understanding is that it is defined in opt.h, after
> the inclusion of
> debug.h.  
> 
> > 3. define DBG_TYPES_ON, it could be an OR of
> several
> > values, such as DBG_TRACE, DBG_STATE, DBG_FRESH,
> and
> > this has to be defined before the macros in the
> > debug.h too
> 
> [David] Again, I think one makes this assignment in
> opt.h.
> 
> > 4. define a type that you want debug message on,
> such
> > as #define SOCKETS_DEBUG DBG_ON, you could use a
> new
> > name for the type as long as you define it here
> 
> [David] Again, in opt.h.
> 
> > 5. In your source code where you use LWIP_DEBUGF
> > macro, specify three parameters(at least the first
> > two): type (you could borrow from current existing
> > names such as SOCKETS_DEBUG, or a new name you
> like), 
> > functionality (one or combination of  DBG_TRACE,
> DBG_STATE, 
> > DBG_FRESH and DBG_HALT), and severity (a number 1
> to 3), if 
> > you don't specify it, the default would be 0.
> > 
> > Once you are done with the above 5 steps, you
> should
> > be able to see the message once the code hits its
> > severity level that you defines.  
> 
> [David] I think the other important point is that
> LWIP_PLATFORM_DIAG and
> LWIP_PLATFORM_ASSERT must be correctly defined in
> cc.h.  Typically, this
> means calling printf().
> 
> > Let me know if this helps.
> 
> [David]
> 
> Yes, your email was helpful. Thank you.
> 
> David
> 
> 
> Telecom MODUS is an ISO9001/TickIT approved Company.
> LRQA Certificate of Approval reference 0965133
>
************************************************************
> THIS MESSAGE IS INTENDED ONLY FOR THE USE OF THE
> INDIVIDUAL TO WHOM IT IS ADDRESSED AND CONTAINS
> INFORMATION THAT IS PRIVATE AND/OR PROPRIETARY.
> If the reader of this message is not the intended
> recipient, or the employee or agent responsible for
> delivering the message to the intended recipient,
> you are hereby notified that any dissemination,
> distribution or copying of this communication is
> strictly prohibited.
> If you have received this communication in error,
> please forward the whole message to
> address@hidden
> Company Registration No.3493954
> Telephone Number +44 (0) 1372 381880
> Fax Number +44 (0) 1372 381804
> Email address@hidden
>
************************************************************
> 


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com




reply via email to

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