Posts

Showing posts from July, 2012

simplified strace diffing

Image
strace is an extremely powerful tool. But have you ever attempted to compare strace log files? That can get tricky. How about diffing multiple strace logs of multi-process applications? That can be a world of pain. So, I wrote a simple shell script to make a life easier. Then I decided to rewrite it in Python and life got even better :-) My reason for diffing multi-process strace logs was not to see where an application was failing (that's what debuggers are for) but more to understand the flow of program execution. So what follows may have a fairly niche audience. The script is pretty simple: it's just simplifies the log files to allow easier diffing. Specifically it: replaces all addresses with 0xADDR (or 0xNULL ). replaces all timestamps with HH:MM:SS . replaces all datestamps with YYYY/MM/DD . tracks PIDs and replaces each PID seen with a 1-based value (so the first PID seen will be assigned PID1 , the second PID2  et cetera). These simple changes turn out

A Bazaar pre-commit hook to look for signs of unfinished work

Intro Programming involves a fair amount of mental juggling: jumping around a codebase working on a new feature or attempting to track down a bug in existing code, you have to keep track of a lot of pieces of information. However, more balls end up being thrown into the air when, passing through some file or function, you come across an area that needs a bit of lovin'. Often the niggles you spot are minor, but not minor enough to ignore (no Broken Windows here please!) The problem is that these minor imperfections -- which are probably entirely unrelated to the task at hand -- are both annoying and distracting. Imagine... A needs fixing. C, D, E and G need refactoring now that B exists. Documentation for C, E and G need their function docs updating. H introduces a new feature that needs to be documented in a man page. I is inconsistently formatted. J contains a couple of typos. K lacks sufficient tests. L is now giving warnings with the new stricter version of