Archive for January, 2009

MacGDBp for xdebugging

Sunday, January 18th, 2009

I’ve just got around to moving servers and switched out Zend’s debugging extension for Xdebug and I now need a client to do my debugging with (I’m ditching ZDE too). MacGDBp was hyped up a while ago as being some sort of amazing PHP debugging client for Mac so I gave it a shot.

My setup is a remote server with Xdebug running on it. To get this working you need to configure some settings in php.ini such as the port (9000) and my local computer’s hostname (so either a static IP or some dynamic dns hostname). You also need to allow incoming connections on your local network for port 9000, and have them forwarded to the correct machine (my laptop). This was all painless enough to setup, but I can imagine the firewall issue is a cockblock for corporate environments or debugging on the go with cafĂ© wifi.

So now the networking is working, I connect to my server with an extra query string variable set for XDEBUG_START_SESSION and away we go - it works! I can step through my code and see the variable objects and so on…. only one thing is missing: the source of the file being debugged! So far as I could see from a quick skim of the GDBp spec, there isn’t the ability to transfer the source code being debugged between Xdebug and the client; instead it refers the full path of the file on the remote server, eg “file:///www/mysite/index.php”. This is fine if you’re working locally because MacGDBp can use that path to open up the local source code and display the source/lines/breakpoints as you would expect; but it totally falls apart when you’re remote debugging and it displays nothing. So I can debug remote scripts, but I can’t see the source of what I’m debugging, bloody marvellous!

I managed to work around this by using MacFusion, which I use to edit remote files with a local IDE, and making a symbolic link between “/www” and “/Volumes/myremotesite” (which is the FUSE mount point for my remote site). It kinda sucks though: it would be much slicker if the debug client could get at the source directly (via it’s own use of FTP/SSH perhaps?).

Anyways, I got things working ok in the end. There’s another thing I really don’t like with the client and that’s that I have to press the “start” button on the debug client every time I want to do some debugging. So press start, go to browser and load script, switch to client and debug, make some changes to the script, press start, press refresh. It’s really annoying, why can’t it just “start” automatically after the end of each session? (So far as I know, it’s just listening on port 9000 for incoming debug sessions).

I’m really not impressed with this piece of kit so far (in part due to the hype around it and it not livng up to my expectations). It’s the only “standalone” client out there so I’m probably stuck with it for a while :).