Showing the list of all the functions called, debug_backtrace() doesn't fits me

Hi,

im trying to debug a symfony app.

I’ve added a debug_backtrace() calling to this function below. It outputs a list of functions called, but the save() function (that is just before the debug_backtrace() calling) is not that list… why? any other way to debug that shows more things, in this case the save() calling ?


protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()));

    if ($form->isValid())
    {

      $sf_guard_user = $form->save();

      var_dump(debug_backtrace());
     die("fsdgsgsdf");

      $this->redirect('guardausuario/edit?id='.$sf_guard_user-
>getId());

    }
  } 

Regards

Javi

Hi again,

i found this bug issue that is asking for maybe what i’m looking for:

http://bugs.php.net/bug.php?id=40827

As you can see the response is:

How is that different from a three-line function operating on the result array of debug_backtrace() ?

but i don’t what it means or how implement it.

Any help?

Javi

I don’t know of an automated way to get an ordered list of called functions(aside from adding a print statement to all functions). debug_backtrace() prints the call stack only.

xdebug can do it
http://xdebug.org/docs/execution_trace

Thanks I’m gonna try execution_trace.

What are the other stacks?

Javi

Hello,

If you’re installing xdebug extension you may want to check this out: xdebug-trace script from here: http://www.gosu.pl/debug/

Screenshot (func calls trace + summary): http://www.gosu.pl/debug/screenshots/test3-trace-c.png

There are also some other functions useful when debugging, see example 3 using the debug() function: http://www.gosu.pl/debug/screenshots/test1-debug.png

I probably should have said it prints the current state of the call stack. While the save() method was executing, it was on the call stack. After the method returned, it got popped off the stack. There’s only 1 call stack. But, I understand what you’re asking for. I just don’t know the proper terminology for it.

Anyway, you might also consider using a php ide with support for an interactive debugger. They can be pretty nice, pausing the execution so you can control when you want it to advance. This lets you look at the current values of variables as they change, and you can navigate in and out of function calls, and a whole lot more. You basically ride the call stack as it executes.

Netbeans can integrate with xdebug and do all that. A lot of other ides have support either through xdebug, or other debugging extensions. It can take a bit of time to set up and learn though.

Thanks for all your advices.

At first, I’ve just got my target using

xdebug_start_trace(‘/tmp/foo’);
$usuario = $form->save();
xdebug_stop_trace();

http://www.xdebug.org/docs/all_functions

Javi