Drupal - Why is ddebug_backtrace coming up blank?

For me the command had to be called without the extra d

dpm(debug_backtrace());


If you see the source, you can see that ddebug_backtrace() only returns values if the variable error_level is set to 1 or greater.

// Show message if error_level is ERROR_REPORTING_DISPLAY_SOME or higher.
// (This is Drupal's error_level, which is different from $error_level,
// and we purposely ignore the difference between _SOME and _ALL,
// see #970688!)
if (variable_get('error_level', 1) >= 1) {

So one of the ways to make it return values is by either changing the error_level from admin/config/development/logging, or change it temporarily in the code like so:

variable_set('error_level', 1);
dpm(ddebug_backtrace(TRUE));
variable_set('error_level', 1);

As Ian Bullock says, debug_backtrace() would return values because it ignores the variable and the content is essentially the same. But ddebug_backtrace() returns a more readable output.

Tags:

Debugging