lwip-members
[Top][All Lists]
Advanced

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

[lwip-members] RFC: improved debugging


From: leon . woestenberg
Subject: [lwip-members] RFC: improved debugging
Date: Mon, 2 Dec 2002 13:27:48 +0100

Hello,

I would like to propose more fine-grained control over debug message
output.

Besides introducing some debug severity levels, I would like to introduce
the
concept of debug message type.

The goals are to be able to
- switch certain types of debugging on or off.
- have a debug threshold so that the verbosity can be controlled.

I would to keep to current interface, just use some extra bits in the debug
byte :
(currently has values 0 or 1).

Types:

DBG_TRACE 0x80
DBG_STATE 0x40
DBG_FRESH 0x20

bit 0 indicates whether the debug message is enabled at all.
(to maintain backwards compatibility).

Levels 0-3 (in bits 1 and 2):
level 0 means lowest severity
level 3 means highest severity

DBG_TRACE allows one to follow the program flow
(i.e. there is exactly one DBG_TRACE statement per C block, so
that all branch decisions, function calls and loops can be traced.)

DBG_STATE allows one to keep track of the state of a module.
(like the contents of the ARP cache, or the linked list of the memory
allocator).

DBG_FRESH allows one to mark new code and extend debugging.

Examples:

DEBUGF(DBG_TRACE | DBG_DHCP, "dhcp_renew(): Renewing IP address lease.");
DEBUGF(DBG_TRACE | DBG_ETHARP, "etharp_ip_input(): Sending queued
packets.");
DEBUGF(DBG_STATE | DBG_ETHARP, "etharp table[i]: %u.%u.%u.%u -
%02x:%02x:%02x:%02x:%02x:%02x", ...);
DEBUGF(DBG_FRESH | DBG_STATE | DBG_ETHARP, "etharp table[i]: adding packet
%p to the queue.", ...);

Bits 3 and 4 are reserved for future use (expand debug types or levels).

I am going to use this debugging interface on the etharp module.

In the meantime, I am open to comments. :-)

Regards,

Leon.





reply via email to

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