@Override
  void parseAndExecute(String command, HashMap options) {

    String id = (String) options.get("-d");
    String newState = (String) options.get("-s");
    String newLine = (String) options.get("-n");
    String hitValue = (String) options.get("-h");
    String hitCondition = (String) options.get("-o");
    String condEString = (String) options.get("--");

    if (condEString != null) {
      condEString = Base64Helper.decodeString(condEString);
    }

    this.debugger.stackmanager.updateBreakpoint(
        id, newState, newLine, hitValue, hitCondition, condEString);
    String enabled = newState;
    this.debugger.printResponse(
        "<response command=\"breakpoint_update\"\r\n"
            + " transaction_id=\""
            + options.get("-i")
            + "\">\r\n"
            + " id=\""
            + id
            + "\" state=\""
            + enabled
            + "\" "
            + "</response>\r\n"
            + "");
  }
Ejemplo n.º 2
0
  void parseAndExecute(String command, Map<String, String> options) {
    String value = Base64Helper.decodeString(options.get("--"));
    if (value.length() == 0) {
      value = "this";
    }
    StringBuffer valueBuffer = new StringBuffer();
    int depth = 1;
    if (options.containsKey("-d")) {
      depth = Integer.parseInt(options.get("-d"));
    }
    if (m_debugger.m_stackmanager.getStackDepth() == 0 || value == null) {
      // modify by patrick
      m_debugger.printProperty("", "", "", valueBuffer, 0, true);
      // end modify
      m_debugger.printResponse(
          "<response command=\"eval\"\r\n"
              + " transaction_id=\""
              + options.get("-i")
              + "\" depth=\""
              + depth
              + "\" success=\"1\" "
              + ">\r\n"
              + valueBuffer
              + "</response>\r\n"
              + "");
      return;
    }
    DBGPDebugFrame fr = m_debugger.m_stackmanager.getStackFrame(depth);
    Object evaluated = fr.eval(value);
    // Execute js method "props" to get detail info
    // "props" method comes from DSFVjoDef\src\com\ebay\vjo\VjBootstrap_3.js
    boolean needReevaluate = false;

    if ((evaluated instanceof Function)
        || (evaluated instanceof NativeObject)
        || (evaluated instanceof NativeArray)
        || (evaluated instanceof NativeFunction)
        || (evaluated instanceof NativeJavaClass)
        || (evaluated instanceof NativeJavaClass)
        || (evaluated instanceof NativeJavaArray)) {
      needReevaluate = true;
    } else if (evaluated instanceof NativeJavaObject) {
      if (((NativeJavaObject) evaluated).unwrap() instanceof String) {
        evaluated = ((NativeJavaObject) evaluated).getDefaultValue(String.class);
      } else {
        needReevaluate = true;
      }
    }

    if (needReevaluate) {
      if (existDescripUtils(fr)) {
        Object tempEvaluated = fr.eval(DETAIL_EVAL_FUN + "(" + value + ")");
        if (!"".equals(tempEvaluated)) {
          evaluated = tempEvaluated;
        }
      }
    }

    //		String shName = value;
    //		int k = shName.lastIndexOf('.');
    //		if (k != -1) {
    //			shName = shName.substring(k + 1);
    //		}
    // modify by patrick
    m_debugger.printProperty("", "", evaluated, valueBuffer, 0, true);
    // end modify
    m_debugger.printResponse(
        "<response command=\"eval\"\r\n"
            + " transaction_id=\""
            + options.get("-i")
            + "\" depth=\""
            + depth
            + "\" success=\"1\" "
            + ">\r\n"
            + valueBuffer
            + "</response>\r\n"
            + "");
  }