If the widget is part of the wordpress core, you can see its source in
If it came with a theme or plugin, you can find the code there. Sometimes widgets will be in an obviously-named widgets.php, but other times you'll have to hunt for them. At some point, each widget has to be registered by calling
register_widget. You can use the command line tool
grep to find the
register_widget call in the plugin/theme.
Sample grep syntax:
grep -r 'register_widget' .
If the machine you're on doesn't have grep, most IDEs also contain tools for searching through your code. Eclipse (multi OS), Textmate2 (OSX), and Notepad++ (Windows) are a few of my personal favorites. To that end, the more recent versions of OSX and Windows do a half-decent job of searching within files from right within Finder / Windows Explorer.
As far as getting a backtrace, xdebug is a very powerful tool for figuring out just what a page is doing. You can use remote debugging with one of the supported IDEs to really dive into your code.