Debugging states should be filtered when computing the 'next' state.

Prior to this we would still need to have the same number of states for each
stream, just a filtered-out state would be allowed to differ among each stream.
With this change, filtered states are simply discarded from the streams and we
always compare the first non-skipped points of the streams with each other.

Change-Id: I54668d0a54b4f3c2de3ecc6ef877ebe120637de4
diff --git a/src/test/java/com/android/tools/r8/debug/DebugStreamComparator.java b/src/test/java/com/android/tools/r8/debug/DebugStreamComparator.java
index 59ce62f..eb85a7c 100644
--- a/src/test/java/com/android/tools/r8/debug/DebugStreamComparator.java
+++ b/src/test/java/com/android/tools/r8/debug/DebugStreamComparator.java
@@ -202,7 +202,10 @@
       List<DebuggeeState> states = new ArrayList<>(streamStates.size());
       boolean done = false;
       for (StreamState streamState : streamStates) {
-        DebuggeeState state = streamState.next();
+        DebuggeeState state;
+        do {
+          state = streamState.next();
+        } while (state != null && !filter.test(state));
         states.add(state);
         if (state == null) {
           done = true;
@@ -215,11 +218,9 @@
               states.stream().allMatch(Objects::isNull));
           return;
         } else {
-          if (filter.test(states.get(0))) {
-            verifyStatesEqual(states);
-            if (printOptions.printStates) {
-              System.out.println(prettyPrintState(states.get(0), printOptions));
-            }
+          verifyStatesEqual(states);
+          if (printOptions.printStates) {
+            System.out.println(prettyPrintState(states.get(0), printOptions));
           }
         }
       } catch (AssertionError e) {