1*83ee113eSDavid van Moolenbroek/** 2*83ee113eSDavid van Moolenbroek @page debug Debugging 3*83ee113eSDavid van Moolenbroek This page enumerates various techniques useful for debugging ISC DHCP software. 4*83ee113eSDavid van Moolenbroek 5*83ee113eSDavid van Moolenbroek @section debugTips Debugging Tips & Tricks 6*83ee113eSDavid van Moolenbroek 7*83ee113eSDavid van MoolenbroekISC DHCP code is somewhat convoluted. Due to extensive macros use, it is often 8*83ee113eSDavid van Moolenbroekdifficult to even find whole function, much less to understand what they 9*83ee113eSDavid van Moolenbroekactually do. One way to find such a macro-defined function is to compile the 10*83ee113eSDavid van Moolenbroekcode with debugging symbols (-g), load the binary into gdb and set a breakpoint 11*83ee113eSDavid van Moolenbroekfor such a function. gdb will print out exact place in the code where the 12*83ee113eSDavid van Moolenbroekfunction is defined. Presumably one will find a macro at that specific location. 13*83ee113eSDavid van MoolenbroekFor example to find where \ref lease_reference function is defined do: 14*83ee113eSDavid van Moolenbroek 15*83ee113eSDavid van Moolenbroek@verbatim 16*83ee113eSDavid van Moolenbroekgdb 17*83ee113eSDavid van Moolenbroekfile dhcpd 18*83ee113eSDavid van Moolenbroekb lease_reference 19*83ee113eSDavid van Moolenbroek@endverbatim 20*83ee113eSDavid van Moolenbroek 21*83ee113eSDavid van MoolenbroekDEBUG_MEMORY_LEAKAGE may be defined in includes/site.h to enable some debugging 22*83ee113eSDavid van Moolenbroekcode to help with debugging memory issues. This code keeps a running total 23*83ee113eSDavid van Moolenbroekof the outstanding memory that has been allocated and a list of the outstanding 24*83ee113eSDavid van Moolenbroekallocations. Both are updated whent he memory is freed. Status information is 25*83ee113eSDavid van Moolenbroekprinted when do_packet() and do_packet6() complete processing. The outstanding 26*83ee113eSDavid van Moolenbroekvalue is expected to grow when new structures are used - for example when a new 27*83ee113eSDavid van MoolenbroekIPv6 lease is created. It is not expected to grow when a structure is reused 28*83ee113eSDavid van Moolenbroekfor example when an IPv6 lease is renewed. 29*83ee113eSDavid van Moolenbroek 30*83ee113eSDavid van MoolenbroekDEBUG_RC_HISTORY and DEBUG_RC_HISTORY_EXHAUSTIVELY can also be defined to provide 31*83ee113eSDavid van Moolenbroekmore verbose information about reference counts on objects. 32*83ee113eSDavid van Moolenbroek 33*83ee113eSDavid van Moolenbroek*/ 34