summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrion Hodson <oth@google.com>2017-04-24 14:34:18 +0100
committerOrion Hodson <oth@google.com>2017-04-24 14:42:02 +0100
commit13e8ca9e95fb168c8336816897f65e3c8eb7745b (patch)
treed8f5463637299b7502852ee0fbc77cd2e90c772e
parentaf8b407e56371567b093662d82710e1bcdbfd493 (diff)
downloaddalvik-13e8ca9e95fb168c8336816897f65e3c8eb7745b.tar.gz
Revert "Propagate SourceDebugExtension information"
This reverts commit 2f07b197ff531cf2c20fea6d6cc4d8cc6fe2b3f7. Pending fix for art/tools/run-jdwp-tests.sh --mode=device. Bug: 30109642 Test: dx/tests/run-test 133-source-debug-extension Change-Id: Idb69b1a685cd480e1ab82b85d0954787082e5957
-rw-r--r--dx/src/com/android/dx/cf/attrib/AttSourceDebugExtension.java62
-rw-r--r--dx/src/com/android/dx/cf/direct/StdAttributeFactory.java21
-rw-r--r--dx/src/com/android/dx/dex/cf/AttributeTranslator.java18
-rw-r--r--dx/src/com/android/dx/dex/file/AnnotationUtils.java18
-rw-r--r--dx/tests/133-source-debug-extension/expected.txt4
-rw-r--r--dx/tests/133-source-debug-extension/info.txt7
-rwxr-xr-xdx/tests/133-source-debug-extension/run30
7 files changed, 0 insertions, 160 deletions
diff --git a/dx/src/com/android/dx/cf/attrib/AttSourceDebugExtension.java b/dx/src/com/android/dx/cf/attrib/AttSourceDebugExtension.java
deleted file mode 100644
index 3dd4fecb1..000000000
--- a/dx/src/com/android/dx/cf/attrib/AttSourceDebugExtension.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dx.cf.attrib;
-
-import com.android.dx.rop.cst.CstString;
-
-/**
- * Attribute class for standard {@code SourceDebugExtension} attributes.
- */
-public final class AttSourceDebugExtension extends BaseAttribute {
- /** {@code non-null;} attribute name for attributes of this type */
- public static final String ATTRIBUTE_NAME = "SourceDebugExtension";
-
- /** {@code non-null;} Contents of SMAP */
- private final CstString smapString;
-
- /**
- * Constructs an instance.
- *
- * @param smapString {@code non-null;} the SMAP data from the class file.
- */
- public AttSourceDebugExtension(CstString smapString) {
- super(ATTRIBUTE_NAME);
-
- if (smapString == null) {
- throw new NullPointerException("smapString == null");
- }
-
- this.smapString = smapString;
- }
-
- /** {@inheritDoc} */
- @Override
- public int byteLength() {
- // Add 6 for the standard attribute header: the attribute name
- // index (2 bytes) and the attribute length (4 bytes).
- return 6 + smapString.getUtf8Size();
- }
-
- /**
- * Gets the SMAP data of this instance.
- *
- * @return {@code non-null;} the SMAP data.
- */
- public CstString getSmapString() {
- return smapString;
- }
-}
diff --git a/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java b/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java
index 710ba5763..992809a0a 100644
--- a/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java
+++ b/dx/src/com/android/dx/cf/direct/StdAttributeFactory.java
@@ -31,7 +31,6 @@ import com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations;
import com.android.dx.cf.attrib.AttRuntimeVisibleAnnotations;
import com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations;
import com.android.dx.cf.attrib.AttSignature;
-import com.android.dx.cf.attrib.AttSourceDebugExtension;
import com.android.dx.cf.attrib.AttSourceFile;
import com.android.dx.cf.attrib.AttSynthetic;
import com.android.dx.cf.attrib.InnerClassList;
@@ -104,9 +103,6 @@ public class StdAttributeFactory
if (name == AttSignature.ATTRIBUTE_NAME) {
return signature(cf, offset, length, observer);
}
- if (name == AttSourceDebugExtension.ATTRIBUTE_NAME) {
- return sourceDebugExtension(cf, offset, length, observer);
- }
if (name == AttSourceFile.ATTRIBUTE_NAME) {
return sourceFile(cf, offset, length, observer);
}
@@ -696,23 +692,6 @@ public class StdAttributeFactory
}
/**
- * Parses a {@code SourceDebugExtesion} attribute.
- */
- private Attribute sourceDebugExtension(DirectClassFile cf, int offset, int length,
- ParseObserver observer) {
- ByteArray bytes = cf.getBytes().slice(offset, offset + length);
- CstString smapString = new CstString(bytes);
- Attribute result = new AttSourceDebugExtension(smapString);
-
- if (observer != null) {
- String decoded = smapString.getString();
- observer.parsed(bytes, offset, length, "sourceDebugExtension: " + decoded);
- }
-
- return result;
- }
-
- /**
* Parses a {@code SourceFile} attribute.
*/
private Attribute sourceFile(DirectClassFile cf, int offset, int length,
diff --git a/dx/src/com/android/dx/dex/cf/AttributeTranslator.java b/dx/src/com/android/dx/dex/cf/AttributeTranslator.java
index 31f19c007..90e32c3ab 100644
--- a/dx/src/com/android/dx/dex/cf/AttributeTranslator.java
+++ b/dx/src/com/android/dx/dex/cf/AttributeTranslator.java
@@ -25,7 +25,6 @@ import com.android.dx.cf.attrib.AttRuntimeInvisibleParameterAnnotations;
import com.android.dx.cf.attrib.AttRuntimeVisibleAnnotations;
import com.android.dx.cf.attrib.AttRuntimeVisibleParameterAnnotations;
import com.android.dx.cf.attrib.AttSignature;
-import com.android.dx.cf.attrib.AttSourceDebugExtension;
import com.android.dx.cf.attrib.InnerClassList;
import com.android.dx.cf.direct.DirectClassFile;
import com.android.dx.cf.iface.AttributeList;
@@ -89,16 +88,11 @@ import java.util.ArrayList;
public static Annotations getAnnotations(AttributeList attribs) {
Annotations result = getAnnotations0(attribs);
Annotation signature = getSignature(attribs);
- Annotation sourceDebugExtension = getSourceDebugExtension(attribs);
if (signature != null) {
result = Annotations.combine(result, signature);
}
- if (sourceDebugExtension != null) {
- result = Annotations.combine(result, sourceDebugExtension);
- }
-
return result;
}
@@ -220,18 +214,6 @@ import java.util.ArrayList;
return AnnotationUtils.makeSignature(signature.getSignature());
}
-
- private static Annotation getSourceDebugExtension(AttributeList attribs) {
- AttSourceDebugExtension extension = (AttSourceDebugExtension)
- attribs.findFirst(AttSourceDebugExtension.ATTRIBUTE_NAME);
-
- if (extension == null) {
- return null;
- }
-
- return AnnotationUtils.makeSourceDebugExtension(extension.getSmapString());
- }
-
/**
* Gets the {@code EnclosingMethod} attribute out of a given
* {@link AttributeList}, if any, translating it to an annotation.
diff --git a/dx/src/com/android/dx/dex/file/AnnotationUtils.java b/dx/src/com/android/dx/dex/file/AnnotationUtils.java
index 109583e6f..64415228c 100644
--- a/dx/src/com/android/dx/dex/file/AnnotationUtils.java
+++ b/dx/src/com/android/dx/dex/file/AnnotationUtils.java
@@ -62,10 +62,6 @@ public final class AnnotationUtils {
private static final CstType SIGNATURE_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/Signature;"));
- /** {@code non-null;} type for {@code SourceDebugExtension} annotations */
- private static final CstType SOURCE_DEBUG_EXTENSION_TYPE =
- CstType.intern(Type.intern("Ldalvik/annotation/SourceDebugExtension;"));
-
/** {@code non-null;} type for {@code Throws} annotations */
private static final CstType THROWS_TYPE =
CstType.intern(Type.intern("Ldalvik/annotation/Throws;"));
@@ -224,20 +220,6 @@ public final class AnnotationUtils {
}
/**
- * Constructs a standard {@code SourceDebugExtension} annotation.
- *
- * @param smapString {@code non-null;} the SMAP string associated with
- * @return {@code non-null;} the annotation
- */
- public static Annotation makeSourceDebugExtension(CstString smapString) {
- Annotation result = new Annotation(SOURCE_DEBUG_EXTENSION_TYPE, SYSTEM);
-
- result.put(new NameValuePair(VALUE_STRING, smapString));
- result.setImmutable();
- return result;
- }
-
- /**
* Constructs a standard {@code Throws} annotation.
*
* @param types {@code non-null;} the list of thrown types
diff --git a/dx/tests/133-source-debug-extension/expected.txt b/dx/tests/133-source-debug-extension/expected.txt
deleted file mode 100644
index 04d943c4d..000000000
--- a/dx/tests/133-source-debug-extension/expected.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-1c1
-< SourceDebugExtension
----
-> (Ldalvik/annotation/SourceDebugExtension;
diff --git a/dx/tests/133-source-debug-extension/info.txt b/dx/tests/133-source-debug-extension/info.txt
deleted file mode 100644
index 3bec03c52..000000000
--- a/dx/tests/133-source-debug-extension/info.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-This test checks that SourceDebugExtension information propagates from
-the class file to the DEX file emitted by dx. It extracts SMAP information
-from the class file and DEX file and checks the strings match.
-
-NB dalvik/dexdump does not have support for DEX annotations so the test
-just checks that the SMAP string appears in the DEX file and assumes
-it is packaged within an annotation.
diff --git a/dx/tests/133-source-debug-extension/run b/dx/tests/133-source-debug-extension/run
deleted file mode 100755
index 4c12360e9..000000000
--- a/dx/tests/133-source-debug-extension/run
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Test runs in temporary directory created by test-run.
-
-test_class=HelloKt.class
-test_dex=HelloKt.dex
-
-# Generate DEX file
-dx --dex --output=$test_dex $test_class
-
-# Extract for SMAP string in DEX and class file.
-for i in $test_class $test_dex; do
- strings $i | sed -n -e "/SourceDebugExtension/ p" -e "/SMAP/,/23/ p" > $i.output
-done
-
-diff $test_class.output $test_dex.output