summaryrefslogtreecommitdiff
path: root/dx/tests/096-dex-giant-catch/run
blob: c81d04ca830a85c135a9b3e22a8badfd9fce467d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
#
# Copyright (C) 2008 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.

# Write out a file with a really huge catch range.

awk '
BEGIN {
    fileName = "Zorch.java";
    printf("public class Zorch {\n") > fileName;
    printf("    static public void test() {\n") > fileName;
    printf("        try {\n") > fileName;
    for (i = 0; i <= 1800; i++) {
        d = i + 1000000;
        printf("    Blort.blort(100%dL, 200%dL, 300%dL, 400%dL, 500%dL, " \
            "600%dL, 700%dL, 800%dL);\n",
            d, d + 1, d + 2, d + 3, d + 4, d + 5, d + 6, d + 7) > fileName;
    }
    printf("        } catch (RuntimeException ex) {\n") > fileName;
    printf("            throw ex;\n") > fileName;
    printf("        }\n") > fileName;
    printf("    }\n") > fileName;
    printf("}\n") > fileName;
}'

$JAVAC -d . *.java
dx --debug --dex --no-optimize --positions=none --no-locals \
    --dump-method=Zorch.test Zorch.class | grep 'try\|catch'