Mantis - Quercus
Viewing Issue Advanced Details
1101 minor always 05-12-06 13:39 05-15-06 19:00
koreth  
ferg  
normal  
closed 3.0.19  
fixed  
none    
none 3.0.20  
0001101: Need debug_backtrace()
Quercus doesn't implement debug_backtrace(), which our code uses.
This should be under Quercus -- can't seem to get Mantis to do that reliably when I file a bug.

Notes
(0001124)
koreth   
05-12-06 15:25   
I decided to have a whack at implementing this; here's what I added to ErrorModule.java. This is functional enough for our code but isn't really a complete implementation.

  
  /**
   * Returns the active stack of function calls.
   */
  public static Value debug_backtrace(Env env)
    throws Exception
  {
    Value array = new ArrayValueImpl();
    Expr frame;
    int depth = 0;

    while ((frame = env.peekCall(depth++)) != null)
    {
      ArrayValue thisFunction = new ArrayValueImpl();
      Location location = frame.getLocation();
      String temp;

      if (location != null)
      {
        temp = location.getFunctionName();
        if (temp != null)
          thisFunction.put("function", temp);
        thisFunction.put("line", location.getLineNumber());
        temp = location.getFileName();
        if (temp != null)
          thisFunction.put("file", temp);
        temp = location.getClassName();
        if (temp != null)
          thisFunction.put("class", temp);
        // XXX - no way to populate "type" or "args"
      }
      else
      {
        thisFunction.put("function", "?");
        thisFunction.put("file", frame.getFunctionLocation());
        thisFunction.put("line", "");
      }

      array.put(thisFunction);
    }
    return array;
  }
(0001136)
ferg   
05-15-06 19:00   
php/180i