This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch 7/8] Agent capability for static tracepoint
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 09 Feb 2012 20:13:08 +0000
- Subject: Re: [patch 7/8] Agent capability for static tracepoint
- References: <4F1D55D7.7030506@codesourcery.com> <4F1D6994.1080902@codesourcery.com>
On 01/23/2012 02:07 PM, Yao Qi wrote:
> Current libinproctrace.so agent is able to do operations on static
> tracepoint, which can be treated as one capability. This patch is to
> teach gdbserver to check agent's capability when performing operations
> related to static tracepoint.
>
Hmm, not sure. Why aren't these being hooked at the same places
where we already check/call maybe_write_ipa_ust_not_loaded and
in_process_agent_loaded_ust?
> -- Yao (éå)
>
>
> 0007-gdb-agent-for-static-tracepoint.patch
>
>
> 2012-01-23 Yao Qi <yao@codesourcery.com>
>
> * tracepoint.c (gdb_agent_capability): New global.
> (clear_installed_tracepoints): Check whether agent has capability
> for static tracepoint.
> (install_tracepoint): Likewise.
> (cmd_qtstart): Likewise.
> (handle_tracepoint_query): Likewise.
> ---
> gdb/gdbserver/tracepoint.c | 68 +++++++++++++++++++++++++++++--------------
> 1 files changed, 46 insertions(+), 22 deletions(-)
>
> diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
> index 7f462bc..9527d74 100644
> --- a/gdb/gdbserver/tracepoint.c
> +++ b/gdb/gdbserver/tracepoint.c
> @@ -2314,7 +2314,11 @@ clear_installed_tracepoints (void)
> ;
> else
> {
> - unprobe_marker_at (tpoint->address);
> + if (agent_check_capability (AGENT_CAPA_STATIC_TRACE) == 0)
> + warning ("Agent does not have capability"
> + "for static tracepoint.");
> + else
> + unprobe_marker_at (tpoint->address);
> prev_stpoint = tpoint;
> }
> break;
> @@ -2989,8 +2993,8 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf)
> }
> else
> {
> - if (tp)
> - tpoint->handle = (void *) -1;
> + if (agent_check_capability (AGENT_CAPA_STATIC_TRACE) == 0)
> + warning ("Agent does not have capability for static tracepoint.");
> else
> {
> if (probe_marker_at (tpoint->address, own_buf) == 0)
> @@ -3094,13 +3098,19 @@ cmd_qtstart (char *packet)
> }
> else
> {
> - if (probe_marker_at (tpoint->address, packet) == 0)
> + if (agent_check_capability (AGENT_CAPA_STATIC_TRACE) == 0)
> + warning ("Agent does not have capability"
> + "for static tracepoint.");
> + else
> {
> - tpoint->handle = (void *) -1;
> -
> - /* So that we can handle multiple static tracepoints
> - at the same address easily. */
> - prev_stpoint = tpoint;
> + if (probe_marker_at (tpoint->address, packet) == 0)
> + {
> + tpoint->handle = (void *) -1;
> +
> + /* So that we can handle multiple static tracepoints
> + at the same address easily. */
> + prev_stpoint = tpoint;
> + }
> }
> }
> }
> @@ -3968,20 +3978,32 @@ handle_tracepoint_query (char *packet)
> cmd_qtbuffer (packet);
> return 1;
> }
> - else if (strcmp ("qTfSTM", packet) == 0)
> - {
> - cmd_qtfstm (packet);
> - return 1;
> - }
> - else if (strcmp ("qTsSTM", packet) == 0)
> + else if (strcmp ("qTfSTM", packet) == 0 || strcmp ("qTsSTM", packet) == 0
> + || strncmp ("qTSTMat:", packet, strlen ("qTSTMat:")) == 0)
> {
> - cmd_qtsstm (packet);
> - return 1;
> - }
> - else if (strncmp ("qTSTMat:", packet, strlen ("qTSTMat:")) == 0)
> - {
> - cmd_qtstmat (packet);
> - return 1;
> + if (agent_check_capability (AGENT_CAPA_STATIC_TRACE) == 0)
> + {
> + warning ("Agent does not have capability for static tracepoint.");
> + return 0;
> + }
> + else
> + {
> + if (strcmp ("qTfSTM", packet) == 0)
> + {
> + cmd_qtfstm (packet);
> + return 1;
> + }
> + else if (strcmp ("qTsSTM", packet) == 0)
> + {
> + cmd_qtsstm (packet);
> + return 1;
> + }
> + else if (strncmp ("qTSTMat:", packet, strlen ("qTSTMat:")) == 0)
> + {
> + cmd_qtstmat (packet);
> + return 1;
> + }
> + }
> }
> else if (strcmp ("qTMinFTPILen", packet) == 0)
> {
> @@ -7986,6 +8008,8 @@ gdb_ust_thread (void *arg)
>
> #include <signal.h>
>
> +IP_AGENT_EXPORT int gdb_agent_capability = AGENT_CAPA_STATIC_TRACE;
> +
> static void
> gdb_ust_init (void)
> {
> -- 1.7.0.4
--
Pedro Alves