How to debug networking codes?

Till Straumann strauman at slac.stanford.edu
Wed Aug 22 17:20:19 UTC 2007


RTM.

You cannot debug networking code. If you set a breakpoint in
networking and e.g., the network task is suspended at the breakpoint
-- how do you expect the stub to continue talking to the host gdb
using the same network stack???

If you want to debug networking then you should use GDB on a serial
connection (preferrably a separate serial port where no printf/printk
is directed).

HTH
-- Till

Rahman, Md S. wrote:
>
> Hello,
>
> I have been porting SCTP(Stream Control Transmission Protocol) in 
> RTEMS from FreeBSD. This is a transport layer protocol and resides 
> with TCP/UDP networking codes in kernel. I am mostly done with this 
> port and a number of SCTP socket API’s like socket, listen, bind, 
> accept, connect etc. works fine.
>
> However, I am now encountering some exception problems while 
> establishing SCTP connection between RTEMS SCTP endpoint with FreeBSD 
> SCTP endpoint via internet. The console shows:
>
> Exception 6 caught at PC 191864 by Thread 167831697
>
> Processor execution context at time of the fault was:
>
> EAX 340012E7 EBX=384 ECX=FFFFFFFF EX=0
>
> ESI=0 EDI=0 EBP=195838 ESP=195804
>
> Error code pushed by processor itself (if not 0) = 0
>
> Faulty Thread will be deleted
>
> I tried to debug this problem by adding printf in codes but was not 
> able to detect the exact statement which causes this exception. Then I 
> have built RTEMS_GDB_Stub_1.4 
> (http://www.slac.stanford.edu/~strauman/rtems/gdb/index.html 
> <http://www.slac.stanford.edu/%7Estrauman/rtems/gdb/index.html>) for 
> remote debugging and built my RTEMS SCTP application with 
> librtems-gdb-stub.a library. At this point, running the RTEMS 
> application crashes with:
>
> GDB Agent: Exception (SIGILL) caught; Task 0xA010001 Killed 
> (Suspended) –use GDB
>
> Exception Vector #0x6; Registers:
>
> …………………
>
> To investigate further with breakpoints, I have configured gdb6.6 
> patched with RTEMS_GDB_Stub_1.4 in the host machine FC5. This works 
> fine and any break point in RTEMS application in init.c could be 
> reachable by the host gdb. However, when I try to reach a breakpoint 
> in SCTP code which resides in cpukit/libnetworking/netinet, host gdb 
> loses connection with the target machine and target application dies.
>
> In this point, I am not sure how should I proceed to solve this problem.
>
> I would appreciate any suggestion in this regard.
>
> Best Regards,
>
> Md Sazzadur Rahman
>
> Graduate Student,
>
> School of Computer Science,
>
> University of Oklahoma,
>
> Norman, Oklahoma, USA
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>   





More information about the users mailing list