Great Development Hacks

One of the best development hack setups I have is the one I use to develop compiz fusion. When developing compiz, you have the tendency to lock up your screen, a lot. One segfault, and you can loose control of the X server, or just lock up your screen. This make using a debugger all but impossible, as you can essentially be locked out of your mouse and keyboard. Furthermore, you find yourself wasting a ton of time waiting for your computer to reboot after a lockup. This isnt very conducive to a pleasant development experience, so I have a workaround! The drawbacks is that it needs two computers, but the upside is you  dont have to reboot your computer every minute when developing, and can effectively debug. I’m sure this technique could be used to develop other software (bar the kernel itself) that has the potential to lock up you X server.

Basically,

  1. Install your compiz dev environment on computer A, and make sure ssh is set up
  2. From computer B, ssh into computer A using the -Y flag (e.g. ssh kevin@192.168.1.108 -Y)
  3. From computer A, navigate to your source directory. You can run vim, gedit, geany, or whatever development environment you want, and have the controls (even gui’s) on computer B, although the dev environment is running on computer A. You can make modifications, or compile from computer B now.
  4. Run compiz from computer B. This can be done with “compiz –replace –display :0.0” (assuming you dont have a crazy xserver setup). If it crashes, no big deal, you can easily recover by running metacity –replace –display :0.0.
  5. The real power of this setup is the ability to debug using gdb. This is pretty much impossible using one machine. Just run
    $ gdb compiz
    (gdb) set args –replace –display :0.0
    (gdb) r
    and you can easily pin down segfaults, or debug tricky problems!

There you go! Advanced graphics development made easy 😀

This entry was posted in Coding. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *