Received: from eggs.gnu.org ([208.118.235.92]:49517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkTcS-0003k5-7Y for qemu-devel@nongnu.org; Mon, 17 Dec 2012 00:52:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkTcP-0007U8-Ix for qemu-devel@nongnu.org; Mon, 17 Dec 2012 00:52:04 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:49718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkTcP-0007U2-De for qemu-devel@nongnu.org; Mon, 17 Dec 2012 00:52:01 -0500 Received: by mail-ie0-f173.google.com with SMTP id e13so8743632iej.4 for ; Sun, 16 Dec 2012 21:52:00 -0800 (PST) From: Shraddha Kamat Content-Type: text/plain; charset="UTF-8" Date: Mon, 17 Dec 2012 11:21:10 +0530 Message-ID: <1355723470.17969.19.camel@oc2826874472.ibm.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] QMP command implementation help List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Adam Litke , Markus Armbruster , Luiz Capitulino I am implementing couple of QMP commands to Qemu - so trying a hello-world command first as shown here https://github.com/qemu/qemu/blob/master/docs/writing-qmp-commands.txt Step 1 : ======== Added to qapi-schema.json file this : { 'command': 'hello-world' } Step 2: ======= Added to qmp.c : void qmp_hello_world(Error **errp) { printf("Hello, world!\n"); } Step 3 : ======== Added to qmp-commands.hx : { .name = "hello-world", .args_type = "", .mhandler.cmd_new = qmp_marshal_input_hello_world, }, and build upstream Qemu-kvm : Then tried to test the command hello-world : # telnet localhost 4444 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. { "QMP": { "version": { "qemu": { "micro": 50, "minor": 2, "major": 1 }, "package": " (qemu-kvm-devel)" }, "capabilities": [ ] } } { "execute": "qmp_capabilities" } { "return": { } } { "execute": "hello-world" } { "error": { "class": "CommandNotFound", "desc": "The command hello-world has not been found" } } ------------------------------------------------------ I debugged a bit - qemu-kvm/x86_64-softmmu/qmp-commands-old.h has this entry : { .name = "hello-world", .args_type = "", .mhandler.cmd_new = qmp_marshal_input_hello_world, }, but in monitor.c/qmp_find_cmd() - qmp_cmds doesn't have this entry and hence the error !! Note that qemu_cmds is defined as static const mon_cmd_t qmp_cmds[] = { #include "qmp-commands-old.h" { /* NULL */ }, }; in monitor.c. What might be causing qmp-commands-old.h not to load qmp_cmds[] with hello-world command entry ? Please help. -- Shraddha