如何回溯调试magento对象

They gave me some tasks over a huge site realized with Magento.
I use Netbeans with Xdebug to debug (I'm on lubuntu oneiric btw) and I'm finding myself quite fine with all my tasks.
It happened to me to face a task concerning a class redeclaration and I lost a lot of time in finding the right file to change.

Just to learn how to do it correctly:
the task was to change the meta keywords, starting from a code like

<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />

With Netbeans debugger I can easily open the file containing getKeywords() which has:

public function getKeywords()
{
    if (empty($this->_data['keywords'])) {
        $this->_data['keywords'] = Mage::getStoreConfig('design/head/default_keywords');
    }
    return $this->_data['keywords'];
}

Now I couldn't find an easy way to go on through debugging in both cases :(
In particular my case is that $this->_data['keywords'] is not empty on the page I had to correct ..

so how can I easily know how this object is created and in particular who fills _data['keywords']?
It took me long time to find the right file by myself.

I'm not so expert in debugging, so maybe I could do it with netbeans w/ xdebug, but I cannot figure it out.

Thanks

open up terminal and

grep 'setKeywords(' app/code/ -rsn 

this will reveal you the locations where this variable is set or used

grep -ri "Keywords" * | grep -v cache

'-r' means recursive
'-i' means case insensitive
'*' means any file name
'| grep -v cache' means strip out any references into the cache directory

You could temporarily create the method:

public function setKeywords($s) {

    echo sprintf('<pre>%s</pre>', print_r(debug_backtrace(), true));
    exit;
}

Add this code to same class that has getKeywords() so that when someone adds data via this function, you will see the backtrace and figure out how it happened