These are the ramblings of Matthijs Kooijman, concerning the software he hacks on, hobbies he has and occasionally his personal life.
Most content on this site is licensed under the WTFPL, version 2 (details).
Questions? Praise? Blame? Feel free to contact me.
My old blog (pre-2006) is also still available.
See also my Mastodon page.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
(...), Arduino, AVR, BaRef, Blosxom, Book, Busy, C++, Charity, Debian, Electronics, Examination, Firefox, Flash, Framework, FreeBSD, Gnome, Hardware, Inter-Actief, IRC, JTAG, LARP, Layout, Linux, Madness, Mail, Math, MS-1013, Mutt, Nerd, Notebook, Optimization, Personal, Plugins, Protocol, QEMU, Random, Rant, Repair, S270, Sailing, Samba, Sanquin, Script, Sleep, Software, SSH, Study, Supermicro, Symbols, Tika, Travel, Trivia, USB, Windows, Work, X201, Xanthe, XBee
While trying to track down a reset bug in the Pinoccio firmware, I
suspected something was going wrong in the dynamic memory management
(e.g., double free, or buffer overflow). For this, I wrote some code to
log all malloc
, realloc
and free
calls, as wel as a python script
to analyze the output.
This didn't catch my bug, but perhaps it will be useful to someone else.
In addition to all function calls, it also logs the free memory after
the call and shows the return address (e.g. where the malloc
is called
from) to help debugging.
It uses the linker's --wrap
, which allows replacing arbitrary
functions with wrappers at link time. To use it with Arduino, you'll
have to modify platform.txt to change the linker options (I hope to
improve this on the Arduino side at some point, but right now this seems
to be the only way to do this).
Comments are closed for this story.