Revert "Emit a pc-to-pc line mapping in debug info tables."

This reverts commit 67f07de6f2e1d9d6e8858771097cbe9efc747956.

Reason for revert: test failures (eg, SingleLineInfoInlineRemoveTest)

Change-Id: I0a98c7c3477f88cc6af6050a5645baccec08ab11
diff --git a/src/main/java/com/android/tools/r8/graph/DexCode.java b/src/main/java/com/android/tools/r8/graph/DexCode.java
index 72c6f81..8c16e46 100644
--- a/src/main/java/com/android/tools/r8/graph/DexCode.java
+++ b/src/main/java/com/android/tools/r8/graph/DexCode.java
@@ -27,7 +27,6 @@
 import com.android.tools.r8.ir.conversion.LensCodeRewriterUtils;
 import com.android.tools.r8.naming.ClassNameMapper;
 import com.android.tools.r8.origin.Origin;
-import com.android.tools.r8.utils.ArrayUtils;
 import com.android.tools.r8.utils.StringUtils;
 import com.android.tools.r8.utils.structural.Equatable;
 import com.android.tools.r8.utils.structural.HashCodeVisitor;
@@ -277,7 +276,7 @@
           new DexString[callee.getArity()],
           new DexDebugEvent[] {
             new DexDebugEvent.SetInlineFrame(callee, callerPosition),
-            DexDebugEvent.Default.ZERO_CHANGE_DEFAULT_EVENT
+            DexDebugEvent.ZERO_CHANGE_DEFAULT_EVENT
           });
     }
     DexDebugEvent[] oldEvents = debugInfo.events;
@@ -439,15 +438,13 @@
 
     DexDebugEntry debugInfo = null;
     Iterator<DexDebugEntry> debugInfoIterator = Collections.emptyIterator();
-    boolean isPc2PcMapping = getDebugInfo() != null && getDebugInfo().isPcToPcMapping();
-    if (!isPc2PcMapping && getDebugInfo() != null && method != null) {
+    if (getDebugInfo() != null && method != null) {
       debugInfoIterator = new DexDebugEntryBuilder(method, new DexItemFactory()).build().iterator();
       debugInfo = debugInfoIterator.hasNext() ? debugInfoIterator.next() : null;
     }
     int instructionNumber = 0;
     Map<Integer, DebugLocalInfo> locals = Collections.emptyMap();
     for (Instruction insn : instructions) {
-      debugInfo = advanceToOffset(insn.getOffset() - 1, debugInfo, debugInfoIterator);
       while (debugInfo != null && debugInfo.address == insn.getOffset()) {
         if (debugInfo.lineEntry || !locals.equals(debugInfo.locals)) {
           builder.append("         ").append(debugInfo.toString(false)).append("\n");
@@ -465,16 +462,8 @@
       }
       builder.append('\n');
     }
-    if (isPc2PcMapping) {
-      builder.append("(has pc2pc debug info mapping)\n");
-    } else if (debugInfoIterator.hasNext()) {
-      Instruction lastInstruction = ArrayUtils.last(instructions);
-      debugInfo = advanceToOffset(lastInstruction.getOffset(), debugInfo, debugInfoIterator);
-      if (debugInfo != null) {
-        throw new Unreachable("Could not print all debug information.");
-      } else {
-        builder.append("(has debug events past last pc)\n");
-      }
+    if (debugInfoIterator.hasNext()) {
+      throw new Unreachable("Could not print all debug information.");
     }
     if (tries.length > 0) {
       builder.append("Tries (numbers are offsets)\n");
@@ -494,14 +483,6 @@
     return builder.toString();
   }
 
-  DexDebugEntry advanceToOffset(
-      int offset, DexDebugEntry current, Iterator<DexDebugEntry> iterator) {
-    while (current != null && current.address <= offset) {
-      current = iterator.hasNext() ? iterator.next() : null;
-    }
-    return current;
-  }
-
   public String toSmaliString(ClassNameMapper naming) {
     StringBuilder builder = new StringBuilder();
     // Find labeled targets.
diff --git a/src/main/java/com/android/tools/r8/graph/DexDebugEvent.java b/src/main/java/com/android/tools/r8/graph/DexDebugEvent.java
index b1194bb..bb93147 100644
--- a/src/main/java/com/android/tools/r8/graph/DexDebugEvent.java
+++ b/src/main/java/com/android/tools/r8/graph/DexDebugEvent.java
@@ -27,6 +27,8 @@
 
   public static final DexDebugEvent[] EMPTY_ARRAY = {};
 
+  public static final DexDebugEvent.Default ZERO_CHANGE_DEFAULT_EVENT = Default.create(0, 0);
+
   public void collectIndexedItems(IndexedItemCollection collection, GraphLens graphLens) {
     // Empty by default.
   }
@@ -709,9 +711,6 @@
 
   public static class Default extends DexDebugEvent {
 
-    public static final DexDebugEvent.Default ZERO_CHANGE_DEFAULT_EVENT = Default.create(0, 0);
-    public static final DexDebugEvent.Default ONE_CHANGE_DEFAULT_EVENT = Default.create(1, 1);
-
     final int value;
 
     Default(int value) {
diff --git a/src/main/java/com/android/tools/r8/graph/DexDebugInfo.java b/src/main/java/com/android/tools/r8/graph/DexDebugInfo.java
index 7abeeca..75588f6 100644
--- a/src/main/java/com/android/tools/r8/graph/DexDebugInfo.java
+++ b/src/main/java/com/android/tools/r8/graph/DexDebugInfo.java
@@ -5,7 +5,6 @@
 
 import com.android.tools.r8.dex.IndexedItemCollection;
 import com.android.tools.r8.dex.MixedSectionCollection;
-import com.android.tools.r8.graph.DexDebugEvent.Default;
 import com.android.tools.r8.utils.structural.Equatable;
 import com.android.tools.r8.utils.structural.StructuralItem;
 import com.android.tools.r8.utils.structural.StructuralMapping;
@@ -92,24 +91,4 @@
     builder.append("]\n");
     return builder.toString();
   }
-
-  public boolean isPcToPcMapping() {
-    if (startLine != 0) {
-      return false;
-    }
-    for (DexString parameter : parameters) {
-      if (parameter != null) {
-        return false;
-      }
-    }
-    if (events.length < 1 || !Default.ZERO_CHANGE_DEFAULT_EVENT.equals(events[0])) {
-      return false;
-    }
-    for (int i = 1; i < events.length; i++) {
-      if (!Default.ONE_CHANGE_DEFAULT_EVENT.equals(events[i])) {
-        return false;
-      }
-    }
-    return true;
-  }
 }
diff --git a/src/main/java/com/android/tools/r8/graph/DexDebugInfoForSingleLineMethod.java b/src/main/java/com/android/tools/r8/graph/DexDebugInfoForSingleLineMethod.java
index 9818a86..32d3126 100644
--- a/src/main/java/com/android/tools/r8/graph/DexDebugInfoForSingleLineMethod.java
+++ b/src/main/java/com/android/tools/r8/graph/DexDebugInfoForSingleLineMethod.java
@@ -4,13 +4,10 @@
 
 package com.android.tools.r8.graph;
 
-import com.android.tools.r8.graph.DexDebugEvent.Default;
-
 public class DexDebugInfoForSingleLineMethod extends DexDebugInfo {
 
   private static final DexDebugInfoForSingleLineMethod INSTANCE =
-      new DexDebugInfoForSingleLineMethod(
-          0, DexString.EMPTY_ARRAY, new DexDebugEvent[] {Default.ZERO_CHANGE_DEFAULT_EVENT});
+      new DexDebugInfoForSingleLineMethod(0, DexString.EMPTY_ARRAY, DexDebugEvent.EMPTY_ARRAY);
 
   private DexDebugInfoForSingleLineMethod(
       int startLine, DexString[] parameters, DexDebugEvent[] events) {
diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
index 0a13ce5..1cbbc21 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -1862,21 +1862,8 @@
     return !isDesugaring() || hasMinApi(AndroidApiLevel.N);
   }
 
-  // Debug entries may be dropped only if the source file content allows being omitted from
-  // stack traces, or if the VM will report the source file even with a null valued debug info.
-  public boolean allowDiscardingResidualDebugInfo() {
-    // TODO(b/146565491): We can drop debug info once fixed at a known min-api.
-    return sourceFileProvider != null && sourceFileProvider.allowDiscardingSourceFile();
-  }
-
-  public boolean canUseDexPc2PcAsDebugInformation() {
-    return lineNumberOptimization == LineNumberOptimization.ON;
-  }
-
-  public boolean canUseNativeDexPcInsteadOfDebugInfo() {
-    return canUseDexPc2PcAsDebugInformation()
-        && hasMinApi(AndroidApiLevel.O)
-        && allowDiscardingResidualDebugInfo();
+  public boolean canUseDexPcAsDebugInformation() {
+    return lineNumberOptimization == LineNumberOptimization.ON && hasMinApi(AndroidApiLevel.O);
   }
 
   public boolean isInterfaceMethodDesugaringEnabled() {
diff --git a/src/main/java/com/android/tools/r8/utils/LineNumberOptimizer.java b/src/main/java/com/android/tools/r8/utils/LineNumberOptimizer.java
index 685e202..2e9c933 100644
--- a/src/main/java/com/android/tools/r8/utils/LineNumberOptimizer.java
+++ b/src/main/java/com/android/tools/r8/utils/LineNumberOptimizer.java
@@ -323,94 +323,6 @@
     }
   }
 
-  private interface PcBasedDebugInfo {
-    /** Callback to record a code object with a given max instruction PC and parameter count. */
-    void recordPcMappingFor(DexCode code, int lastInstructionPc, int parameterCount);
-
-    /** Callback to record a code object with only a single "line". */
-    void recordSingleLineFor(DexCode code);
-
-    /**
-     * Install the correct debug info objects.
-     *
-     * <p>Must be called after all recordings have been given to allow computing the debug info
-     * items to be installed.
-     */
-    void updateDebugInfoInCodeObjects();
-  }
-
-  private static class Pc2PcMappingSupport implements PcBasedDebugInfo {
-
-    private final boolean allowDiscardingSourceFile;
-
-    int maxInstructionPc = 0;
-    int maxParameterCount = 0;
-    List<DexCode> codesToUpdate = new ArrayList<>();
-    List<DexCode> singleLineCodes = new ArrayList<>();
-
-    public Pc2PcMappingSupport(boolean allowDiscardingSourceFile) {
-      this.allowDiscardingSourceFile = allowDiscardingSourceFile;
-    }
-
-    @Override
-    public void recordPcMappingFor(DexCode code, int lastInstructionPc, int parameterCount) {
-      codesToUpdate.add(code);
-      maxInstructionPc = Math.max(maxInstructionPc, lastInstructionPc);
-      maxParameterCount = Math.max(maxParameterCount, parameterCount);
-    }
-
-    @Override
-    public void recordSingleLineFor(DexCode code) {
-      singleLineCodes.add(code);
-    }
-
-    @Override
-    public void updateDebugInfoInCodeObjects() {
-      DexDebugInfo debugInfo = buildPc2PcDebugInfo(maxInstructionPc, maxParameterCount);
-      codesToUpdate.forEach(c -> c.setDebugInfo(debugInfo));
-      // After updating to PC mappings, ensure single-line info is correct.
-      if (allowDiscardingSourceFile) {
-        // If the source file content may be omitted it is safe to just null out the info.
-        singleLineCodes.forEach(c -> c.setDebugInfo(null));
-      } else {
-        // Otherwise, we need to keep the debug info to ensure that VMs with PC support won't
-        // omit printing the source file. We reset the singleton single-line debug info item.
-        // This has a small constant size increase equal to size of the single-line debug item,
-        // but avoids linking the smallest items to a large PC table.
-        singleLineCodes.forEach(c -> c.setDebugInfo(DexDebugInfoForSingleLineMethod.getInstance()));
-      }
-    }
-
-    private static DexDebugInfo buildPc2PcDebugInfo(int lastInstructionPc, int parameterCount) {
-      DexDebugEvent[] events = new DexDebugEvent[lastInstructionPc + 1];
-      events[0] = Default.ZERO_CHANGE_DEFAULT_EVENT;
-      for (int i = 1; i < lastInstructionPc + 1; i++) {
-        events[i] = Default.ONE_CHANGE_DEFAULT_EVENT;
-      }
-      return new DexDebugInfo(0, new DexString[parameterCount], events);
-    }
-  }
-
-  private static class NativePcSupport implements PcBasedDebugInfo {
-
-    @Override
-    public void recordPcMappingFor(DexCode code, int lastInstructionPc, int length) {
-      // Strip the info in full as the runtime will emit the PC directly.
-      code.setDebugInfo(null);
-    }
-
-    @Override
-    public void recordSingleLineFor(DexCode code) {
-      // Strip the info at once as it does not conflict with any PC mapping update.
-      code.setDebugInfo(null);
-    }
-
-    @Override
-    public void updateDebugInfoInCodeObjects() {
-      // Already null out the info so nothing to do.
-    }
-  }
-
   public static ClassNameMapper run(
       AppView<?> appView, DexApplication application, AndroidApp inputApp, NamingLens namingLens) {
     // For finding methods in kotlin files based on SourceDebugExtensions, we use a line method map.
@@ -420,11 +332,6 @@
 
     Map<DexMethod, OutlineFixupBuilder> outlinesToFix = new IdentityHashMap<>();
 
-    PcBasedDebugInfo pcBasedDebugInfo =
-        appView.options().canUseNativeDexPcInsteadOfDebugInfo()
-            ? new NativePcSupport()
-            : new Pc2PcMappingSupport(appView.options().allowDiscardingResidualDebugInfo());
-
     // Collect which files contain which classes that need to have their line numbers optimized.
     for (DexProgramClass clazz : application.classes()) {
       boolean isSyntheticClass = appView.getSyntheticItems().isSyntheticClass(clazz);
@@ -455,6 +362,10 @@
         }
       }
 
+      boolean canStripDebugInfo =
+          appView.options().sourceFileProvider != null
+              && appView.options().sourceFileProvider.allowDiscardingSourceFile();
+
       if (isSyntheticClass) {
         onDemandClassNamingBuilder
             .get()
@@ -506,13 +417,13 @@
           List<MappedPosition> mappedPositions;
           Code code = method.getCode();
           boolean canUseDexPc =
-              appView.options().canUseDexPc2PcAsDebugInformation() && methods.size() == 1;
+              canStripDebugInfo
+                  && appView.options().canUseDexPcAsDebugInformation()
+                  && methods.size() == 1;
           if (code != null) {
             if (code.isDexCode() && doesContainPositions(code.asDexCode())) {
               if (canUseDexPc) {
-                mappedPositions =
-                    optimizeDexCodePositionsForPc(
-                        method, appView, kotlinRemapper, pcBasedDebugInfo);
+                mappedPositions = optimizeDexCodePositionsForPc(method, appView, kotlinRemapper);
               } else {
                 mappedPositions =
                     optimizeDexCodePositions(
@@ -547,9 +458,6 @@
               && methodMappingInfo.isEmpty()
               && obfuscatedNameDexString == originalMethod.name
               && originalMethod.holder == originalType) {
-            assert appView.options().lineNumberOptimization == LineNumberOptimization.OFF
-                || !doesContainPositions(method)
-                || appView.isCfByteCodePassThrough(method);
             continue;
           }
 
@@ -680,10 +588,11 @@
             }
             i = j;
           }
-          if (method.getCode().isDexCode()
+          if (canStripDebugInfo
+              && method.getCode().isDexCode()
               && method.getCode().asDexCode().getDebugInfo()
                   == DexDebugInfoForSingleLineMethod.getInstance()) {
-            pcBasedDebugInfo.recordSingleLineFor(method.getCode().asDexCode());
+            method.getCode().asDexCode().setDebugInfo(null);
           }
         } // for each method of the group
       } // for each method group, grouped by name
@@ -692,9 +601,6 @@
     // Fixup all outline positions
     outlinesToFix.values().forEach(OutlineFixupBuilder::fixup);
 
-    // Update all the debug-info objects.
-    pcBasedDebugInfo.updateDebugInfoInCodeObjects();
-
     return classNameMapperBuilder.build();
   }
 
@@ -1054,16 +960,14 @@
   }
 
   private static List<MappedPosition> optimizeDexCodePositionsForPc(
-      DexEncodedMethod method,
-      AppView<?> appView,
-      PositionRemapper positionRemapper,
-      PcBasedDebugInfo debugInfoProvider) {
+      DexEncodedMethod method, AppView<?> appView, PositionRemapper positionRemapper) {
     List<MappedPosition> mappedPositions = new ArrayList<>();
     // Do the actual processing for each method.
     DexCode dexCode = method.getCode().asDexCode();
     DexDebugInfo debugInfo = dexCode.getDebugInfo();
-    BooleanBox singleOriginalLine = new BooleanBox(true);
+
     Pair<Integer, Position> lastPosition = new Pair<>();
+
     DexDebugEventVisitor visitor =
         new DexDebugPositionState(
             debugInfo.startLine,
@@ -1072,12 +976,7 @@
           public void visit(Default defaultEvent) {
             super.visit(defaultEvent);
             assert getCurrentLine() >= 0;
-            Position currentPosition = getPositionFromPositionState(this);
             if (lastPosition.getSecond() != null) {
-              if (singleOriginalLine.isTrue()
-                  && !currentPosition.equals(lastPosition.getSecond())) {
-                singleOriginalLine.set(false);
-              }
               remapAndAddForPc(
                   lastPosition.getFirst(),
                   getCurrentPc(),
@@ -1086,7 +985,7 @@
                   mappedPositions);
             }
             lastPosition.setFirst(getCurrentPc());
-            lastPosition.setSecond(currentPosition);
+            lastPosition.setSecond(getPositionFromPositionState(this));
             resetOutlineInformation();
           }
         };
@@ -1095,26 +994,17 @@
       event.accept(visitor);
     }
 
-    int lastInstructionPc = ArrayUtils.last(dexCode.instructions).getOffset();
     if (lastPosition.getSecond() != null) {
+      int lastPc = dexCode.instructions[dexCode.instructions.length - 1].getOffset();
       remapAndAddForPc(
           lastPosition.getFirst(),
-          lastInstructionPc + 1,
+          lastPc + 1,
           lastPosition.getSecond(),
           positionRemapper,
           mappedPositions);
     }
 
-    // If we only have one original line we can always retrace back uniquely.
-    assert !mappedPositions.isEmpty();
-    if (singleOriginalLine.isTrue()
-        && lastPosition.getSecond() != null
-        && !mappedPositions.get(0).isOutlineCaller()) {
-      dexCode.setDebugInfo(DexDebugInfoForSingleLineMethod.getInstance());
-      debugInfoProvider.recordSingleLineFor(dexCode);
-    } else {
-      debugInfoProvider.recordPcMappingFor(dexCode, lastInstructionPc, debugInfo.parameters.length);
-    }
+    dexCode.setDebugInfo(null);
     return mappedPositions;
   }
 
diff --git a/src/test/java/com/android/tools/r8/debuginfo/CanonicalizeWithInline.java b/src/test/java/com/android/tools/r8/debuginfo/CanonicalizeWithInline.java
index a8eb9cc..48b9fc8 100644
--- a/src/test/java/com/android/tools/r8/debuginfo/CanonicalizeWithInline.java
+++ b/src/test/java/com/android/tools/r8/debuginfo/CanonicalizeWithInline.java
@@ -3,8 +3,6 @@
 // BSD-style license that can be found in the LICENSE file.
 package com.android.tools.r8.debuginfo;
 
-import static org.junit.Assert.assertNull;
-
 import com.android.tools.r8.AssumeMayHaveSideEffects;
 import com.android.tools.r8.NeverInline;
 import com.android.tools.r8.OutputMode;
@@ -15,8 +13,6 @@
 import com.android.tools.r8.dex.Constants;
 import com.android.tools.r8.dex.DexParser;
 import com.android.tools.r8.dex.DexSection;
-import com.android.tools.r8.graph.DexDebugInfo;
-import com.android.tools.r8.graph.DexEncodedMethod;
 import com.android.tools.r8.utils.AndroidApiLevel;
 import java.io.IOException;
 import java.nio.file.Path;
@@ -35,8 +31,10 @@
     return getTestParameters().withNoneRuntime().build();
   }
 
+  private final TestParameters parameters;
+
   public CanonicalizeWithInline(TestParameters parameters) {
-    parameters.assertNoneRuntime();
+    this.parameters = parameters;
   }
 
   private int getNumberOfDebugInfos(Path file) throws IOException {
@@ -60,17 +58,10 @@
             .addProgramClasses(clazzA, clazzB)
             .addKeepRules(
                 "-keepattributes SourceFile,LineNumberTable",
-                "-keep class ** { public void call(int); }")
+                "-keep class ** {\n" + "public void call(int);\n" + "}")
             .enableInliningAnnotations()
             .enableSideEffectAnnotations()
             .compile();
-    result.inspect(
-        inspector -> {
-          DexEncodedMethod method =
-              inspector.clazz(ClassA.class).uniqueMethodWithName("call").getMethod();
-          DexDebugInfo debugInfo = method.getCode().asDexCode().getDebugInfo();
-          assertNull(debugInfo);
-        });
     Path classesPath = temp.getRoot().toPath();
     result.app.write(classesPath, OutputMode.DexIndexed);
     int numberOfDebugInfos =
diff --git a/src/test/java/com/android/tools/r8/debuginfo/DexPcWithDebugInfoForOverloadedMethodsTestRunner.java b/src/test/java/com/android/tools/r8/debuginfo/DexPcWithDebugInfoForOverloadedMethodsTestRunner.java
index b3c1c08..37d2b6e 100644
--- a/src/test/java/com/android/tools/r8/debuginfo/DexPcWithDebugInfoForOverloadedMethodsTestRunner.java
+++ b/src/test/java/com/android/tools/r8/debuginfo/DexPcWithDebugInfoForOverloadedMethodsTestRunner.java
@@ -23,6 +23,7 @@
 import com.android.tools.r8.ToolHelper.DexVm.Version;
 import com.android.tools.r8.references.Reference;
 import com.android.tools.r8.retrace.RetraceFrameResult;
+import com.android.tools.r8.shaking.ProguardKeepAttributes;
 import com.android.tools.r8.utils.AndroidApiLevel;
 import com.android.tools.r8.utils.codeinspector.ClassSubject;
 import com.android.tools.r8.utils.codeinspector.CodeInspector;
@@ -67,6 +68,7 @@
         .addKeepMainRule(MAIN)
         .addKeepMethodRules(MAIN, "void overloaded(...)")
         .addKeepAttributeLineNumberTable()
+        .addKeepAttributes(ProguardKeepAttributes.SOURCE_FILE)
         .setMinApi(parameters.getApiLevel())
         .run(parameters.getRuntime(), MAIN)
         .assertFailureWithErrorThatMatches(containsString(EXPECTED))
diff --git a/src/test/java/com/android/tools/r8/debuginfo/EnsureNoDebugInfoEmittedForPcOnlyTestRunner.java b/src/test/java/com/android/tools/r8/debuginfo/EnsureNoDebugInfoEmittedForPcOnlyTestRunner.java
index a5e76eb..30505ab 100644
--- a/src/test/java/com/android/tools/r8/debuginfo/EnsureNoDebugInfoEmittedForPcOnlyTestRunner.java
+++ b/src/test/java/com/android/tools/r8/debuginfo/EnsureNoDebugInfoEmittedForPcOnlyTestRunner.java
@@ -7,8 +7,8 @@
 import static com.android.tools.r8.naming.retrace.StackTrace.isSameExceptForFileNameAndLineNumber;
 import static com.android.tools.r8.utils.InternalOptions.LineNumberOptimization.ON;
 import static junit.framework.TestCase.assertEquals;
+import static junit.framework.TestCase.assertNull;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
@@ -21,6 +21,7 @@
 import com.android.tools.r8.graph.DexDebugEntryBuilder;
 import com.android.tools.r8.naming.retrace.StackTrace;
 import com.android.tools.r8.naming.retrace.StackTrace.StackTraceLine;
+import com.android.tools.r8.utils.AndroidApiLevel;
 import com.android.tools.r8.utils.codeinspector.ClassSubject;
 import com.android.tools.r8.utils.codeinspector.CodeInspector;
 import com.android.tools.r8.utils.codeinspector.MethodSubject;
@@ -37,6 +38,7 @@
 
   private static final String FILENAME_MAIN = "EnsureNoDebugInfoEmittedForPcOnlyTest.java";
   private static final Class<?> MAIN = EnsureNoDebugInfoEmittedForPcOnlyTest.class;
+  private static final int INLINED_DEX_PC = 32;
 
   private final TestParameters parameters;
 
@@ -49,9 +51,8 @@
     this.parameters = parameters;
   }
 
-  private boolean apiLevelSupportsPcAndSourceFileOutput() {
-    // TODO(b/146565491): Update with API level once fixed.
-    return false;
+  private boolean apiLevelSupportsPcOutput() {
+    return parameters.getApiLevel().isGreaterThanOrEqualTo(AndroidApiLevel.O);
   }
 
   @Test
@@ -76,7 +77,7 @@
         .internalEnableMappingOutput()
         // TODO(b/191038746): Enable LineNumberOptimization for release builds for DEX PC Output.
         .applyIf(
-            apiLevelSupportsPcAndSourceFileOutput(),
+            apiLevelSupportsPcOutput(),
             builder ->
                 builder.addOptionsModification(
                     options -> {
@@ -97,7 +98,7 @@
         .run(parameters.getRuntime(), MAIN)
         .inspectFailure(
             inspector -> {
-              if (apiLevelSupportsPcAndSourceFileOutput()) {
+              if (apiLevelSupportsPcOutput()) {
                 checkNoDebugInfo(inspector, 5);
               } else {
                 checkHasLineNumberInfo(inspector);
@@ -121,7 +122,7 @@
 
   @Test
   public void testNoEmittedDebugInfoR8() throws Exception {
-    assumeTrue(apiLevelSupportsPcAndSourceFileOutput());
+    assumeTrue(apiLevelSupportsPcOutput());
     testForR8(parameters.getBackend())
         .addProgramClasses(MAIN)
         .addKeepMainRule(MAIN)
diff --git a/src/test/java/com/android/tools/r8/debuginfo/SingleLineInfoRemoveTest.java b/src/test/java/com/android/tools/r8/debuginfo/SingleLineInfoRemoveTest.java
index b881f55..652f401 100644
--- a/src/test/java/com/android/tools/r8/debuginfo/SingleLineInfoRemoveTest.java
+++ b/src/test/java/com/android/tools/r8/debuginfo/SingleLineInfoRemoveTest.java
@@ -9,18 +9,14 @@
 import static com.android.tools.r8.utils.codeinspector.Matchers.isPresent;
 import static com.android.tools.r8.utils.codeinspector.Matchers.notIf;
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.Assert.assertEquals;
 
 import com.android.tools.r8.NeverInline;
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestParametersCollection;
 import com.android.tools.r8.TestRuntime.CfRuntime;
 import com.android.tools.r8.naming.retrace.StackTrace;
-import com.android.tools.r8.naming.retrace.StackTrace.StackTraceLine;
-import com.android.tools.r8.utils.BooleanUtils;
 import com.android.tools.r8.utils.codeinspector.ClassSubject;
-import java.util.List;
-import org.hamcrest.CoreMatchers;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -31,17 +27,14 @@
 public class SingleLineInfoRemoveTest extends TestBase {
 
   private final TestParameters parameters;
-  private final boolean customSourceFile;
 
-  @Parameters(name = "{0}, custom-source-file:{1}")
-  public static List<Object[]> data() {
-    return buildParameters(
-        getTestParameters().withAllRuntimesAndApiLevels().build(), BooleanUtils.values());
+  @Parameters(name = "{0}")
+  public static TestParametersCollection data() {
+    return getTestParameters().withAllRuntimesAndApiLevels().build();
   }
 
-  public SingleLineInfoRemoveTest(TestParameters parameters, boolean customSourceFile) {
+  public SingleLineInfoRemoveTest(TestParameters parameters) {
     this.parameters = parameters;
-    this.customSourceFile = customSourceFile;
   }
 
   public StackTrace expectedStackTrace;
@@ -65,27 +58,9 @@
         .addKeepMainRule(Main.class)
         .addKeepAttributeSourceFile()
         .addKeepAttributeLineNumberTable()
-        .applyIf(
-            customSourceFile,
-            b -> b.getBuilder().setSourceFileProvider(env -> "MyCustomSourceFile"))
         .enableInliningAnnotations()
         .run(parameters.getRuntime(), Main.class)
         .assertFailureWithErrorThatThrows(NullPointerException.class)
-        .inspectOriginalStackTrace(
-            stackTrace -> {
-              for (StackTraceLine line : stackTrace.getStackTraceLines()) {
-                if (customSourceFile) {
-                  assertEquals("MyCustomSourceFile", line.fileName);
-                } else if (parameters.isCfRuntime()) {
-                  assertEquals("SourceFile", line.fileName);
-                } else {
-                  assertThat(
-                      line.fileName,
-                      CoreMatchers.anyOf(
-                          CoreMatchers.is("SourceFile"), CoreMatchers.is("Unknown Source")));
-                }
-              }
-            })
         .inspectStackTrace(
             (stackTrace, inspector) -> {
               assertThat(stackTrace, isSame(expectedStackTrace));
@@ -93,14 +68,10 @@
               assertThat(mainSubject, isPresent());
               assertThat(
                   mainSubject.uniqueMethodWithName("shouldRemoveLineNumber"),
-                  notIf(hasLineNumberTable(), canSingleLineDebugInfoBeDiscarded()));
+                  notIf(hasLineNumberTable(), parameters.isDexRuntime()));
             });
   }
 
-  private boolean canSingleLineDebugInfoBeDiscarded() {
-    return parameters.isDexRuntime() && !customSourceFile;
-  }
-
   public static class Main {
 
     @NeverInline
diff --git a/src/test/java/com/android/tools/r8/regress/b150400371/DebuginfoForInlineFrameRegressionTest.java b/src/test/java/com/android/tools/r8/regress/b150400371/DebuginfoForInlineFrameRegressionTest.java
index 5405ecb..cc7900e 100644
--- a/src/test/java/com/android/tools/r8/regress/b150400371/DebuginfoForInlineFrameRegressionTest.java
+++ b/src/test/java/com/android/tools/r8/regress/b150400371/DebuginfoForInlineFrameRegressionTest.java
@@ -4,8 +4,8 @@
 
 package com.android.tools.r8.regress.b150400371;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
 
 import com.android.tools.r8.TestBase;
 import com.android.tools.r8.TestParameters;
@@ -45,9 +45,8 @@
               MethodSubject main =
                   inspector.method(InlineInto.class.getDeclaredMethod("main", String[].class));
               if (parameters.getApiLevel().isLessThan(apiLevelWithPcAsLineNumberSupport())) {
-                // Method has 14 actual lines, the PC mapping table will have about 50.
                 IntSet lines = new IntArraySet(main.getLineNumberTable().getLines());
-                assertTrue(lines.size() > 20);
+                assertEquals(2, lines.size());
               } else {
                 assertNull(main.getLineNumberTable());
               }
diff --git a/tools/run_on_app_dump.py b/tools/run_on_app_dump.py
index 6c25a4d..f71a314 100755
--- a/tools/run_on_app_dump.py
+++ b/tools/run_on_app_dump.py
@@ -945,9 +945,6 @@
   result.add_argument('--shrinker',
                       help='The shrinkers to use (by default, all are run)',
                       action='append')
-  result.add_argument('--temp',
-                      help='A directory to use for temporaries and outputs.',
-                      default=None)
   result.add_argument('--version',
                       default='main',
                       help='The version of R8 to use (e.g., 1.4.51)')
@@ -1090,8 +1087,6 @@
     return 0
 
   with utils.TempDir() as temp_dir:
-    if options.temp:
-      temp_dir = options.temp
     if options.hash:
       # Download r8-<hash>.jar from
       # https://storage.googleapis.com/r8-releases/raw/.