1/*
2 * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26#ifndef JDWP_INVOKER_H
27#define JDWP_INVOKER_H
28
29/* Invoke types */
30
31#define INVOKE_CONSTRUCTOR 1
32#define INVOKE_STATIC      2
33#define INVOKE_INSTANCE    3
34
35typedef struct InvokeRequest {
36    jboolean pending;      /* Is an invoke requested? */
37    jboolean started;      /* Is an invoke happening? */
38    jboolean available;    /* Is the thread in an invokable state? */
39    jboolean detached;     /* Has the requesting debugger detached? */
40    jint id;
41    /* Input */
42    jbyte invokeType;
43    jbyte options;
44    jclass clazz;
45    jmethodID method;
46    jobject instance;    /* for INVOKE_INSTANCE only */
47    jvalue *arguments;
48    jint argumentCount;
49    char *methodSignature;
50    /* Output */
51    jvalue returnValue;  /* if no exception, for all but INVOKE_CONSTRUCTOR */
52    jobject exception;   /* NULL if no exception was thrown */
53} InvokeRequest;
54
55
56void invoker_initialize(void);
57void invoker_reset(void);
58
59void invoker_lock(void);
60void invoker_unlock(void);
61
62void invoker_enableInvokeRequests(jthread thread);
63jvmtiError invoker_requestInvoke(jbyte invokeType, jbyte options, jint id,
64                           jthread thread, jclass clazz, jmethodID method,
65                           jobject instance,
66                           jvalue *arguments, jint argumentCount);
67jboolean invoker_doInvoke(jthread thread);
68
69void invoker_completeInvokeRequest(jthread thread);
70jboolean invoker_isEnabled(jthread thread);
71void invoker_detach(InvokeRequest *request);
72
73#endif
74