lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [task #7499] Current thread information for debugging purpo


From: Simon Goldschmidt
Subject: [lwip-devel] [task #7499] Current thread information for debugging purposes
Date: Fri, 30 Nov 2007 09:28:48 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.10) Gecko/20071115 Firefox/2.0.0.10

URL:
  <http://savannah.nongnu.org/task/?7499>

                 Summary: Current thread information for debugging purposes
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: goldsimon
            Submitted on: Freitag 30.11.2007 um 09:28
                Category: None
         Should Start On: Freitag 30.11.2007 um 00:00
   Should be Finished on: Freitag 30.11.2007 um 00:00
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
        Percent Complete: 0%
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
                  Effort: 0.00

    _______________________________________________________

Details:

Seeing all the 'bug reports' on the users list, I think it would be nice to
define debug-functions to get the current thread-ID or pointer or whatever to
identify the currently running thread. Most OSes should know how to do that
(either get the current prio or a pointer to the thread control block or a
unique ID...).

I propose the following debug extensions:

in sys.h:

#if LWIP_DEBUG && !NO_SYS
#define LWIP_DEBUG_TRHEAD_ID_STORAGE(t)
LWIP_DEBUG_SYS_ARCH_TRHEAD_ID_STORAGE(t)
#define LWIP_DEBUG_GET_THREAD_ID() LWIP_DEBUG_SYS_ARCH_GET_THREAD_ID()
#define LWIP_DEBUG_INIT_THREAD_ID(t) (t) =
LWIP_DEBUG_SYS_ARCH_GET_THREAD_ID()
#define LWIP_DEBUG_ASSERT_THREAD(t) LWIP_ASSERT("function called from the
wrong thread", (t) == LWIP_DEBUG_SYS_ARCH_GET_THREAD_ID())
#else /* LWIP_DEBUG && !NO_SYS */
#define LWIP_DEBUG_TRHEAD_ID_STORAGE(t)
#define LWIP_DEBUG_GET_THREAD_ID(t)
#define LWIP_DEBUG_INIT_THREAD_ID(t)
#define LWIP_DEBUG_ASSERT_THREAD(t)
#endif /* LWIP_DEBUG && !NO_SYS */

and in sys_arch.h (example for win32):

__declspec(dllimport) unsigned long __stdcall GetCurrentThreadId();
#define LWIP_DEBUG_SYS_ARCH_TRHEAD_ID_STORAGE(t) unsigned long t
#define LWIP_DEBUG_SYS_ARCH_GET_THREAD_ID() GetCurrentThreadId()

in tcpip.c:
LWIP_DEBUG_TRHEAD_ID_STORAGE(tcpip_thread_id);

Then, in tcpip_thread(), the first thing to do is initialize
tcpip_thread_id:
LWIP_DEBUG_INIT_THREAD_ID(tcpip_thread_id);

and in every timer function (e.g. tcpip_tcp_timer()):
LWIP_DEBUG_ASSERT_THREAD(tcpip_thread_id);






    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?7499>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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