[Click] How do I debug a click element?

betamaz betamaz at gmail.com
Wed Mar 30 20:19:42 EST 2005


Hi,

I am trying to figure out what functions of an element .cc file get
called when the element gets called from a configuration file.  To do
this, I am inserting debug messages in a file, by using the
click_chatter( ) function. In order to run the configuration and see
the messages I have tried recompiling by using
'/click-1.4.3/configure' and '/click-1.4.3/Makefile' then looked for
my debug messages in standard out and /var/log/messages.  In both
cases I didnt see my debug messages.  Also, the later case of running
'make' took way too long for recompiling and thus I prefer to avoid.

1) What would be a better/faster method to recompiling only changed
elements of click?

2) Previously, i had tried to use printf statements, which resulted in
compilation errors when running '/click-1.4.3/configure'.  It was
suggested to me to debug using click_chatter rather than printf
statements.  In the message archives, I saw a few examples of printf
statments being used to debug when creating new elements.  I would
appreciate an explanation of why printf statments will work in new
elements but not in debugging the old.


Thank you,
Bita.
----------------------------------------
For example: I am trying the simple test-device.click configuration:
      FromDevice(eth0) -> Print(ok:eth0) -> Discard;

and changing one of the fromdevice.cc to the following:
void
FromDevice::static_initialize()
{
    from_device_map.initialize();
#ifdef HAVE_CLICK_KERNEL
    packet_notifier.notifier_call = packet_notifier_hook;
    packet_notifier.priority = 1;
    packet_notifier.next = 0;
#endif
    device_notifier.notifier_call = device_notifier_hook;
    device_notifier.priority = 1;
    device_notifier.next = 0;
    register_netdevice_notifier(&device_notifier);

    // CLICK_DEBUG
    click_chatter("CLICK_DEBUG: initializing fromdevice.cc");
    // -
}


More information about the click mailing list