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

Trace mode integrated



Printf debugging still remains the best way to debug lots of code, and Jeremie 
Diminio sent me a *really* useful camlp4 extension which adds function-boundary 
tracing to a file.

I've integrated this trivially into the Mirage tree in os-bigarray, so now you 
can specify "MIR-TRACE=1" in the Makefile, and recompile, and the entire stack 
will spew out trace output on every function call, with nice ANSI colour coding 
to signify which bit it comes from  (std, net, os, other).  Very useful for 
debugging or generally seeing whats going on.

You can try it out by setting MIR-TRACE=1, and optionally edit 
syntax/pa_trace.ml to set the top variables (you can filter out "std" to reduce 
the output levels considerably).

Example output below (sans colors of course):

input: File "net/direct/ethif.ml", line 37, characters 2-332 (end at line 46, 
character 55)
get_ethernet_ethertype: File "net/direct/ethif.ml", line 29, characters 0-111 
(end at line 33, character 15)
get_uint16: File "std/cstruct.ml", line 64, characters 4-87 (end at line 66, 
character 19)
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
shift: File "std/cstruct.ml", line 153, characters 2-29
len: File "std/cstruct.ml", line 123, characters 14-21
dim: File "std/bigarray.ml", line 107, characters 14-34
sub: File "std/cstruct.ml", line 133, characters 22-37
input: File "net/direct/ipv4.ml", line 129, characters 2-579 (end at line 143, 
character 63)
get_ipv4_hlen_version: File "net/direct/ipv4.ml", line 21, characters 0-261 
(end at line 32, character 15)
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_ipv4_src: File "net/direct/ipv4.ml", line 21, characters 0-261 (end at line 
32, character 15)
get_uint32: File "std/cstruct.ml", line 69, characters 4-125 (end at line 71, 
character 55)
get_uint16: File "std/cstruct.ml", line 64, characters 4-87 (end at line 66, 
character 19)
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_uint16: File "std/cstruct.ml", line 64, characters 4-87 (end at line 66, 
character 19)
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_ipv4_dst: File "net/direct/ipv4.ml", line 21, characters 0-261 (end at line 
32, character 15)
get_uint32: File "std/cstruct.ml", line 69, characters 4-125 (end at line 71, 
character 55)
get_uint16: File "std/cstruct.ml", line 64, characters 4-87 (end at line 66, 
character 19)
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_uint16: File "std/cstruct.ml", line 64, characters 4-87 (end at line 66, 
character 19)
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_ipv4_len: File "net/direct/ipv4.ml", line 21, characters 0-261 (end at line 
32, character 15)
get_uint16: File "std/cstruct.ml", line 64, characters 4-87 (end at line 66, 
character 19)
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
sub: File "std/cstruct.ml", line 133, characters 22-37
sub: File "std/cstruct.ml", line 133, characters 22-37
get_ipv4_proto: File "net/direct/ipv4.ml", line 21, characters 0-261 (end at 
line 32, character 15)
get_uint8: File "std/cstruct.ml", line 33, characters 2-23
input: File "net/direct/udp.ml", line 34, characters 2-339 (end at line 41, 
character 13)
get_udpv4_dest_port: File "net/direct/udp.ml", line 26, characters 0-116 (end 
at line 31, character 15)
get_uint16: File "std/cstruct.ml", line 64, characters 4-87 (end at line 66, 
character 19)




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.