Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/back/debugDispatch.c
38765 views
/*1* Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include "util.h"26#include "transport.h"27#include "debugDispatch.h"28#include "VirtualMachineImpl.h"29#include "ReferenceTypeImpl.h"30#include "ClassTypeImpl.h"31#include "InterfaceTypeImpl.h"32#include "ArrayTypeImpl.h"33#include "FieldImpl.h"34#include "MethodImpl.h"35#include "ObjectReferenceImpl.h"36#include "StringReferenceImpl.h"37#include "ThreadReferenceImpl.h"38#include "ThreadGroupReferenceImpl.h"39#include "ClassLoaderReferenceImpl.h"40#include "ClassObjectReferenceImpl.h"41#include "ArrayReferenceImpl.h"42#include "EventRequestImpl.h"43#include "StackFrameImpl.h"4445static void **l1Array;4647void48debugDispatch_initialize(void)49{50/*51* Create the level-one (CommandSet) dispatch table.52* Zero the table so that unknown CommandSets do not53* cause random errors.54*/55l1Array = jvmtiAllocate((JDWP_HIGHEST_COMMAND_SET+1) * sizeof(void *));5657if (l1Array == NULL) {58EXIT_ERROR(AGENT_ERROR_OUT_OF_MEMORY,"command set array");59}6061(void)memset(l1Array, 0, (JDWP_HIGHEST_COMMAND_SET+1) * sizeof(void *));6263/*64* Create the level-two (Command) dispatch tables to the65* corresponding slots in the CommandSet dispatch table..66*/67l1Array[JDWP_COMMAND_SET(VirtualMachine)] = (void *)VirtualMachine_Cmds;68l1Array[JDWP_COMMAND_SET(ReferenceType)] = (void *)ReferenceType_Cmds;69l1Array[JDWP_COMMAND_SET(ClassType)] = (void *)ClassType_Cmds;70l1Array[JDWP_COMMAND_SET(InterfaceType)] = (void *)InterfaceType_Cmds;71l1Array[JDWP_COMMAND_SET(ArrayType)] = (void *)ArrayType_Cmds;7273l1Array[JDWP_COMMAND_SET(Field)] = (void *)Field_Cmds;74l1Array[JDWP_COMMAND_SET(Method)] = (void *)Method_Cmds;75l1Array[JDWP_COMMAND_SET(ObjectReference)] = (void *)ObjectReference_Cmds;76l1Array[JDWP_COMMAND_SET(StringReference)] = (void *)StringReference_Cmds;77l1Array[JDWP_COMMAND_SET(ThreadReference)] = (void *)ThreadReference_Cmds;78l1Array[JDWP_COMMAND_SET(ThreadGroupReference)] = (void *)ThreadGroupReference_Cmds;79l1Array[JDWP_COMMAND_SET(ClassLoaderReference)] = (void *)ClassLoaderReference_Cmds;80l1Array[JDWP_COMMAND_SET(ArrayReference)] = (void *)ArrayReference_Cmds;81l1Array[JDWP_COMMAND_SET(EventRequest)] = (void *)EventRequest_Cmds;82l1Array[JDWP_COMMAND_SET(StackFrame)] = (void *)StackFrame_Cmds;83l1Array[JDWP_COMMAND_SET(ClassObjectReference)] = (void *)ClassObjectReference_Cmds;84}8586void87debugDispatch_reset(void)88{89}9091CommandHandler92debugDispatch_getHandler(int cmdSet, int cmd)93{94void **l2Array;9596if (cmdSet > JDWP_HIGHEST_COMMAND_SET) {97return NULL;98}99100l2Array = (void **)l1Array[cmdSet];101102/*103* If there is no such CommandSet or the Command104* is greater than the nummber of commands (the first105* element) in the CommandSet, indicate this is invalid.106*/107/*LINTED*/108if (l2Array == NULL || cmd > (int)(intptr_t)(void*)l2Array[0]) {109return NULL;110}111112return (CommandHandler)l2Array[cmd];113}114115116