I thought you would have already known the basics. If you google for "box2d debug draw" you will probably get my tutorial page as the first result: http://www.iforce2d.net/b2dtut/debug-draw
You can also see how it works by referring to the standard Box2D testbed.