test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001.java
author iignatyev
Wed, 30 May 2018 20:54:45 -0700
changeset 50317 cf71bff5f533
permissions -rw-r--r--
8199371: [TESTBUG] Open source vm testbase JDWP tests Reviewed-by: sspitsyn, mseledtsov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50317
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     1
/*
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     2
 * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     4
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     8
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    14
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    18
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    21
 * questions.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    22
 */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    23
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    24
package nsk.jdwp.Method.VariableTable;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    25
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    26
import java.io.*;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    27
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    28
import nsk.share.*;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    29
import nsk.share.jpda.*;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    30
import nsk.share.jdwp.*;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    31
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    32
/**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    33
 * Test for JDWP command: Method.VariableTable.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    34
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    35
 * See vartable001.README for description of test execution.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    36
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    37
 * This class represents debugger part of the test.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    38
 * Test is executed by invoking method runIt().
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    39
 * JDWP command is tested in the method testCommand().
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    40
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    41
 * @see #runIt()
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    42
 * @see #testCommand()
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    43
 */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    44
public class vartable001 {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    45
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    46
    // exit status constants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    47
    static final int JCK_STATUS_BASE = 95;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    48
    static final int PASSED = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    49
    static final int FAILED = 2;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    50
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    51
    // communication signals constants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    52
    static final String READY = "ready";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    53
    static final String QUIT = "quit";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    54
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    55
    // package and classes names constants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    56
    static final String PACKAGE_NAME = "nsk.jdwp.Method.VariableTable";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    57
    static final String TEST_CLASS_NAME = PACKAGE_NAME + "." + "vartable001";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    58
    static final String DEBUGEE_CLASS_NAME = TEST_CLASS_NAME + "a";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    59
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    60
    // tested JDWP command constants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    61
    static final String JDWP_COMMAND_NAME = "Method.VariableTable";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    62
    static final int JDWP_COMMAND_ID = JDWP.Command.Method.VariableTable;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    63
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    64
    // tested class name and signature constants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    65
    static final String TESTED_CLASS_NAME = DEBUGEE_CLASS_NAME + "$" + "TestedClass";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    66
    static final String TESTED_CLASS_SIGNATURE = "L" + TESTED_CLASS_NAME.replace('.', '/') + ";";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    67
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    68
    // tested types signature conatants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    69
    static final String OBJECT_CLASS_SIGNATURE = "Ljava/lang/Object;";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    70
    static final String STRING_CLASS_SIGNATURE = "Ljava/lang/String;";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    71
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    72
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    73
    // tested method name constant
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    74
    static final String TESTED_METHOD_NAME = "testedMethod";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    75
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    76
    // list of tested variables names and signatures
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    77
    static final String variablesList[][] = {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    78
                // synthetic method arguments
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    79
                {"this",            TESTED_CLASS_SIGNATURE},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    80
                // method arguments
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    81
                {"booleanArgument", "Z"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    82
                {"byteArgument",    "B"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    83
                {"charArgument",    "C"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    84
                {"shortArgument",   "S"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    85
                {"intArgument",     "I"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    86
                {"longArgument",    "J"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    87
                {"floatArgument",   "F"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    88
                {"doubleArgument",  "D"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    89
                {"objectArgument",  OBJECT_CLASS_SIGNATURE},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    90
                {"stringArgument",  STRING_CLASS_SIGNATURE},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    91
                // local variables
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    92
                {"booleanLocal",    "Z"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    93
                {"byteLocal",       "B"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    94
                {"charLocal",       "C"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    95
                {"shortLocal",      "S"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    96
                {"intLocal",        "I"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    97
                {"longLocal",       "J"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    98
                {"floatLocal",      "F"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    99
                {"doubleLocal",     "D"},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   100
                {"objectLocal",     OBJECT_CLASS_SIGNATURE},
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   101
                {"stringLocal",     STRING_CLASS_SIGNATURE}
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   102
    };
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   103
    static final int variablesCount = variablesList.length;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   104
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   105
    // usual scaffold objects
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   106
    ArgumentHandler argumentHandler = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   107
    Log log = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   108
    Binder binder = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   109
    Debugee debugee = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   110
    Transport transport = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   111
    IOPipe pipe = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   112
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   113
    // test passed or not
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   114
    boolean success = true;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   115
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   116
    // -------------------------------------------------------------------
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   117
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   118
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   119
     * Start test from command line.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   120
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   121
    public static void main (String argv[]) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   122
        System.exit(run(argv,System.out) + JCK_STATUS_BASE);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   123
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   124
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   125
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   126
     * Start JCK-compilant test.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   127
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   128
    public static int run(String argv[], PrintStream out) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   129
        return new vartable001().runIt(argv, out);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   130
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   131
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   132
    // -------------------------------------------------------------------
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   133
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   134
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   135
     * Perform test execution.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   136
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   137
    public int runIt(String argv[], PrintStream out) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   138
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   139
        // make log for debugger messages
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   140
        argumentHandler = new ArgumentHandler(argv);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   141
        log = new Log(out, argumentHandler);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   142
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   143
        // execute test and display results
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   144
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   145
            log.display("\n>>> Preparing debugee for testing \n");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   146
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   147
            // launch debuggee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   148
            binder = new Binder(argumentHandler, log);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   149
            log.display("Launching debugee");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   150
            debugee = binder.bindToDebugee(DEBUGEE_CLASS_NAME);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   151
            transport = debugee.getTransport();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   152
            pipe = debugee.createIOPipe();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   153
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   154
            // make debuggee ready for testing
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   155
            prepareDebugee();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   156
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   157
            // work with prepared debuggee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   158
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   159
                log.display("\n>>> Obtaining requred data from debugee \n");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   160
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   161
                // query debuggee for classID of tested class
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   162
                log.display("Getting classID by signature:\n"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   163
                            + "  " + TESTED_CLASS_SIGNATURE);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   164
                long classID = debugee.getReferenceTypeID(TESTED_CLASS_SIGNATURE);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   165
                log.display("  got classID: " + classID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   166
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   167
                // query debuggee for methodID of tested method (declared in the class)
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   168
                log.display("Getting methodID by name: " + TESTED_METHOD_NAME);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   169
                long methodID = debugee.getMethodID(classID, TESTED_METHOD_NAME, true);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   170
                log.display("  got methodID: " + methodID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   171
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   172
                // perform testing JDWP command
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   173
                log.display("\n>>> Testing JDWP command \n");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   174
                testCommand(classID, methodID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   175
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   176
            } finally {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   177
                // quit debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   178
                log.display("\n>>> Finishing test \n");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   179
                quitDebugee();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   180
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   181
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   182
        } catch (Failure e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   183
            log.complain("TEST FAILED: " + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   184
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   185
        } catch (Exception e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   186
            e.printStackTrace(out);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   187
            log.complain("Caught unexpected exception while running the test:\n\t" + e);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   188
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   189
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   190
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   191
        if (!success) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   192
            log.complain("TEST FAILED");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   193
            return FAILED;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   194
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   195
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   196
        out.println("TEST PASSED");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   197
        return PASSED;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   198
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   199
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   200
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   201
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   202
     * Prepare debugee for testing and waiting for ready signal.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   203
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   204
    void prepareDebugee() {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   205
        // wait for VM_INIT event from debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   206
        log.display("Waiting for VM_INIT event");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   207
        debugee.waitForVMInit();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   208
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   209
        // query debugee for VM-dependent ID sizes
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   210
        log.display("Querying for IDSizes");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   211
        debugee.queryForIDSizes();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   212
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   213
        // resume initially suspended debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   214
        log.display("Resuming debugee VM");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   215
        debugee.resume();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   216
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   217
        // wait for READY signal from debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   218
        log.display("Waiting for signal from debugee: " + READY);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   219
        String signal = pipe.readln();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   220
        log.display("Received signal from debugee: " + signal);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   221
        if (! signal.equals(READY)) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   222
            throw new TestBug("Unexpected signal received from debugee: " + signal
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   223
                            + " (expected: " + READY + ")");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   224
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   225
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   226
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   227
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   228
     * Sending debugee signal to quit and waiting for it exits.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   229
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   230
    void quitDebugee() {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   231
        // send debugee signal to quit
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   232
        log.display("Sending signal to debugee: " + QUIT);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   233
        pipe.println(QUIT);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   234
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   235
        // wait for debugee exits
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   236
        log.display("Waiting for debugee exits");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   237
        int code = debugee.waitFor();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   238
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   239
        // analize debugee exit status code
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   240
        if (code == JCK_STATUS_BASE + PASSED) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   241
            log.display("Debugee PASSED with exit code: " + code);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   242
        } else {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   243
            log.complain("Debugee FAILED with exit code: " + code);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   244
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   245
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   246
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   247
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   248
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   249
     * Perform testing JDWP command for specified TypeID.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   250
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   251
    void testCommand(long classID, long methodID) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   252
        // create command packet and fill requred out data
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   253
        log.display("Create command packet:");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   254
        log.display("Command: " + JDWP_COMMAND_NAME);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   255
        CommandPacket command = new CommandPacket(JDWP_COMMAND_ID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   256
        log.display("  referenceTypeID: " + classID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   257
        command.addReferenceTypeID(classID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   258
        log.display("  methodID: " + methodID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   259
        command.addMethodID(methodID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   260
        command.setLength();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   261
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   262
        // send command packet to debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   263
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   264
            log.display("Sending command packet:\n" + command);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   265
            transport.write(command);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   266
        } catch (IOException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   267
            log.complain("Unable to send command packet:\n\t" + e);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   268
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   269
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   270
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   271
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   272
        ReplyPacket reply = new ReplyPacket();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   273
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   274
        // receive reply packet from debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   275
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   276
            log.display("Waiting for reply packet");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   277
            transport.read(reply);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   278
            log.display("Reply packet received:\n" + reply);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   279
        } catch (IOException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   280
            log.complain("Unable to read reply packet:\n\t" + e);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   281
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   282
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   283
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   284
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   285
        // check reply packet header
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   286
        try{
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   287
            log.display("Checking reply packet header");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   288
            reply.checkHeader(command.getPacketID());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   289
        } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   290
            log.complain("Bad header of reply packet:\n\t" + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   291
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   292
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   293
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   294
        // start parsing reply packet data
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   295
        log.display("Parsing reply packet:");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   296
        reply.resetPosition();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   297
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   298
        // clear list of found variables
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   299
        int[] foundVariablesList = new int[variablesCount];
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   300
        for (int i = 0; i < variablesCount; i++) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   301
            foundVariablesList[i] = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   302
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   303
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   304
        // extract and check reply data
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   305
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   306
        // extract number of argumnets
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   307
        int argCount = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   308
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   309
            argCount = reply.getInt();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   310
            log.display("  argCount: " + argCount);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   311
        } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   312
            log.complain("Unable to extract number of arguments from reply packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   313
                        + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   314
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   315
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   316
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   317
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   318
        // check that number of arguments is not negative
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   319
        if (argCount < 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   320
            log.complain("Negative of arguments in reply packet: " + argCount);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   321
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   322
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   323
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   324
        // extract number of slots
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   325
        int slots = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   326
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   327
            slots = reply.getInt();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   328
            log.display("  slots: " + slots);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   329
        } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   330
            log.complain("Unable to extract number of slots from reply packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   331
                        + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   332
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   333
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   334
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   335
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   336
        // check that number of slots is not negative
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   337
        if (slots < 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   338
            log.complain("Negative value of end code index in reply packet: " + slots);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   339
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   340
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   341
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   342
        // check that start code is not less than expected
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   343
        if (slots < variablesCount) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   344
            log.complain("Number of slots (" + slots
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   345
                        + ") is less than expected (" + variablesCount + ")");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   346
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   347
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   348
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   349
        // extract and check each slot attributes
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   350
        for (int i = 0; i < slots; i++) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   351
            log.display("  slot #" + i + ":");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   352
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   353
            // extract code index of a slot
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   354
            long codeIndex = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   355
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   356
                codeIndex = reply.getLong();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   357
                log.display("    codeIndex: " + codeIndex);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   358
            } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   359
                log.complain("Unable to extract code index of slot #" + i
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   360
                            + " from reply packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   361
                            + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   362
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   363
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   364
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   365
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   366
            // check that code index is not negative
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   367
            if (codeIndex < 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   368
                log.complain("Negative code index of slot #" + i + ":" + codeIndex);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   369
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   370
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   371
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   372
            // extract name of a slot
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   373
            String name = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   374
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   375
                name = reply.getString();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   376
                log.display("    name: " + name);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   377
            } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   378
                log.complain("Unable to extract name of slot #" + i
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   379
                            + " from reply packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   380
                            + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   381
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   382
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   383
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   384
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   385
            // extract signature of a slot
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   386
            String signature = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   387
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   388
                signature = reply.getString();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   389
                log.display("    signature: " + signature);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   390
            } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   391
                log.complain("Unable to extract signature of slot #" + i
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   392
                            + " from reply packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   393
                            + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   394
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   395
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   396
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   397
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   398
            // extract code length
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   399
            int length = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   400
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   401
                length = reply.getInt();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   402
                log.display("    length: " + length);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   403
            } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   404
                log.complain("Unable to extract code length for slot #" + i
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   405
                            + " from reply packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   406
                            + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   407
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   408
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   409
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   410
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   411
            // extract code length
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   412
            int slot = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   413
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   414
                slot = reply.getInt();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   415
                log.display("    slot: " + length);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   416
            } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   417
                log.complain("Unable to extract slot index of slot #" + i
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   418
                            + " from reply packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   419
                            + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   420
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   421
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   422
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   423
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   424
            // find slot name into list of expected variables
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   425
            int found = -1;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   426
            for (int j = 0; j < variablesCount; j++) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   427
                if (variablesList[j][0].equals(name)) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   428
                    found = j;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   429
                    break;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   430
                }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   431
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   432
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   433
            // check if slot is found and not duplicated
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   434
            if (found >= 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   435
                if (foundVariablesList[found] > 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   436
                    log.complain("Slot #" + i + " is duplicated "
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   437
                                + foundVariablesList[found] + " times: "
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   438
                                + name);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   439
                    success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   440
/*
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   441
                } else {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   442
                    log.display("Found expected variable #" + found + ": "
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   443
                                + variablesList[found][0]);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   444
*/
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   445
                }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   446
                foundVariablesList[found]++;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   447
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   448
                // check slot signature
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   449
                if (!variablesList[found][1].equals(signature)) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   450
                    log.complain("Unexpected signature for slot #" + i + ": " + signature
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   451
                                + " (expected: " + variablesList[found][1] + ")");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   452
                    success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   453
                }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   454
            } else {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   455
                log.display("Unexpected slot #" + i + " (may be synthetic): " + name);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   456
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   457
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   458
            // check that code length is not negative
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   459
            if (length < 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   460
                log.complain("Code length for slot #" + i + " is negative: " + length);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   461
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   462
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   463
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   464
            // check that slot index is not negative
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   465
            if (slot < 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   466
                log.complain("Index of slot #" + i + " is negative: " + slot);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   467
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   468
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   469
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   470
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   471
        // check for extra data in reply packet
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   472
        if (!reply.isParsed()) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   473
            log.complain("Extra trailing bytes found in reply packet at: "
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   474
                        + reply.offsetString());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   475
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   476
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   477
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   478
        // check that all expected variables found
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   479
        for (int i = 0; i < variablesCount; i++) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   480
            if (foundVariablesList[i] <= 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   481
                log.complain("No slot found in reply packet for variable: "
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   482
                            + variablesList[i][0]);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   483
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   484
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   485
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   486
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   487
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   488
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   489
}