void CmdInternalTesting::onClientImpl(DebuggerClient &client) { TRACE(2, "CmdInternalTesting::onClientImpl\n"); if (DebuggerCommand::displayedHelp(client)) return; if (client.argCount() == 0) { help(client); return; } client.info("Executing internal test..."); m_arg = client.argValue(1); if (client.arg(1, "badcmdtypesend")) { // Give the cmd a bad type and send it over. This should cause the proxy to // disconnect from us. m_type = KindOfInternalTestingBad; client.sendToServer(this); // Spin here and wait for the client to be marked as stopped // before going back to the event loop. This will give the local // proxy time to recgonize the bad cmd, terminate, and wait for // the client to stop. This will ensure that we always exit on the // same path on both proxy and client threads, and remove any // spurious output form ths test case. while (!client.internalTestingIsClientStopped()) { sleep(1); } throw DebuggerConsoleExitException(); // Expect no response } else if (client.arg(1, "badcmdtypereceive")) { client.xend<CmdInternalTesting>(this); return; } else if (client.arg(1, "shortcmdsend")) { m_arg = "shortcmd"; // Force send to drop a field. client.sendToServer(this); // See note above about this wait. while (!client.internalTestingIsClientStopped()) { sleep(1); } throw DebuggerConsoleExitException(); // Expect no response } else if (client.arg(1, "shortcmdreceive")) { client.xend<CmdInternalTesting>(this); return; } else if (client.arg(1, "segfaultClient")) { int *px = nullptr; *px = 42; } else if (client.arg(1, "segfaultServer")) { client.xend<CmdInternalTesting>(this); return; } help(client); }