Thursday, August 12, 2010

How to find a Bug

Today i worked in The Midway for PS3 Home. In fact i spent quite a number of hours looking into a couple of annoying bugs in there. The first one ended up being quite easy to fix once i had figured out what was wrong. the second one took a while but i got it in the end.

The first bug is simply a sorted list problem. I say simply but in fact it took me a while to fix because it wsn't an error on an existing line of code. It was in fact a missing line of code that was the issue. So the list (actually an array) needs to be shuffled down to let in the new element. Simple enough and i could see the shuffle code was there. Only the bug happened to be the fact that although the list was being shuffled for it's main attribute, it's other attribute was not. So that mean't that a sorting element was not being suffled along with the main element. DOH! Easy 1 line fix.

The second bug was interesting as it was a network bug. We had no idea what was causing it and yet we know of certains apsects or manifestations of the bug. So i spent some time in the midway trying different things to no avail. Then i examined the code directly to see what i could see. Finally i ended up talking with the designer and another prohrammer about the bug and i got some useful ideas i could try out. As it happened the first thing i tried worked great. The fix will be easy enough tomorrow.

So how do ya find bugs?
Number 1, Find a reliable repro for it (reporoduction steps). If you have this you can find any bug. Though some are still harder than others haha!
Number 2, don't be afraid to talk to others about it, even none programmers.
Number 3, don't ignore any coincidence, however remote or inconsequential it might at first appear.

G'night and happy bug hunting.

1 comment:

  1. I had a problem recently about how to determine colour matches correctly (the exact problem doesn't really matter), but I was having some major problems with some of the data structures used.

    I explained the problem to my younger brother, who is currently doing his A levels and has never programmed before - he suggested the perfect solution to my problem.
    Bouncing ideas off *any* people, in my experience, is always beneficial.