Package flash.tools.debugger

Examples of flash.tools.debugger.Session


  {
    int isolateId = cli.getActiveIsolateId();
    cli.waitTilHalted(isolateId);
    try
    {
      Session session = cli.getSession();
      StringBuilder sb = new StringBuilder();
      if (session.getWorkerSession(isolateId).isSuspended())
      {
        sb.append(getLocalizationManager().getLocalizedTextString("stopped")); //$NON-NLS-1$
        sb.append(' ');
        appendBreakInfo(cli, sb, true, isolateId);
      }
View Full Code Here


  }

  // Extended low level break information
  public static void appendBreakInfo(DebugCLI cli, StringBuilder sb, boolean includeFault, int isolateId) throws NotConnectedException
  {
    Session session = cli.getSession();
    FileInfoCache fileInfo = cli.getFileCache();

    int reason = session.suspendReason();
    int offset = ((PlayerSession)session).getSuspendOffset();
    int index = ((PlayerSession)session).getSuspendActionIndex();

    SwfInfo info = null;
    try { info = fileInfo.getSwfs(isolateId)[index]; } catch(ArrayIndexOutOfBoundsException oobe) {}
View Full Code Here

    int isolateId = cli.getActiveIsolateId();
    cli.waitTilHalted(isolateId);
    try
    {
      // an integer followed by a variable name
      Session session = cli.getSession();
      long id = cli.nextLongToken();
      String name = (cli.hasMoreTokens()) ? cli.nextToken() : null;

      StringBuilder sb = new StringBuilder();
      sb.append(name);
View Full Code Here

     boolean functionNamed = false;
    int numLines = 0;
     try
     {
      FileInfoCache fileInfo = cli.getFileCache();
      Session session = cli.getSession();
            int isolateId = cli.getActiveIsolateId();

      if (cli.hasMoreTokens())
       {
        arg1 = cli.nextToken();
View Full Code Here

  }

  private Object callFunction(Context cx, boolean isConstructor, Object function, Object[] args)
      throws PlayerDebugException
  {
    Session session = cx.getSession();

    flash.tools.debugger.Value thisObject = cx.toValue();
    if (thisObject == null)
      thisObject = DValue.forPrimitive(null);

    flash.tools.debugger.Value[] valueArgs = new flash.tools.debugger.Value[args.length];
    for (int i = 0; i < args.length; ++i) {
      /**
       * context.toValue() may return null while PlayerSession::buildCallFunctionMessage
       * expects the Value to be a value that depicts null. For example,
       * xmlVar.childNode[nonexistentornullvar] will run into this case.
       * (Came to notice via bug FB-25660)
       */
      flash.tools.debugger.Value tempValue = cx.toValue(args[i]);
      if ( tempValue == null ) {
        tempValue = DValue.forPrimitive(null);
      }
      valueArgs[i] = tempValue; 
    }     


    String functionName;
    if (function instanceof Variable)
    {
      // Sometimes, the function will show up as a Variable. This happens,
      // for example, if the user wrote "MyClass.myFunction = function() {
      // ... }";
      // String.fromCharCode(), for example, is defined that way.
      functionName = ((Variable) function).getQualifiedName();
    }
    else
    {
      functionName = function.toString();
    }

    if (isConstructor)
    {
      return session.callConstructor(functionName, valueArgs);
    }
    else
    {
      return session.callFunction(thisObject, functionName, valueArgs);
    }
  }
View Full Code Here

    {
      rhs = (DebuggerValue) node.rhs.evaluate(cx, this);
    }

    Context eeContext = eeContext(cx);
    Session session = eeContext.getSession();
    switch (node.op)
    {
    case Tokens.MULT_TOKEN:
    {
      // ECMA 11.5
      double d1 = ECMA.toNumber(session, eeContext.toValue(lhs.debuggerValue));
      double d2 = ECMA.toNumber(session, eeContext.toValue(rhs.debuggerValue));
      return new DebuggerValue(new Double(d1 * d2));
    }
    case Tokens.DIV_TOKEN:
    {
      // ECMA 11.5
      double d1 = ECMA.toNumber(session, eeContext.toValue(lhs.debuggerValue));
      double d2 = ECMA.toNumber(session, eeContext.toValue(rhs.debuggerValue));
      return new DebuggerValue(new Double(d1 / d2));
    }
    case Tokens.MODULUS_TOKEN:
    {
      // ECMA 11.5
      double d1 = ECMA.toNumber(session, eeContext.toValue(lhs.debuggerValue));
      double d2 = ECMA.toNumber(session, eeContext.toValue(rhs.debuggerValue));
      return new DebuggerValue(new Double(d1 % d2));
    }
    case Tokens.PLUS_TOKEN:
    {
      // E4X 11.4.1 and ECMA 11.6.1
      flash.tools.debugger.Value v1 = eeContext.toValue(lhs.debuggerValue);
      flash.tools.debugger.Value v2 = eeContext.toValue(rhs.debuggerValue);

      boolean isXMLConcat = false;
     
      if (v1.getType() == VariableType.OBJECT && v2.getType() == VariableType.OBJECT)
      {
        String type1 = v1.getTypeName();
        String type2 = v2.getTypeName();
        int at;
        at = type1.indexOf('@');
        if (at != -1)
          type1 = type1.substring(0, at);
        at = type2.indexOf('@');
        if (at != -1)
          type2 = type2.substring(0, at);
       
        if (type1.equals("XML") || type1.equals("XMLList")) //$NON-NLS-1$ //$NON-NLS-2$
          if (type2.equals("XML") || type2.equals("XMLList")) //$NON-NLS-1$ //$NON-NLS-2$
            isXMLConcat = true;
      }

      if (isXMLConcat)
      {
        try
        {
          flash.tools.debugger.Value xml1 = session.callFunction(v1, "toXMLString", new flash.tools.debugger.Value[0]); //$NON-NLS-1$
          flash.tools.debugger.Value xml2 = session.callFunction(v2, "toXMLString", new flash.tools.debugger.Value[0]); //$NON-NLS-1$
          String allXML = xml1.getValueAsString() + xml2.getValueAsString();
          flash.tools.debugger.Value allXMLValue = DValue.forPrimitive(allXML);
          flash.tools.debugger.Value retval = session.callConstructor("XMLList", new flash.tools.debugger.Value[] { allXMLValue }); //$NON-NLS-1$
          return new DebuggerValue(retval);
        }
        catch (PlayerDebugException e)
        {
          throw new ExpressionEvaluatorException(e);
        }
      }
      else
      {
        v1 = ECMA.toPrimitive(session, v1, null);
        v2 = ECMA.toPrimitive(session, v2, null);
        if (v1.getType() == VariableType.STRING || v2.getType() == VariableType.STRING)
        {
          return new DebuggerValue(ECMA.toString(session, v1) + ECMA.toString(session, v2));
        }
        else
        {
          return new DebuggerValue(new Double(ECMA.toNumber(session, v1) + ECMA.toNumber(session, v2)));
        }
      }
    }
    case Tokens.MINUS_TOKEN:
    {
      // ECMA 11.6.2
      double d1 = ECMA.toNumber(session, eeContext.toValue(lhs.debuggerValue));
      double d2 = ECMA.toNumber(session, eeContext.toValue(rhs.debuggerValue));
      return new DebuggerValue(new Double(d1 - d2));
    }
    case Tokens.LEFTSHIFT_TOKEN:
    {
      // ECMA 11.7.1
      int n1 = ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue));
      int n2 = (int) (ECMA.toUint32(session, eeContext.toValue(rhs.debuggerValue)) & 0x1F);
      return new DebuggerValue(new Double(n1 << n2));
    }
    case Tokens.RIGHTSHIFT_TOKEN:
    {
      // ECMA 11.7.1
      int n1 = ECMA.toInt32(session, eeContext.toValue(lhs.debuggerValue));
      int n2 = (int) (ECMA.toUint32(session, eeContext.toValue(rhs.debuggerValue)) & 0x1F);
      return new DebuggerValue(new Double(n1 >> n2));
    }
    case Tokens.UNSIGNEDRIGHTSHIFT_TOKEN:
    {
      // ECMA 11.7.1
      long n1 = ECMA.toUint32(session, eeContext.toValue(lhs.debuggerValue));
      long n2 = (ECMA.toUint32(session, eeContext.toValue(rhs.debuggerValue)) & 0x1F);
      return new DebuggerValue(new Double(n1 >>> n2));
    }
    case Tokens.LESSTHAN_TOKEN:
    {
      // ECMA 11.8.1
      flash.tools.debugger.Value lessThan = ECMA.lessThan(session, eeContext.toValue(lhs.debuggerValue), eeContext
          .toValue(rhs.debuggerValue));
      boolean result;
      if (lessThan.getType() == VariableType.UNDEFINED)
      {
        result = false;
      }
      else
      {
        result = ECMA.toBoolean(lessThan);
      }
      return new DebuggerValue(result);
    }
    case Tokens.GREATERTHAN_TOKEN:
    {
      // ECMA 11.8.2
      flash.tools.debugger.Value greaterThan = ECMA.lessThan(session, eeContext.toValue(rhs.debuggerValue), eeContext
          .toValue(lhs.debuggerValue));
      boolean result;
      if (greaterThan.getType() == VariableType.UNDEFINED)
      {
        result = false;
      }
      else
      {
        result = ECMA.toBoolean(greaterThan);
      }
      return new DebuggerValue(result);
    }
    case Tokens.LESSTHANOREQUALS_TOKEN:
    {
      // ECMA 11.8.3
      flash.tools.debugger.Value lessThan = ECMA.lessThan(session, eeContext.toValue(rhs.debuggerValue), eeContext
          .toValue(lhs.debuggerValue));
      boolean result;
      if (lessThan.getType() == VariableType.UNDEFINED)
      {
        result = false;
      }
      else
      {
        result = !ECMA.toBoolean(lessThan);
      }
      return new DebuggerValue(result);
    }
    case Tokens.GREATERTHANOREQUALS_TOKEN:
    {
      // ECMA 11.8.4
      flash.tools.debugger.Value lessThan = ECMA.lessThan(session, eeContext.toValue(lhs.debuggerValue), eeContext
          .toValue(rhs.debuggerValue));
      boolean result;
      if (lessThan.getType() == VariableType.UNDEFINED)
      {
        result = false;
      }
      else
      {
        result = !ECMA.toBoolean(lessThan);
      }
      return new DebuggerValue(result);
    }
    case Tokens.INSTANCEOF_TOKEN:
    {
      try {
        return new DebuggerValue(session.evalInstanceof(eeContext.toValue(lhs.debuggerValue), eeContext.toValue(rhs.debuggerValue)));
      } catch (PlayerDebugException e) {
        throw new ExpressionEvaluatorException(e);
      } catch (PlayerFaultException e) {
        throw new ExpressionEvaluatorException(e);
      }
    }
    case Tokens.IN_TOKEN:
    {
      try {
        return new DebuggerValue(session.evalIn(eeContext.toValue(lhs.debuggerValue), eeContext.toValue(rhs.debuggerValue)));
      } catch (PlayerDebugException e) {
        throw new ExpressionEvaluatorException(e);
      } catch (PlayerFaultException e) {
        throw new ExpressionEvaluatorException(e);
      }
    }
    case Tokens.IS_TOKEN:
    {
      try {
        return new DebuggerValue(session.evalIs(eeContext.toValue(lhs.debuggerValue), eeContext.toValue(rhs.debuggerValue)));
      } catch (PlayerDebugException e) {
        throw new ExpressionEvaluatorException(e);
      } catch (PlayerFaultException e) {
        throw new ExpressionEvaluatorException(e);
      }
    }
    case Tokens.AS_TOKEN:
    {
      try {
        return new DebuggerValue(session.evalAs(eeContext.toValue(lhs.debuggerValue), eeContext.toValue(rhs.debuggerValue)));
      } catch (PlayerDebugException e) {
        throw new ExpressionEvaluatorException(e);
      } catch (PlayerFaultException e) {
        throw new ExpressionEvaluatorException(e);
      }
View Full Code Here

  /**
   * Allow the session to receive property updates
   */
  void setSessionProperty(String s, int value)
  {
    Session sess = getSession();
      if (sess != null)
      sess.setPreference(s, value);
    Bootstrap.sessionManager().setPreference(s, value);
  }
View Full Code Here

  public final static String m_newline = System.getProperty("line.separator"); //$NON-NLS-1$

  public static void doShowStats(DebugCLI cli) throws IllegalStateException
  {
    /* we do some magic casting */
    Session session = cli.getSession();
    StringBuilder sb = new StringBuilder();
    try
    {
      PlayerSession p = (PlayerSession)session;
      DMessageCounter cnt = p.getMessageCounter();
View Full Code Here

   */
  public static void doShowProperties(DebugCLI cli)
  {
    StringBuilder sb = new StringBuilder();

    Session session = cli.getSession();
    for (String key: cli.propertyKeys())
    {
      int value = cli.propertyGet(key);
      sb.append(key);
      sb.append(" = "); //$NON-NLS-1$
View Full Code Here

  public static void doShowBreak(DebugCLI cli) throws NotConnectedException
  {
    cli.waitTilHalted();
    try
    {
      Session session = cli.getSession();
      StringBuilder sb = new StringBuilder();
      if (session.isSuspended())
      {
        sb.append(getLocalizationManager().getLocalizedTextString("stopped")); //$NON-NLS-1$
        sb.append(' ');
        appendBreakInfo(cli, sb, true);
      }
View Full Code Here

TOP

Related Classes of flash.tools.debugger.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.