jdk/test/com/sun/jdi/JdbMethodExitTest.sh
author iignatyev
Mon, 03 Mar 2014 18:17:00 +0400
changeset 23046 0b0407b1e2a5
parent 21602 85bdffaf5e5d
permissions -rw-r--r--
6946101: ShellScaffold.sh based tests can issue "write error: Broken pipe" messages Reviewed-by: dcubed, sla Contributed-by: Pavel Punegov <pavel.punegov@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
23046
0b0407b1e2a5 6946101: ShellScaffold.sh based tests can issue "write error: Broken pipe" messages
iignatyev
parents: 21602
diff changeset
     4
# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#  @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#  @bug 6202891
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#  @summary TTY: Add support for method exit event return values to jdb
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#  @author Jim Holmlund
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#  @run shell JdbMethodExitTest.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
# These are variables that can be set to control execution
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#pkg=untitled7
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
classname=JdbMethodExitTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
compileOptions=-g
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#java="java_g"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#set -x
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
createJavaFile()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    cat <<EOF > $classname.java.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.net.URLClassLoader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * This tests the jdb trace command
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
class $classname {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    // These are the values that will be returned by the methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    static URL[] urls = new URL[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    public static byte      byteValue = 89;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    public static char      charValue = 'x';
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    public static double    doubleValue = 2.2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    public static float     floatValue = 3.3f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    public static int       intValue = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    public static short     shortValue = 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    public static boolean   booleanValue = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    public static Class       classValue = Object.class;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    public static ClassLoader classLoaderValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
            urls[0] = new URL("hi there");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        } catch (java.net.MalformedURLException ee) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        classLoaderValue = new URLClassLoader(urls);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public static Thread      threadValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    public static ThreadGroup threadGroupValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    public static String      stringValue = "abc";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public static int[]       intArrayValue = new int[] {1, 2, 3};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    public static $classname  objectValue = 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        new $classname();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public String ivar = stringValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    // These are the instance methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public byte i_bytef()            { return byteValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    public char i_charf()            { return charValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public double i_doublef()        { return doubleValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public float i_floatf()          { return floatValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    public int i_intf()              { return intValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public short i_shortf()          { return shortValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public boolean i_booleanf()      { return booleanValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    public String i_stringf()        { return stringValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    public Class i_classf()          { return classValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public ClassLoader i_classLoaderf()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                                     { return classLoaderValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    public Thread i_threadf()        { return threadValue = Thread.currentThread(); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public ThreadGroup i_threadGroupf()  
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                                     { return threadGroupValue = threadValue.getThreadGroup(); }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public int[] i_intArrayf()       { return intArrayValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public Object i_nullObjectf()    { return null; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    public Object i_objectf()        { return objectValue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public void i_voidf()            {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    static void doit($classname xx) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        xx.i_bytef();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        xx.i_charf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        xx.i_doublef();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        xx.i_floatf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        xx.i_intf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        xx.i_shortf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        xx.i_booleanf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        xx.i_stringf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        xx.i_intArrayf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        xx.i_classf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        xx.i_classLoaderf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        xx.i_threadf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        xx.i_threadGroupf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        xx.i_nullObjectf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        xx.i_objectf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        xx.i_voidf();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        // Prove it works for native methods too
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        StrictMath.sin(doubleValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        stringValue.intern();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    public static void bkpt() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
       int i = 0;     //@1 breakpoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    public static String traceMethods() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        return "traceMethods";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    public static String traceMethods1() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        return "traceMethods1";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public static String traceExits() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        return "traceExits";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public static String traceExits1() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        return "traceExits1";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public static String traceExit() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        return "traceExit";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    public static String traceExit1() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        return "traceExit1";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        // The debugger will stop at the start of main,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        // enable method exit events, and then do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        // a resume.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        $classname xx = new $classname();
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   159
        System.out.println("threadid="+Thread.currentThread().getId());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        bkpt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        // test all possible return types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        doit(xx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        bkpt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
       // test trace methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
       traceMethods();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
       // test trace go methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
       traceMethods1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
       bkpt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
       // test trace method exits
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
       traceExits();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
       // test trace method exits
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
       traceExits1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
       bkpt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
       
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
       // test trace method exit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
       traceExit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
       // test trace method exit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
       traceExit1();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
       bkpt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
       
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
EOF
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
# drive jdb by sending cmds to it and examining its output
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
dojdbCmds()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    setBkpts @1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    # test all possible return types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    runToBkpt @1
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   200
    debuggeeMatchRegexp "s/threadid=\(.*\)/\1/g"
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   201
    threadid=$?
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    cmd untrace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    cmd trace methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    cmd trace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    jdbFailIfNotPresent "trace methods in effect"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    cmd trace go methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    cmd trace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    jdbFailIfNotPresent "trace go methods in effect"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    cmd trace method exits
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    cmd trace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    jdbFailIfNotPresent "trace method exits in effect"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    cmd trace go method exits
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    cmd trace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    jdbFailIfNotPresent "trace go method exits in effect"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    cmd trace method exit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    cmd trace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    jdbFailIfNotPresent "trace method exit in effect for JdbMethodExitTest.bkpt"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    cmd trace go method exit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    cmd trace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    jdbFailIfNotPresent "trace go method exit in effect for JdbMethodExitTest.bkpt"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    # trace exit of methods with all the return values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    # (but just check a couple of them)
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   231
    cmd trace go method exits $threadid
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    cmd cont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    jdbFailIfNotPresent "instance of JdbMethodExitTest"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    jdbFailIfNotPresent "return value = 8"
23046
0b0407b1e2a5 6946101: ShellScaffold.sh based tests can issue "write error: Broken pipe" messages
iignatyev
parents: 21602
diff changeset
   235
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    # Get out of bkpt back to the call to traceMethods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    cmd step up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   240
    cmd trace methods $threadid
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    cmd cont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    jdbFailIfNotPresent "Method entered:"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    cmd cont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    jdbFailIfNotPresent "Method exited: return value = \"traceMethods\""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    cmd step up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   248
    cmd trace go methods $threadid
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   249
    cmd cont
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   250
    cmd cont
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    cmd cont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    jdbFailIfNotPresent "Method entered: \"thread=main\", JdbMethodExitTest.traceMethods1"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    jdbFailIfNotPresent 'Method exited: .* JdbMethodExitTest.traceMethods1'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    cmd untrace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    cmd step up
23046
0b0407b1e2a5 6946101: ShellScaffold.sh based tests can issue "write error: Broken pipe" messages
iignatyev
parents: 21602
diff changeset
   256
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   258
    cmd trace method exits $threadid
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    cmd cont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    jdbFailIfNotPresent "Method exited: return value = \"traceExits\""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    cmd untrace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    cmd step up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   265
    cmd trace go method exits $threadid
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    cmd cont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    jdbFailIfNotPresent 'Method exited: .* JdbMethodExitTest.traceExits1'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    cmd untrace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    cmd step up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    cmd step            # step into traceExit()
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   273
    cmd trace method exit $threadid
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    cmd cont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    jdbFailIfNotPresent "Method exited: return value = \"traceExit\""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    cmd untrace
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    cmd step up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    cmd step
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    cmd step           # skip over setting return value in caller :-(
21602
85bdffaf5e5d 8027705: com/sun/jdi/JdbMethodExitTest.sh fails when a background thread is generating events.
sla
parents: 5506
diff changeset
   282
    cmd trace go method exit $threadid
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    cmd cont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    jdbFailIfNotPresent 'Method exited: .*JdbMethodExitTest.traceExit1'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
mysetup()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    if [ -z "$TESTSRC" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        TESTSRC=.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    for ii in . $TESTSRC $TESTSRC/.. ; do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        if [ -r "$ii/ShellScaffold.sh" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            . $ii/ShellScaffold.sh 
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
            break
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
# You could replace this next line with the contents
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
# of ShellScaffold.sh and this script will run just the same.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
mysetup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
runit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
jdbFailIfNotPresent "Breakpoint hit"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
pass