Blog Post RSS ?

Blogs » PHP » Debugging PHP
 

Debugging PHP

by Troels Knak-Nielsen

I just checked in a little project, I’ve been working on for the last couple of weeks.

It really begun at the last Copenhagen php-meetup; Joakim Nygård and Jacob Oettinger made a presentation of their project, WebCacheGrind. I casually mentioned something about having played with the dbgp-protocol (The debugging part of Xdebug) and that it ought to be simple enough to write a fontend for it. That prompted some snickering from the back row. Apparently some guys had this rule at their workingplace, that whomever said that something ought to be easy to do, had to do so himself. Not an unreasonable rule, I suppose. Obviously, I couldn’t let that go unattended, so I gave it a shot.

Screenshot of Spectator

Spectator is a XUL application, which should make it cross platform. I have tinkered a bit with XUL before, but not a full application. If you’re wondering what XUL is, it’s the GUI toolkit, in which the frontends for Firefox and Thunderbird are written. It’s a markup language — much like HTML, which can be scripted with Javascript. This makes it very easy to work with. The only problem seems to be a rather lacking documentation, but a bit of detective work got me through that.

So what can spectator do? Mind that this is a first version and I really just meant it as a proof of concept. I think I got a bit further than that, but it probably still has a few bugs. Still, with the current version, you can step through a program, set breakpoints and inspect the stack. Really all you would expect from a debugger.

Of course, as some of you might point out, there are already other implementations available. Most notably Komodo, which is also implemented with XUL. However, these implementations are proprietary, and are integrated with an IDE, that you may not want to use. Spectator is an open source alternative and is IDE/editor agnostic.

This post has 7 responses so far

  1. You do know that Komodo is going “open source” for their next major upgrade:
    http://www.openkomodo.com/

    Not that it deminises the usefulness of a KISS xdebug frontend in XUL at all. But something to aware of ..

     
  2. Great work. I’ve been looking for a no-nonsense cross platform app to debug my php code on. Just to let you know I have also run it successully on Windows using the XULRunner that is part of Firefox 3:

    e.g.
    firefox.exe -app path\to\spectator\xul\application.ini

    Thanks!

     
  3. Looks interesting! Since it’s based on XUL, perhaps it can be integrated with Open Komodo which is an open source text editor / IDE also based on XUL?

     
  4. Works like a charm on Mac OS X (10.5.3). Looks as ugly as an XUL app, but works really great! Fantastic work!

     
  5. Since it’s based on XUL, perhaps it can be integrated with Open Komodo which is an open source text editor / IDE also based on XUL?

    Yes, I suppose it could. The model layer libraries are independent of the presentation layer, so you could reuse these in Komodo. I don’t have much incentive for doing so though, since I prefer to use a stand-alone editor (Mostly Emacs). There are obviously some benefit to have editor and debugger integrated, but I don’t think it’s much of a problem to have the two running separately.

     
  6. Hey, that’s awesome – I’m surprised you followed through, since that rule only really applies to employees ;)

     
  7. Why not make this a Firebug extension..? :)

     

Sponsored Links

Leave a response

You are not logged in, log in with your SitePoint Forum username and password.

-OR- Post Anonymously

* Make sure any code samples are escaped (i.e. ‘<b>’ becomes ‘&lt;b&gt;’).

If not logged in, your comments will be placed in a moderation queue. This means your comment may not appear until one of our moderators approves it.

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Logo Design, Web page Design and more!

99designs

  • Custom logo designs created ‘just for you’.
  • Pick the design you like best.
  • Only pay if you’re satisfied with the result.

It's Back!
FREE PDF with any printed book!