2362N/A * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * JNI interface to the shared memory transport. These JNI methods 0N/A * call the base shared memory support to do the real work. 0N/A * That is, this is the front-ends interface to our shared memory 0N/A * communication code. 0N/A * Cached architecture 0N/A * Returns 1 if big endian architecture 0N/A unsigned int i =
0xff000000;
0N/A if (((
char *)(&i))[0] != 0) {
0N/A * Convert to big endian 0N/A b[0] = (i >>
24) &
0xff;
0N/A b[
1] = (i >>
16) &
0xff;
0N/A b[
2] = (i >>
8) &
0xff;
0N/A * It doesn't matter that jint is signed as we are or'ing 0N/A * and hence end up with the correct bits. 0N/A return (b[
3] <<
24) | (b[
2] <<
16) | (b[
1] <<
8) | b[0];
0N/A * Convert unsigned short to big endian 0N/A b[0] = (s >>
8) &
0xff;
0N/A return (b[
1] <<
8) + b[0];
0N/A * Create a byte[] from a packet struct. All data in the byte array 0N/A * is JDWP packet suitable for wire transmission. That is, all fields, 0N/A * and data are in big-endian format as required by the JDWP 0N/A /* total packet length is header + data */ 0N/A /* First 4 bytes of packet are the length (in big endian format) */ 0N/A /* Next 4 bytes are the id field */ 0N/A /* next byte is the flags */ 0N/A /* next two bytes are either the error code or the command set/command */ 0N/A /* finally the data */ 0N/A * Fill a packet struct from a byte array. The byte array is a 0N/A * JDWP packet suitable for wire transmission. That is, all fields, 0N/A * and data are in big-endian format as required by the JDWP 0N/A * specification. We thus need to convert the fields from big 0N/A * endian to the platform endian. 0N/A * The jbyteArray provided to this function is assumed to 0N/A * of a length than is equal or greater than the length of 0N/A * the JDWP packet that is contains. 0N/A unsigned char pktHeader[
11];
/* sizeof length + id + flags + cmdSet + cmd */ 0N/A * Get the packet header 0N/A * The id field is in big endian (also errorCode field in the case 0N/A * of reply packets). 0N/A /* command packet */ 0N/A * The length of the JDWP packet is 11 + data 0N/A "Unable to allocate command data buffer");
0N/A * Class: com_sun_tools_jdi_SharedMemoryConnection 0N/A * Class: com_sun_tools_jdi_SharedMemoryConnection 0N/A * Method: receiveByte0 0N/A * Class: com_sun_tools_jdi_SharedMemoryConnection 0N/A * Method: receivePacket0 0N/A /* Free the packet even if there was an exception above */ 0N/A * Class: com_sun_tools_jdi_SharedMemoryConnection 0N/A * Class: com_sun_tools_jdi_SharedMemoryConnection 0N/A * Method: sendPacket0