dump packets in memory buffers with tshark without leaving gdb

I got tired of running my error-prone eyeball packet decoder on GDB buffers, so I took a few minutes to figure out how to send packet data to tshark to let the computer do what it’s good at. Here’s the ~/.gdbinit snippet if you want to use it:

define pktdump
   dump binary memory /tmp/dgoodell-pktdump.bin (char*)$arg0 (((char*)$arg0)+$arg1)
   shell od -Ax -tx1 -v /tmp/dgoodell-pktdump.bin | text2pcap - - | tshark -V -x -i -
document pktdump
Dump a network packet in memory with tshark.
Example usage: pktdump ADDRESS LENGTH

(obviously change “dgoodell” to your user name or stick the file in your home directory, environment variables don’t work in GDB, unfortunately) The results look like:


Text::CharWidth::PurePerl available on GitHub

I’ve put up a new perl module on github, Text::CharWidth::PurePerl.  As the name suggests, it’s a pure-perl implementation of Text::CharWidth.  I needed it to be able to ship nowrap as a script without any dependencies.  Amusingly, it seems to be more correct than the “native” wcwidth routine.

It is packaged in the usual CPAN format, but I’m not currently planning on uploading it to CPAN (I don’t have a CPAN id right now).  That seems like a real PITA right now, and I’m not sure if anyone else might even need it.  If you do want me to go through the steps, feel free to add a comment here on the blog or over on the github issue tracker.

Debugging Wily Stack Overflows in MPI Programs

I recently was debugging a problem in MPICH2 with the new MPI-3 nonblocking collectives implementation that involved a stack overflow. The code in question was usually blowing up with a SIGABRT that came from a stack trace ending in __stack_chk_fail. This bug was particularly nasty because it was a Heisenbug: it kept changing the failure location and mode whenever I would insert debugging code in order to track it down (hence the aforementioned “usually”).


Roku stands behind their product

My older Roku player (this model, N1000-B) died a couple of months ago.  The wireless NIC went out to lunch for some reason, showing 00:00:00:00:00:00 as its MAC address and totally unable to see any wireless networks, just as described here.  I was busy and lazy at the time, so we just switched over to watching Netflix streaming content on our Wii instead.