Debugging transient issues like flickering can be a real pain because it's difficult to see exactly what's happening when it only affects a few rendered frames. Enabling paint flashing in Firefox is useful for detecting unnecessary repainting but again it can be difficult to use when there's a series of consecutive interesting frames --- e.g., when you're trying to figure out why something has repainted many times in a row instead of just once. But now I have found an excellent solution to these problems!
Andrew Overholt recently pointed out to me GNOME Shell's built-in screencasting ability --- just press Shift-Ctrl-Alt-R to start recording, and a WebM file is dumped in ~/Videos. As far as I can tell, this file contains exactly one video frame per frame rendered by the desktop compositor, which is perfect for analyzing rendering issues. (Video frame timestamps are correct, so playing the file normally works as expected.) Loading it up in gmplayer, you can press '.' to advance one frame at a time. The video quality is high, and overall it's absolutely brilliant for frame-by-frame analysis of what was rendered.