From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15445 invoked by alias); 17 Nov 2011 03:32:59 -0000 Received: (qmail 15434 invoked by uid 22791); 17 Nov 2011 03:32:57 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00 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, 17 Nov 2011 03:32:40 +0000 Received: from nat-jpt.mentorg.com ([192.94.33.2] helo=PR1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RQsiN-00006J-Oq from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 16 Nov 2011 19:32:39 -0800 Received: from [127.0.0.1] ([172.16.63.104]) by PR1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 17 Nov 2011 12:32:38 +0900 Message-ID: <4EC4804F.2000408@codesourcery.com> Date: Thu, 17 Nov 2011 03:32:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: Pedro Alves CC: gdb-patches@sourceware.org Subject: Re: [patch 3/5] Print a message on gdb disconnected. References: <4EC20E2E.6010402@codesourcery.com> <4EC218EC.9090105@codesourcery.com> <201111161904.05595.pedro@codesourcery.com> In-Reply-To: <201111161904.05595.pedro@codesourcery.com> Content-Type: multipart/mixed; boundary="------------040703040202050408050308" 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: 2011-11/txt/msg00461.txt.bz2 This is a multi-part message in MIME format. --------------040703040202050408050308 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Content-length: 1017 On 11/17/2011 03:04 AM, Pedro Alves wrote: >> > + /* Check whether we still have pending tracepoint. If we have, warn the >> > + user that pending tracepoint will no longer work. */ >> > + tp_vec = all_tracepoints (); >> > + for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++) >> > + { >> > + if (b->loc == NULL || b->loc->shlib_disabled) > It's not garanteed that the first location is the one that > is shlib_disabled. If you want the warning for the shlib_disabled > cases, you'll need to iterate over the breakpoint's locations. > Yes. I am still unable to keep it in mind that there may be multiple locations for one breakpoint :) >> > + { >> > + has_pending_p = 1; >> > + break; >> > + } >> > + } >> > + VEC_free (breakpoint_p, tp_vec); >> > + >> > + if (has_pending_p) >> > + warning (_("Pending tracepoint will not be resolved while" >> > + " GBD is disconnected\n")); > Plural, "Pending tracepoints". Fixed. -- Yao (齐尧) --------------040703040202050408050308 Content-Type: text/x-patch; name="0003-pending-tracepoint-on-disconnect.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0003-pending-tracepoint-on-disconnect.patch" Content-length: 1734 gdb/ * tracepoint.c (process_tracepoint_on_disconnect): New. (disconnect_tracing): Call process_tracepoint_on_disconnect. --- gdb/tracepoint.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index e155515..97ab633 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1642,6 +1642,48 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr) collect->next_aexpr_elt++; } +static void +process_tracepoint_on_disconnect (void) +{ + VEC(breakpoint_p) *tp_vec = NULL; + int ix; + struct breakpoint *b; + int has_pending_p = 0; + + /* Check whether we still have pending tracepoint. If we have, warn the + user that pending tracepoint will no longer work. */ + tp_vec = all_tracepoints (); + for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, b); ix++) + { + if (b->loc == NULL) + { + has_pending_p = 1; + break; + } + else + { + struct bp_location *loc1; + + for (loc1 = b->loc; loc1; loc1 = loc1->next) + { + if (loc1->shlib_disabled) + { + has_pending_p = 1; + break; + } + } + + if (has_pending_p) + break; + } + } + VEC_free (breakpoint_p, tp_vec); + + if (has_pending_p) + warning (_("Pending tracepoints will not be resolved while" + " GDB is disconnected\n")); +} + void start_tracing (void) @@ -2020,6 +2062,8 @@ disconnect_tracing (int from_tty) disconnected-tracing. */ if (current_trace_status ()->running && from_tty) { + process_tracepoint_on_disconnect (); + if (current_trace_status ()->disconnected_tracing) { if (!query (_("Trace is running and will " -- 1.7.0.4 --------------040703040202050408050308--