From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULCvF-0003lx-Kf for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:31:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ULCvC-0001sw-PB for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:31:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ULCqI-00088m-4M for qemu-devel@nongnu.org; Thu, 28 Mar 2013 09:26:10 -0400 From: Stefan Hajnoczi Date: Thu, 28 Mar 2013 14:25:45 +0100 Message-Id: <1364477152-26994-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1364477152-26994-1-git-send-email-stefanha@redhat.com> References: <1364477152-26994-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 04/11] trace: [monitor] Use new event control interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , =?UTF-8?q?Llu=C3=ADs=20Vilanova?= , Stefan Hajnoczi From: Llu=C3=ADs Vilanova Signed-off-by: Llu=C3=ADs Vilanova Signed-off-by: Stefan Hajnoczi --- monitor.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index 5dfae2a..4ec1db9 100644 --- a/monitor.c +++ b/monitor.c @@ -761,9 +761,18 @@ static void do_trace_event_set_state(Monitor *mon, c= onst QDict *qdict) { const char *tp_name =3D qdict_get_str(qdict, "name"); bool new_state =3D qdict_get_bool(qdict, "option"); - int ret =3D trace_event_set_state(tp_name, new_state); =20 - if (!ret) { + bool found =3D false; + TraceEvent *ev =3D NULL; + while ((ev =3D trace_event_pattern(tp_name, ev)) !=3D NULL) { + found =3D true; + if (!trace_event_get_state_static(ev)) { + monitor_printf(mon, "event \"%s\" is not traceable\n", tp_na= me); + } else { + trace_event_set_state_dynamic(ev, new_state); + } + } + if (!trace_event_is_pattern(tp_name) && !found) { monitor_printf(mon, "unknown event name \"%s\"\n", tp_name); } } --=20 1.8.1.4