/// <summary> /// Sends an HPDS request to the client. /// /// We will get an HPDS response when the heap dump has completed. On /// failure we get a generic failure response. /// /// This is more expensive for the device than HPDU, because the entire /// heap dump is held in RAM instead of spooled out to a temp file. On /// the other hand, permission to write to /sdcard is not required. /// </summary> /// <param name="fileName"> name of output file (on device) </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendHPDS(Client client) throws java.io.IOException public static void sendHPDS(Client client) { ByteBuffer rawBuf = allocBuffer(0); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); finishChunkPacket(packet, CHUNK_HPDS, buf.position); Log.d("ddm-heap", "Sending " + name(CHUNK_HPDS)); client.sendAndConsume(packet, mInst); }
/// <summary> /// Sends a REAE (REcent Allocation Enable) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendREAE(Client client, boolean enable) throws java.io.IOException public static void sendREAE(Client client, bool enable) { ByteBuffer rawBuf = allocBuffer(1); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.put((byte)(enable ? 1 : 0)); finishChunkPacket(packet, CHUNK_REAE, buf.position); Log.d("ddm-heap", "Sending " + name(CHUNK_REAE) + ": " + enable); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a MPRQ (Method PRofiling Query) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendMPRQ(Client client) throws java.io.IOException public static void sendMPRQ(Client client) { ByteBuffer rawBuf = allocBuffer(0); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); // no data finishChunkPacket(packet, CHUNK_MPRQ, buf.position); Log.d("ddm-prof", "Sending " + name(CHUNK_MPRQ)); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send an EXIT request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendEXIT(Client client, int status) throws java.io.IOException public static void sendEXIT(Client client, int status) { ByteBuffer rawBuf = allocBuffer(4); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(status); finishChunkPacket(packet, CHUNK_EXIT, buf.position); Log.d("ddm-exit", "Sending " + name(CHUNK_EXIT) + ": " + status); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a HELO request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendHELO(Client client, int serverProtocolVersion) throws java.io.IOException public static void sendHELO(Client client, int serverProtocolVersion) { ByteBuffer rawBuf = allocBuffer(4); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(serverProtocolVersion); finishChunkPacket(packet, CHUNK_HELO, buf.position); Log.d("ddm-hello", "Sending " + name(CHUNK_HELO) + " ID=0x" + packet.id.toHexString()); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send an EXIT request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendEXIT(Client client, int status) throws java.io.IOException public static void sendEXIT(Client client, int status) { ByteBuffer rawBuf = allocBuffer(4); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(status); finishChunkPacket(packet, CHUNK_EXIT, buf.position); Log.d("ddm-exit", "Sending " + name(CHUNK_EXIT) + ": " + status); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send an HPIF (HeaP InFo) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendHPIF(Client client, int when) throws java.io.IOException public static void sendHPIF(Client client, int when) { ByteBuffer rawBuf = allocBuffer(1); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.put((byte)when); finishChunkPacket(packet, CHUNK_HPIF, buf.position); Log.d("ddm-heap", "Sending " + name(CHUNK_HPIF) + ": when=" + when); client.sendAndConsume(packet, mInst); }
/* * Send a THST request to the specified client. */ //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private static void sendTHST(Client client) throws java.io.IOException private static void sendTHST(Client client) { ByteBuffer rawBuf = allocBuffer(0); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); // nothing much to say finishChunkPacket(packet, CHUNK_THST, buf.position); Log.d("ddm-thread", "Sending " + name(CHUNK_THST)); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send an NHGT (Native Thread GeT) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendNHGT(Client client) throws java.io.IOException public static void sendNHGT(Client client) { ByteBuffer rawBuf = allocBuffer(0); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); // no data in request message finishChunkPacket(packet, CHUNK_NHGT, buf.position); Log.d("ddm-nativeheap", "Sending " + name(CHUNK_NHGT)); client.sendAndConsume(packet, mInst); rawBuf = allocBuffer(2); packet = new JdwpPacket(rawBuf); buf = getChunkDataBuf(rawBuf); buf.put(HandleHeap.WHEN_DISABLE); buf.put(HandleHeap.WHAT_OBJ); finishChunkPacket(packet, CHUNK_NHSG, buf.position); Log.d("ddm-nativeheap", "Sending " + name(CHUNK_NHSG)); client.sendAndConsume(packet, mInst); }
/// <summary> /// Sends an HPDU request to the client. /// /// We will get an HPDU response when the heap dump has completed. On /// failure we get a generic failure response. /// </summary> /// <param name="fileName"> name of output file (on device) </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendHPDU(Client client, String fileName) throws java.io.IOException public static void sendHPDU(Client client, string fileName) { ByteBuffer rawBuf = allocBuffer(4 + fileName.Length * 2); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(fileName.Length); putString(buf, fileName); finishChunkPacket(packet, CHUNK_HPDU, buf.position); Log.d("ddm-heap", "Sending " + name(CHUNK_HPDU) + " '" + fileName + "'"); client.sendAndConsume(packet, mInst); client.clientData.pendingHprofDump = fileName; }
/// <summary> /// Send a MPSS (Method Profiling Streaming Start) request to the client. /// /// The arguments to this method will eventually be passed to /// android.os.Debug.startMethodTracing() on the device. /// </summary> /// <param name="bufferSize"> is the desired buffer size in bytes (8MB is good) </param> /// <param name="flags"> see startMethodTracing() docs; use 0 for default behavior </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendMPSS(Client client, int bufferSize, int flags) throws java.io.IOException public static void sendMPSS(Client client, int bufferSize, int flags) { ByteBuffer rawBuf = allocBuffer(2 * 4); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(bufferSize); buf.putInt(flags); finishChunkPacket(packet, CHUNK_MPSS, buf.position); Log.d("ddm-prof", "Sending " + name(CHUNK_MPSS) + "', size=" + bufferSize + ", flags=" + flags); client.sendAndConsume(packet, mInst); // send a status query. this ensure that the status is properly updated if for some // reason starting the tracing failed. sendMPRQ(client); }
/// <summary> /// Send a THEN (THread notification ENable) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendTHEN(Client client, boolean enable) throws java.io.IOException public static void sendTHEN(Client client, bool enable) { ByteBuffer rawBuf = allocBuffer(1); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); if (enable) { buf.put(1); } else { buf.put(0); } finishChunkPacket(packet, CHUNK_THEN, buf.position); Log.d("ddm-thread", "Sending " + name(CHUNK_THEN) + ": " + enable); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a STKL (STacK List) request to the client. The VM will suspend /// the target thread, obtain its stack, and return it. If the thread /// is no longer running, a failure result will be returned. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendSTKL(Client client, int threadId) throws java.io.IOException public static void sendSTKL(Client client, int threadId) { /* * if (false) * { * Log.d("ddm-thread", "would send STKL " + threadId); * return; * } */ ByteBuffer rawBuf = allocBuffer(4); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(threadId); finishChunkPacket(packet, CHUNK_STKL, buf.position); Log.d("ddm-thread", "Sending " + name(CHUNK_STKL) + ": " + threadId); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a MPRS (Method PRofiling Start) request to the client. /// /// The arguments to this method will eventually be passed to /// android.os.Debug.startMethodTracing() on the device. /// </summary> /// <param name="fileName"> is the name of the file to which profiling data /// will be written (on the device); it will have <seealso cref="DdmConstants#DOT_TRACE"/> /// appended if necessary </param> /// <param name="bufferSize"> is the desired buffer size in bytes (8MB is good) </param> /// <param name="flags"> see startMethodTracing() docs; use 0 for default behavior </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendMPRS(Client client, String fileName, int bufferSize, int flags) throws java.io.IOException public static void sendMPRS(Client client, string fileName, int bufferSize, int flags) { ByteBuffer rawBuf = allocBuffer(3 * 4 + fileName.Length * 2); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(bufferSize); buf.putInt(flags); buf.putInt(fileName.Length); putString(buf, fileName); finishChunkPacket(packet, CHUNK_MPRS, buf.position); Log.d("ddm-prof", "Sending " + name(CHUNK_MPRS) + " '" + fileName + "', size=" + bufferSize + ", flags=" + flags); client.sendAndConsume(packet, mInst); // record the filename we asked for. client.clientData.pendingMethodProfiling = fileName; // send a status query. this ensure that the status is properly updated if for some // reason starting the tracing failed. sendMPRQ(client); }
/// <summary> /// Send a HELO request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendHELO(Client client, int serverProtocolVersion) throws java.io.IOException public static void sendHELO(Client client, int serverProtocolVersion) { ByteBuffer rawBuf = allocBuffer(4); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(serverProtocolVersion); finishChunkPacket(packet, CHUNK_HELO, buf.position); Log.d("ddm-hello", "Sending " + name(CHUNK_HELO) + " ID=0x" + packet.id.toHexString()); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a MPSS (Method Profiling Streaming Start) request to the client. /// /// The arguments to this method will eventually be passed to /// android.os.Debug.startMethodTracing() on the device. /// </summary> /// <param name="bufferSize"> is the desired buffer size in bytes (8MB is good) </param> /// <param name="flags"> see startMethodTracing() docs; use 0 for default behavior </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendMPSS(Client client, int bufferSize, int flags) throws java.io.IOException public static void sendMPSS(Client client, int bufferSize, int flags) { ByteBuffer rawBuf = allocBuffer(2 * 4); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(bufferSize); buf.putInt(flags); finishChunkPacket(packet, CHUNK_MPSS, buf.position); Log.d("ddm-prof", "Sending " + name(CHUNK_MPSS) + "', size=" + bufferSize + ", flags=" + flags); client.sendAndConsume(packet, mInst); // send a status query. this ensure that the status is properly updated if for some // reason starting the tracing failed. sendMPRQ(client); }
/// <summary> /// Forward a packet to the client. /// /// "mClient" will never be null, though it's possible that the channel /// in the client has closed and our send attempt will fail. /// /// Consumes the packet. /// </summary> internal void forwardPacketToClient(JdwpPacket packet) { mClient.sendAndConsume(packet); }
/// <summary> /// Sends a REAE (REcent Allocation Enable) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendREAE(Client client, boolean enable) throws java.io.IOException public static void sendREAE(Client client, bool enable) { ByteBuffer rawBuf = allocBuffer(1); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.put((byte)(enable ? 1 : 0)); finishChunkPacket(packet, CHUNK_REAE, buf.position); Log.d("ddm-heap", "Sending " + name(CHUNK_REAE) + ": " + enable); client.sendAndConsume(packet, mInst); }
/// <summary> /// Sends an HPDU request to the client. /// /// We will get an HPDU response when the heap dump has completed. On /// failure we get a generic failure response. /// </summary> /// <param name="fileName"> name of output file (on device) </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendHPDU(Client client, String fileName) throws java.io.IOException public static void sendHPDU(Client client, string fileName) { ByteBuffer rawBuf = allocBuffer(4 + fileName.Length * 2); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(fileName.Length); putString(buf, fileName); finishChunkPacket(packet, CHUNK_HPDU, buf.position); Log.d("ddm-heap", "Sending " + name(CHUNK_HPDU) + " '" + fileName + "'"); client.sendAndConsume(packet, mInst); client.clientData.pendingHprofDump = fileName; }
/// <summary> /// Sends an HPSG (HeaP SeGment) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendHPSG(Client client, int when, int what) throws java.io.IOException public static void sendHPSG(Client client, int when, int what) { ByteBuffer rawBuf = allocBuffer(2); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.put((byte)when); buf.put((byte)what); finishChunkPacket(packet, CHUNK_HPSG, buf.position); Log.d("ddm-heap", "Sending " + name(CHUNK_HPSG) + ": when=" + when + ", what=" + what); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a MPRS (Method PRofiling Start) request to the client. /// /// The arguments to this method will eventually be passed to /// android.os.Debug.startMethodTracing() on the device. /// </summary> /// <param name="fileName"> is the name of the file to which profiling data /// will be written (on the device); it will have <seealso cref="DdmConstants#DOT_TRACE"/> /// appended if necessary </param> /// <param name="bufferSize"> is the desired buffer size in bytes (8MB is good) </param> /// <param name="flags"> see startMethodTracing() docs; use 0 for default behavior </param> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendMPRS(Client client, String fileName, int bufferSize, int flags) throws java.io.IOException public static void sendMPRS(Client client, string fileName, int bufferSize, int flags) { ByteBuffer rawBuf = allocBuffer(3 * 4 + fileName.Length * 2); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(bufferSize); buf.putInt(flags); buf.putInt(fileName.Length); putString(buf, fileName); finishChunkPacket(packet, CHUNK_MPRS, buf.position); Log.d("ddm-prof", "Sending " + name(CHUNK_MPRS) + " '" + fileName + "', size=" + bufferSize + ", flags=" + flags); client.sendAndConsume(packet, mInst); // record the filename we asked for. client.clientData.pendingMethodProfiling = fileName; // send a status query. this ensure that the status is properly updated if for some // reason starting the tracing failed. sendMPRQ(client); }
/* * Send a THST request to the specified client. */ //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private static void sendTHST(Client client) throws java.io.IOException private static void sendTHST(Client client) { ByteBuffer rawBuf = allocBuffer(0); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); // nothing much to say finishChunkPacket(packet, CHUNK_THST, buf.position); Log.d("ddm-thread", "Sending " + name(CHUNK_THST)); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a STKL (STacK List) request to the client. The VM will suspend /// the target thread, obtain its stack, and return it. If the thread /// is no longer running, a failure result will be returned. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendSTKL(Client client, int threadId) throws java.io.IOException public static void sendSTKL(Client client, int threadId) { /* if (false) { Log.d("ddm-thread", "would send STKL " + threadId); return; } */ ByteBuffer rawBuf = allocBuffer(4); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); buf.putInt(threadId); finishChunkPacket(packet, CHUNK_STKL, buf.position); Log.d("ddm-thread", "Sending " + name(CHUNK_STKL) + ": " + threadId); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send an NHGT (Native Thread GeT) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendNHGT(Client client) throws java.io.IOException public static void sendNHGT(Client client) { ByteBuffer rawBuf = allocBuffer(0); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); // no data in request message finishChunkPacket(packet, CHUNK_NHGT, buf.position); Log.d("ddm-nativeheap", "Sending " + name(CHUNK_NHGT)); client.sendAndConsume(packet, mInst); rawBuf = allocBuffer(2); packet = new JdwpPacket(rawBuf); buf = getChunkDataBuf(rawBuf); buf.put(HandleHeap.WHEN_DISABLE); buf.put(HandleHeap.WHAT_OBJ); finishChunkPacket(packet, CHUNK_NHSG, buf.position); Log.d("ddm-nativeheap", "Sending " + name(CHUNK_NHSG)); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a FEAT request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendFEAT(Client client) throws java.io.IOException public static void sendFEAT(Client client) { ByteBuffer rawBuf = allocBuffer(0); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); // no data finishChunkPacket(packet, CHUNK_FEAT, buf.position); Log.d("ddm-heap", "Sending " + name(CHUNK_FEAT)); client.sendAndConsume(packet, mInst); }
/// <summary> /// Send a THEN (THread notification ENable) request to the client. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public static void sendTHEN(Client client, boolean enable) throws java.io.IOException public static void sendTHEN(Client client, bool enable) { ByteBuffer rawBuf = allocBuffer(1); JdwpPacket packet = new JdwpPacket(rawBuf); ByteBuffer buf = getChunkDataBuf(rawBuf); if (enable) { buf.put(1); } else { buf.put(0); } finishChunkPacket(packet, CHUNK_THEN, buf.position); Log.d("ddm-thread", "Sending " + name(CHUNK_THEN) + ": " + enable); client.sendAndConsume(packet, mInst); }