6

I've been using the Devel module for a couple of years now but every time I try to get a backtrace I run into issues. I remember getting it working once, but I don't remember how.

It seems like using dpm(ddebug_backtrace()); should do the trick. I have tried it with no argument, TRUE, and FALSE, and I have also tried removing the dpm function it's wrapped in.

I have dpm calls directly above and below this code that print variables appropriately, but the most I get out of dpm(ddebug_backtrace()); is a blank line in the Krumo output.

Suggestions mightily appreciated.

  • dpm(ddebug_backtrace()); works fine for me (I just tried it). Does die(ddebug_backtrace()); work for you? – Felix Eve Apr 24 '15 at 1:00
3

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.

  • Thank you very much for the explanation, this actually answers the question. – Darvanen Jul 28 '16 at 0:14
7

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

dpm(debug_backtrace());

  • This worked for me. I'm on D7. – jdhildeb Jan 21 '16 at 17:38
1

In the instances where I've been like, "WTF! Where's my dpm output at?", it's either been:

  1. A permissions issue with an impersonated user not having access devel information perm.
  2. A theme page that isn't outputting the $messages var.

Hope that helps.

  • 2
    Thanks shawn, gets a vote because it's good advice, sadly I've already been through that. As I said, dpm is outputting fine but not when used with ddebug_backtrace(). – Darvanen Apr 24 '15 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.