From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1402 invoked by alias); 18 Oct 2012 10:36:21 -0000 Received: (qmail 1323 invoked by uid 22791); 18 Oct 2012 10:36:20 -0000 X-SWARE-Spam-Status: No, hits=-3.7 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM,KHOP_RCVD_UNTRUST,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Oct 2012 10:36:16 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1TOnSZ-0005F1-M3 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 18 Oct 2012 03:36:15 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 18 Oct 2012 03:36:15 -0700 Received: from qiyao.dyndns.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.1.289.1; Thu, 18 Oct 2012 03:36:26 -0700 From: Yao Qi To: Subject: [PATCH] Fix PR14617: New MI notification on tracepoint modified. Date: Thu, 18 Oct 2012 10:36:00 -0000 Message-ID: <1350556586-12800-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-10/txt/msg00321.txt.bz2 Hi, As PR gdb/14617 described, when the passcount of a tracepoint is modified, GDB doesn't emit any notification. This patch adds a new notification '=tracepoint-modified' for the changes to tracepoint-specific attributes. The reason I don't use '=breakpoint-modified' notification is that IMO, it is about changes to general breakpoints (breakpoint, tracepoint, catchpoint, etc), so I don't want to put tracepoint-specific stuff into it. Regression tested on x86_64-linux with both native and gdbserver, OK to apply? gdb/doc: * gdb.texinfo (GDB/MI Async Records): Document new MI notificaiton "=tracepoint-modified". * observer.texi (GDB Observers): Change the parameter of observer "tracepoint-modified". gdb: Fix PR gdb/14617. * NEWS: Mention new MI notification "=tracepoint-modified". * breakpoint.c (trace_pass_set_count): Update caller of observer_notify_tracepoint_modified. * mi/mi-cmd-break.c (mi_cmd_break_passcount): Likewise. * mi/mi-interp.c: Declare 'mi_tracepoint_modified'. (mi_interpreter_init): Attach 'mi_tracepoint_modified' to 'tracepoint-modified' observer. (mi_breakpoint_modified): New. * observer.sh (struct objfile;): Declare 'struct tracepoint'. gdb/testsuite: Fix PR gdb/14617. * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): Remove setup_kfail, and update test. --- gdb/NEWS | 2 ++ gdb/breakpoint.c | 2 +- gdb/doc/gdb.texinfo | 5 +++++ gdb/doc/observer.texi | 6 +++--- gdb/mi/mi-cmd-break.c | 2 +- gdb/mi/mi-interp.c | 19 +++++++++++++++++++ gdb/observer.sh | 1 + gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp | 3 +-- 8 files changed, 33 insertions(+), 7 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 0d13c19..485c21b 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -66,6 +66,8 @@ py [command] "=memory-changed". ** Download of tracepoints are now notified using new async record "=tracepoint-downloaded". + ** Passcount of tracepoint changes are now notified using new async record + "=tracepoint-modified". *** Changes in GDB 7.5 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 3d69d41..e233cd0 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -15246,7 +15246,7 @@ static void trace_pass_set_count (struct tracepoint *tp, int count, int from_tty) { tp->pass_count = count; - observer_notify_tracepoint_modified (tp->base.number); + observer_notify_tracepoint_modified (tp); if (from_tty) printf_filtered (_("Setting tracepoint %d's passcount to %d\n"), tp->base.number, count); diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index dbdf39b..64cda47 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -27685,6 +27685,11 @@ breakpoint commands; @xref{GDB/MI Breakpoint Commands}. The Note that if a breakpoint is emitted in the result record of a command, then it will not also be emitted in an async record. +@item =tracepoint-modified,bkpt=@{number=@var{id},passcount=@var{count}@} +Reports that a tracepoint-specific attribute was modified. The @var{id} +is the ordinal number of tracepoint and @var{count} is the passcount +of the tracepoint. + @item =tracepoint-downloaded,id="@var{number}",address="@var{addr}" Reports that a tracepoint was downloaded to target. The @var{number} is the ordinal number of the tracepoint. The @var{addr} is the diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi index 9fd92fb..e2033a6 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi @@ -189,9 +189,9 @@ A tracepoint has been destroyed. The argument @var{tpnum} is the number of the newly-destroyed tracepoint. @end deftypefun -@deftypefun void tracepoint_modified (int @var{tpnum}) -A tracepoint has been modified in some way. The argument @var{tpnum} -is the number of the modified tracepoint. +@deftypefun void tracepoint_modified (struct tracepoint *@var{t}) +A tracepoint has been modified in some way. The argument @var{t} +is the pointer to the modified tracepoint. @end deftypefun @deftypefun void tracepoint_downloaded (struct bp_location *@var{loc}) diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 2fe84dc..e3f709e 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -200,7 +200,7 @@ mi_cmd_break_passcount (char *command, char **argv, int argc) if (t) { t->pass_count = p; - observer_notify_tracepoint_modified (n); + observer_notify_tracepoint_modified (t); } else { diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index d83d493..ec14f03 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -76,6 +76,7 @@ static void mi_tsv_deleted (const char *name); static void mi_breakpoint_created (struct breakpoint *b); static void mi_breakpoint_deleted (struct breakpoint *b); static void mi_breakpoint_modified (struct breakpoint *b); +static void mi_tracepoint_modified (struct tracepoint *t); static void mi_tracepoint_downloaded (struct bp_location *loc); static void mi_command_param_changed (const char *param, const char *value); static void mi_memory_changed (struct inferior *inf, CORE_ADDR memaddr, @@ -141,6 +142,7 @@ mi_interpreter_init (struct interp *interp, int top_level) observer_attach_breakpoint_created (mi_breakpoint_created); observer_attach_breakpoint_deleted (mi_breakpoint_deleted); observer_attach_breakpoint_modified (mi_breakpoint_modified); + observer_attach_tracepoint_modified (mi_tracepoint_modified); observer_attach_tracepoint_downloaded (mi_tracepoint_downloaded); observer_attach_command_param_changed (mi_command_param_changed); observer_attach_memory_changed (mi_memory_changed); @@ -683,6 +685,23 @@ mi_breakpoint_modified (struct breakpoint *b) gdb_flush (mi->event_channel); } +/* Emit notification about modified tracepoint. */ + +static void +mi_tracepoint_modified (struct tracepoint *t) +{ + struct mi_interp *mi = top_level_interpreter_data (); + + target_terminal_ours (); + + fprintf_unfiltered (mi->event_channel, + "tracepoint-modified,bkpt={number=\"%d\"" + ",passcount=\"%d\"}\n", + t->base.number, t->pass_count); + + gdb_flush (mi->event_channel); +} + /* Emit notification about downloaded tracepoint. MI frontends may check whether tracepoints are downloaded or not and display downloaded ones and un-downloaded ones differently. */ diff --git a/gdb/observer.sh b/gdb/observer.sh index 3df6578..00e3e90 100755 --- a/gdb/observer.sh +++ b/gdb/observer.sh @@ -65,6 +65,7 @@ struct objfile; struct thread_info; struct inferior; struct bp_location; +struct tracepoint; EOF ;; esac diff --git a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp index 773f588..2a5ab1a 100644 --- a/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp +++ b/gdb/testsuite/gdb.mi/mi-breakpoint-changed.exp @@ -120,10 +120,9 @@ proc test_insert_delete_modify { } { {.*=breakpoint-modified,bkpt=\{number="5",.*,ignore=\"1\".*\}.*\n\^done} \ $test # 5. when modifying pass count. - setup_kfail gdb/14617 *-*-* set test "passcount 1 4" mi_gdb_test $test \ - {.*=breakpoint-modified,bkpt=\{number="4",.*\}.*\n\^done} \ + {.*=tracepoint-modified,bkpt=\{number="4",passcount="1".*\}.*\n\^done} \ $test # Delete some breakpoints and verify that '=breakpoint-deleted -- 1.7.7.6