From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11694 invoked by alias); 17 Feb 2012 02:56:57 -0000 Received: (qmail 11461 invoked by uid 22791); 17 Feb 2012 02:56:53 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM 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; Fri, 17 Feb 2012 02:56:40 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1RyDzw-0004PE-To from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 16 Feb 2012 18:56:36 -0800 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 16 Feb 2012 18:55:51 -0800 Received: from localhost.localdomain (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, 16 Feb 2012 18:56:35 -0800 From: Yao Qi To: Subject: [PATCH 6/9] agent capability of static tracepoint Date: Fri, 17 Feb 2012 02:57:00 -0000 Message-ID: <1329447300-18841-7-git-send-email-yao@codesourcery.com> In-Reply-To: <1329447300-18841-1-git-send-email-yao@codesourcery.com> References: <1329447300-18841-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-02/txt/msg00352.txt.bz2 This patch is to teach both GDB and GDBserver to check agent's capability on static tracepoint, before performing any operations. gdb: 2012-02-15 Yao Qi * tracepoint.c (info_static_tracepoint_markers_command): Call agent_capability_check. gdb/gdbserver: 2012-02-15 Yao Qi * tracepoint.c (gdb_agent_capability): New global. (in_process_agent_loaded_ust): Renamed to `in_process_agent_supports_ust'. Update callers. (in_process_agent_supports_ust): Call agent_capability_check. (clear_installed_tracepoints): Assert that agent supports agent. (install_tracepoint): Call in_process_agent_supports_ust. --- gdb/gdbserver/tracepoint.c | 25 ++++++++++++++++++------- gdb/tracepoint.c | 5 +++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 091af5a..0e1f9ed 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -239,10 +239,11 @@ in_process_agent_loaded (void) static int read_inferior_integer (CORE_ADDR symaddr, int *val); /* Returns true if both the in-process agent library and the static - tracepoints libraries are loaded in the inferior. */ + tracepoints libraries are loaded in the inferior, and agent has + capability on static tracepoints. */ static int -in_process_agent_loaded_ust (void) +in_process_agent_supports_ust (void) { int loaded = 0; @@ -258,7 +259,10 @@ in_process_agent_loaded_ust (void) return 0; } - return loaded; + if (loaded) + return agent_capability_check (AGENT_CAPA_STATIC_TRACE); + else + return 0; } static void @@ -310,7 +314,7 @@ maybe_write_ipa_ust_not_loaded (char *buffer) write_e_ipa_not_loaded (buffer); return 1; } - else if (!in_process_agent_loaded_ust ()) + else if (!in_process_agent_supports_ust ()) { write_e_ust_not_loaded (buffer); return 1; @@ -2315,6 +2319,10 @@ clear_installed_tracepoints (void) ; else { + /* Static tracepoints have been inserted, so agent should have + been loaded and working. */ + gdb_assert (in_process_agent_supports_ust ()); + unprobe_marker_at (tpoint->address); prev_stpoint = tpoint; } @@ -2965,7 +2973,8 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf) write_e_ipa_not_loaded (own_buf); return; } - if (tpoint->type == static_tracepoint && !in_process_agent_loaded_ust ()) + if (tpoint->type == static_tracepoint + && !in_process_agent_supports_ust ()) { trace_debug ("Requested a static tracepoint, but static " "tracepoints are not supported."); @@ -2990,8 +2999,8 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf) } else { - if (tp) - tpoint->handle = (void *) -1; + if (!in_process_agent_supports_ust ()) + warning ("Agent does not have capability for static tracepoint."); else { if (probe_marker_at (tpoint->address, own_buf) == 0) @@ -7994,6 +8003,8 @@ gdb_agent_helper_thread (void *arg) #include #include +IP_AGENT_EXPORT int gdb_agent_capability = AGENT_CAPA_STATIC_TRACE; + static void gdb_agent_init (void) { diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index c56a02c..c2801f9 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -4893,6 +4893,11 @@ info_static_tracepoint_markers_command (char *arg, int from_tty) warning (_("Agent is off. Run `set agent on'.")); return; } + if (!agent_capability_check (AGENT_CAPA_STATIC_TRACE)) + { + warning (_("Agent is not capable of operating static tracepoints")); + return; + } old_chain = make_cleanup_ui_out_table_begin_end (uiout, 5, -1, -- 1.7.0.4