How do you use drupal's devel krumo ddebug_backtrace()? I've been trying to debug a weird bug on Drupal 7 for awhile. It happens randomly on my site as it's hard to reproduce. I'm able to finally get ddebug_backtrace() to run when the error happens. The error breaks all of my views on the site when it happens and throws the following error: 


  Warning: include(/home/xxx/public_html/.tpl.php): failed to open stream: No such file or directory in theme_render_template() (line 1534 of /home/xxx/public_html/includes/theme.inc).


It's complaining that theme_render_template() can't find a template file as the variable given to the function is just .tpl.php.

I'm able to insert an if statement when this happens within that function as this:

  if($template_file == '.tpl.php') {
    ddebug_backtrace();
    print_r('&lt;pre&gt;xxxx');
    print_r('TEMPLATE FILE: ');
      print_r($template_file);
    print_r('&lt;/pre&gt;');
  }


I'm able to get the debug output in krumo as shown below. I'm not exactly sure what I should be looking for. I just understand that each numbered line represents where that function was called within that order. But what I'm trying to look for is a blank variable of some sort which makes it output .tpl.php to give such an error. 

Judging from the output, the culprit is the Views module, but I'm not sure where. What should I be looking for exactly?
This bug was quite annoying to solve. What I did was:


Isolate the variable that was causing the issue.
Setup a conditional to detect this variable when it happens.
Add drupal's ddebug_backtrace() to the conditional.
Trace back to where the function was being called up.
Find out how that problematic variable is being passed in.
Keep following the backtrace to the point where that variable is assigned and not just passed along to another function. In my case it was in theme() that assigned the blank variable $template_file. 
From there I needed to know when theme() was being called. The original backtrace didn't leave any clues to which module was calling it aside from views, but views gets called all over the place. Now I needed to find the module that was calling views.
In theme() there were a bunch of hook variables that gave the hint of where it was coming from. I dpm() all the $hook and $hooks variables and it showed the error was happening when a "display suite" hook was being called. 
In the end all I needed to do was uncheck this box. I still don't know why it caused the issue randomly... -_-




My debug code to get the output I needed: