Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 6/8] Agent's capability
Date: Thu, 09 Feb 2012 20:09:00 -0000	[thread overview]
Message-ID: <4F3427EF.10906@redhat.com> (raw)
In-Reply-To: <4F1D68A2.2080503@codesourcery.com>

On 01/23/2012 02:03 PM, Yao Qi wrote:
> GDB/GDBserver could be able to talk with different agents, if they
> follow the same protocol.  However, different agents may have different
> capabilities, say, one agent can install fast tracepoint, while the
> other agent can't.  Agent capability is to present what agent can do.
> 
> In agent side, we use an interger bit map, and each bit represents a
> corresponding capability.
> 
> This piece of work is different from this, which is about target capability,
> 
> http://sourceware.org/gdb/current/onlinedocs/gdb/Varying-Target-Capabilities.html

That page is obsolete.  We've been addressing those kinds of things with
qSupported features.  I won't stand in the way of this change, but I do
wonder whether we shouldn't instead ask the agent about its features with
a similar (or exactly the same) mechanism.

> 
> -- Yao (齐尧)
> 
> 
> 0006-agent-capability.patch
> 
> 
> 2012-01-23  Yao Qi  <yao@codesourcery.com>
> 
> 	* common/agent.c (struct ipa_sym_addresses) <addr_capability>: New.
> 	(agent_check_capability): New.
> 	(symbol_list): New array element.
> 	* common/agent.h (enum agent_capa): New.
> ---
>  gdb/common/agent.c |   31 +++++++++++++++++++++++++++++++
>  gdb/common/agent.h |   15 +++++++++++++++
>  2 files changed, 46 insertions(+), 0 deletions(-)
> 
> diff --git a/gdb/common/agent.c b/gdb/common/agent.c
> index 5c66071..f4ff08c 100644
> --- a/gdb/common/agent.c
> +++ b/gdb/common/agent.c
> @@ -44,6 +44,7 @@ struct ipa_sym_addresses
>  {
>    CORE_ADDR addr_helper_thread_id;
>    CORE_ADDR addr_cmd_buf;
> +  CORE_ADDR addr_capability;
>  };
>  
>  /* Cache of the helper thread id.  */
> @@ -57,6 +58,7 @@ static struct
>  } symbol_list[] = {
>    IPA_SYM(helper_thread_id),
>    IPA_SYM(cmd_buf),
> +  IPA_SYM(capability),
>  };
>  
>  static struct ipa_sym_addresses ipa_sym_addrs;
> @@ -114,6 +116,9 @@ agent_get_helper_thread_id (void)
>    return helper_thread_id;
>  }
>  
> +/* Each bit of it stands for a capability of agent.  */
> +static unsigned int agent_capability = 0;

Something should be clearing these fields whenever you launch a
new program, or reconnect.

> +
>  /* Connects to synchronization socket.  PID is the pid of inferior, which is
>     used to set up connection socket.  */
>  
> @@ -260,3 +265,29 @@ agent_run_command (int pid, const char *cmd, int len)
>  	}
>      }
>  }
> +
> +/* Return true if agent has capability AGENT_CAP, otherwise return false.  */
> +
> +int
> +agent_check_capability (enum agent_capa agent_capa)
> +{
> +  if  (agent_capability == 0)

Spurious space.

> +    {
> +#ifdef GDBSERVER
> +      if (read_inferior_memory (ipa_sym_addrs.addr_capability,
> +				(unsigned char *) &agent_capability,
> +				sizeof agent_capability))
> +#else
> +      enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch);
> +      gdb_byte buf[4];
> +
> +      if (target_read_memory (ipa_sym_addrs.addr_capability,
> +			      buf, sizeof buf) == 0)
> +	agent_capability = extract_unsigned_integer (buf, sizeof buf,
> +						     byte_order);
> +      else
> +#endif

#endif seems misplaced.

> +	warning ("Error reading helper thread's id in lib");

Wrong warning?

> +    }
> +  return agent_capability & agent_capa;
> +}
> diff --git a/gdb/common/agent.h b/gdb/common/agent.h
> index 079b65e..cf3fab1 100644
> --- a/gdb/common/agent.h
> +++ b/gdb/common/agent.h
> @@ -36,3 +36,18 @@ void agent_look_up_symbols (void);
>  extern int debug_agent ;
>  
>  extern int use_agent;
> +
> +/* Capability of agent.  Different agents may have different capabilities,
> +   such as installing fast tracepoint or evaluating breakpoint conditions.
> +   Capabilities are represented by bit-maps, and each capability occupy one
> +   bit.  */
> +
> +enum agent_capa
> +{
> +  /* Capability to install fast tracepoint.  */
> +  AGENT_CAPA_FAST_TRACE = 0x1,
> +  /* Capability to install static tracepoint.  */
> +  AGENT_CAPA_STATIC_TRACE = (0x1 << 1),
> +};
> +
> +int agent_check_capability (enum agent_capa);

-- 
Pedro Alves


  parent reply	other threads:[~2012-02-09 20:09 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23 13:37 [patch 0/8] GDB/GDBserver talks with agents Yao Qi
2012-01-23 13:48 ` [patch 1/8] Generalize interaction with agent in gdb/gdbserver Yao Qi
2012-01-30 11:25   ` Yao Qi
2012-02-09 19:21   ` Pedro Alves
2012-02-14  2:41     ` Yao Qi
2012-02-14 10:16       ` Pedro Alves
2012-01-23 13:50 ` [patch 2/8] Add to_use_agent in target_ops Yao Qi
2012-02-09 19:36   ` Pedro Alves
2012-01-23 13:54 ` [patch 3/8] Command `set agent on|off' Yao Qi
2012-01-23 17:14   ` Eli Zaretskii
2012-01-24  0:28     ` Yao Qi
2012-01-24  5:54       ` Eli Zaretskii
2012-01-26  1:32         ` Yao Qi
2012-02-09 20:19   ` Pedro Alves
2012-01-23 13:58 ` [patch 4/8] `use_agent' for remote and QAgent Yao Qi
2012-01-23 17:17   ` Eli Zaretskii
2012-01-26  2:17     ` Yao Qi
2012-01-26 17:43       ` Eli Zaretskii
2012-02-09 19:55   ` Pedro Alves
2012-01-23 14:03 ` [patch 5/8] Doc for agent Yao Qi
2012-01-23 18:12   ` Eli Zaretskii
2012-01-24  0:51     ` Yao Qi
2012-01-24  8:04       ` Eli Zaretskii
2012-01-26  1:53         ` Yao Qi
2012-01-26 17:15           ` Eli Zaretskii
2012-02-09 19:55   ` Pedro Alves
2012-02-10 13:30     ` Yao Qi
2012-02-10 15:01       ` Pedro Alves
2012-02-10 16:18         ` Yao Qi
2012-02-10 16:28           ` Pedro Alves
2012-02-23  7:51             ` Yao Qi
2012-02-23 19:50               ` Pedro Alves
2012-01-23 14:07 ` [patch 6/8] Agent's capability Yao Qi
2012-01-24  3:49   ` Yao Qi
2012-02-09 20:09   ` Pedro Alves [this message]
2012-02-10 12:25     ` Yao Qi
2012-02-10 12:37       ` Pedro Alves
2012-02-10 13:07         ` Yao Qi
2012-01-23 14:29 ` [patch 7/8] Agent capability for static tracepoint Yao Qi
2012-02-09 20:13   ` Pedro Alves
2012-02-10 14:29     ` Yao Qi
2012-02-10 14:56       ` Pedro Alves
2012-01-23 16:03 ` [patch 8/8] Control agent in testsuite Yao Qi
2012-02-09 20:16   ` Pedro Alves
2012-02-05  4:32 ` [ping] [patch 0/8] GDB/GDBserver talks with agents Yao Qi
2012-02-09 19:02 ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F3427EF.10906@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox