-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: add ng_pktbuf_stats() to core panic #3500
Conversation
I don't know if there are any arguments against printing (more) stuff in this handler, but I guess in a panic case there are not a lot of things that could get worse. @gebart, @daniel-k, @haukepetersen, objections? |
It helped me a lot finding the bugs in #3496 because I got an idea which areas of the packet buffer got corrupted and then inferring from it the point in code where this happened. |
This introduces another ~500 Bytes of ROM for some Cortex-M platforms (though, only 4 for the IoT-LAB_M3 (which is weird enough). Since we had this discussion recently with another issue, maybe you can find a solution with some DEBUG macro or introduce another define just for debugging gnrc? |
@OlegHahm did you do a info-buildsizes-diff run? could you post the results? |
I did, but cannot access the results right now. |
@OlegHahm do you have them now? |
First of all Also, "with some DEBUG macro" is too unspecific for me to understand what you really mean. But I tried to interpret it and here are my thoughts on that:
|
Here they are:
So, as I wrote: the difference is between 0 and +580 bytes. |
It seems like the ROM size is negligible on the platforms which have an gnrc compatible 802.15.4 transceiver defined by default (pba-d-01-kw2x, mulle, iot-lab_M3, samr21-xpro...). ng_pktbuf_stats is called from inside ng_sixlowpan.c, there is a mistake in the preprocessor condition protecting the call though. |
That's interesting and not very helpful in the same instance ^^ |
Yes, but as discussed recently 500 bytes are IMO too much for
I meant 3.
I don't what macros apart from There is https://github.com/RIOT-OS/RIOT/wiki/Debugging#using-printf (which might need some extension) and there is http://doc.riot-os.org/core_2include_2debug_8h.html
This change introduces 0.5 kB of code for debugging just one feature. Introducing some mechanism (an additional macro or enabling DEBUG on a per module level or similar) to activate this code only while debugging this module/feature, could be one way to come. |
See also #3556 |
@gebart, on the long run gnrc should be able run also on MSP430 platforms where ROM size is certainly not negligible. |
I don't understand With your fix |
@OlegHahm I agree with you that gnrc should be able to run on constrained devices, and adding 500 bytes for printing a message during a crash is maybe not the best use of the ROM space. It is mostly useful when debugging deep inside the network stack. There seems to be some confusion about the real purpose of the DEVELHELP macro. #3333 is also affected by this confusion. What options do we have for these kinds of development tools/helpers? I would like to run with them always enabled while developing, in order to help finding the source of a crash. |
100% agreed. This whole discussion seems to be a good point for the next bi-weekly developer meeting. I will add it to the agenda. |
After sleeping over it a little and while working lwIP (which has a similar mechanism) I thought that it might be a good idea to introduce some kind of statistics macro/module for GNRC or even the whole of RIOT. Besides functionality like this one it also could introduce things like packet counters or (current?) resource usage. Apart from solving this problem it might prove helpful for future optimizations and even in production for network set-ups. |
@authmillenon |
See also #1297 |
@authmillenon, you still want this solution in or are you going to PR something in the direction of #3500 (comment)? |
More in the direction of #3500 (comment). So we can close this for now. |
Prints the current status of the packet buffer in case of a panic.