public void annotate(ExceptionWithContext ex) {
    int limit = stackPtr - 1;

    for (int i = 0; i <= limit; i++) {
      String idx = (i == limit) ? "top0" : Hex.u2(limit - i);

      ex.addContext("stack[" + idx + "]: " + stackElementString(stack[i]));
    }
  }
Annotates (adds context to) the given exception with information about this instance.

@param ex {@code non-null;} the exception to annotate
android/android_framework/dex-maker/src/main/java/com/android/dx/cf/code/ExecutionStack.java