Debugging is one part tools, and one part process.
Debugging tools can help you gather additional information about the state and context of your application when performing different tasks. There are generally two reasons that you’re interested in tools for debugging Drupal: either your site or some specific feature isn’t working, or you’re ready to take a peek behind the curtain and learn more about how a specific feature works.
Knowing what to look for, and where to start looking, requires practice and a methodical approach. As you become more familiar with Drupal, debugging will become faster and easier as you’ll recognize common symptoms and know how to treat them.
Additionally, we firmly believe that stepping through the code using tools like a debugger or analyzing what your code is doing with a profiler is one of the best ways to truly understand Drupal’s APIs.
- Figure out why your Drupal site is displaying a white screen of death
- Locate problems in code so that you can fix them
- Learn how a feature or API in Drupal works by stepping through the code as it executes
New tools to assist with debugging will continue to be developed. At the same time, existing tools are unlikely to become irrelevant anytime soon—especially those that are not Drupal-specific.
Stark is one of the themes bundled with Drupal. It is intentionally bare bones and its purpose is to help Drupal theme and module developers get to the heart of Drupal's system templates.
- The Devel module, and its many sub-modules, provide useful tools for debugging, and understanding, Drupal code.
- Xdebug is a PHP extension, and the tool of choice, for setting breakpoints and stepping through PHP code as it is executed.
- Our recommendation: bite the bullet and figure out how to use Xdebug; it’ll save time and make you a better developer.
Drupal 8 Debugging Techniques (webwash.net)
- Experienced Drupal developer Ivan Zugec demonstrates various Drupal debugging tools including Kint, Webprofiler, Xdebug, Drupal Console, and more. Includes live demonstrations that’ll give you a good idea of each tool’s functions.
Dark Art of Debugging - php[tek] (youtube.com)
- This presentation from php[tek] by our own Joe Shindelar lays out a tools-independent approach for methodically locating bugs in software. Useful for practicing and getting better at debugging.
Debugging: The 9 Indispensable Rules for Finding Even the Most Elusive Software and Hardware Problems, by David J. Agans (amazon.com)
- A book that teaches how to approach debugging using methodical analysis in order to be a more efficient and better developer.