Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/back/debugDispatch.c
38765 views
1
/*
2
* Copyright (c) 1998, 2008, 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
#include "util.h"
27
#include "transport.h"
28
#include "debugDispatch.h"
29
#include "VirtualMachineImpl.h"
30
#include "ReferenceTypeImpl.h"
31
#include "ClassTypeImpl.h"
32
#include "InterfaceTypeImpl.h"
33
#include "ArrayTypeImpl.h"
34
#include "FieldImpl.h"
35
#include "MethodImpl.h"
36
#include "ObjectReferenceImpl.h"
37
#include "StringReferenceImpl.h"
38
#include "ThreadReferenceImpl.h"
39
#include "ThreadGroupReferenceImpl.h"
40
#include "ClassLoaderReferenceImpl.h"
41
#include "ClassObjectReferenceImpl.h"
42
#include "ArrayReferenceImpl.h"
43
#include "EventRequestImpl.h"
44
#include "StackFrameImpl.h"
45
46
static void **l1Array;
47
48
void
49
debugDispatch_initialize(void)
50
{
51
/*
52
* Create the level-one (CommandSet) dispatch table.
53
* Zero the table so that unknown CommandSets do not
54
* cause random errors.
55
*/
56
l1Array = jvmtiAllocate((JDWP_HIGHEST_COMMAND_SET+1) * sizeof(void *));
57
58
if (l1Array == NULL) {
59
EXIT_ERROR(AGENT_ERROR_OUT_OF_MEMORY,"command set array");
60
}
61
62
(void)memset(l1Array, 0, (JDWP_HIGHEST_COMMAND_SET+1) * sizeof(void *));
63
64
/*
65
* Create the level-two (Command) dispatch tables to the
66
* corresponding slots in the CommandSet dispatch table..
67
*/
68
l1Array[JDWP_COMMAND_SET(VirtualMachine)] = (void *)VirtualMachine_Cmds;
69
l1Array[JDWP_COMMAND_SET(ReferenceType)] = (void *)ReferenceType_Cmds;
70
l1Array[JDWP_COMMAND_SET(ClassType)] = (void *)ClassType_Cmds;
71
l1Array[JDWP_COMMAND_SET(InterfaceType)] = (void *)InterfaceType_Cmds;
72
l1Array[JDWP_COMMAND_SET(ArrayType)] = (void *)ArrayType_Cmds;
73
74
l1Array[JDWP_COMMAND_SET(Field)] = (void *)Field_Cmds;
75
l1Array[JDWP_COMMAND_SET(Method)] = (void *)Method_Cmds;
76
l1Array[JDWP_COMMAND_SET(ObjectReference)] = (void *)ObjectReference_Cmds;
77
l1Array[JDWP_COMMAND_SET(StringReference)] = (void *)StringReference_Cmds;
78
l1Array[JDWP_COMMAND_SET(ThreadReference)] = (void *)ThreadReference_Cmds;
79
l1Array[JDWP_COMMAND_SET(ThreadGroupReference)] = (void *)ThreadGroupReference_Cmds;
80
l1Array[JDWP_COMMAND_SET(ClassLoaderReference)] = (void *)ClassLoaderReference_Cmds;
81
l1Array[JDWP_COMMAND_SET(ArrayReference)] = (void *)ArrayReference_Cmds;
82
l1Array[JDWP_COMMAND_SET(EventRequest)] = (void *)EventRequest_Cmds;
83
l1Array[JDWP_COMMAND_SET(StackFrame)] = (void *)StackFrame_Cmds;
84
l1Array[JDWP_COMMAND_SET(ClassObjectReference)] = (void *)ClassObjectReference_Cmds;
85
}
86
87
void
88
debugDispatch_reset(void)
89
{
90
}
91
92
CommandHandler
93
debugDispatch_getHandler(int cmdSet, int cmd)
94
{
95
void **l2Array;
96
97
if (cmdSet > JDWP_HIGHEST_COMMAND_SET) {
98
return NULL;
99
}
100
101
l2Array = (void **)l1Array[cmdSet];
102
103
/*
104
* If there is no such CommandSet or the Command
105
* is greater than the nummber of commands (the first
106
* element) in the CommandSet, indicate this is invalid.
107
*/
108
/*LINTED*/
109
if (l2Array == NULL || cmd > (int)(intptr_t)(void*)l2Array[0]) {
110
return NULL;
111
}
112
113
return (CommandHandler)l2Array[cmd];
114
}
115
116