diff options
author | qiyao <qiyao> | 2012-03-03 04:04:33 +0000 |
---|---|---|
committer | qiyao <qiyao> | 2012-03-03 04:04:33 +0000 |
commit | 56caf1757189b56d2f86846cb257beab3214e62e (patch) | |
tree | a9673478317e7e69ccf5dab2b0e43c4d4c30cfd7 /gdb/common | |
parent | ffbc94801174ce3aef0e5815ea2b2ea9274d2377 (diff) | |
download | gdb-56caf1757189b56d2f86846cb257beab3214e62e.tar.gz |
gdb:
* common/agent.c (struct ipa_sym_addresses) <addr_capability>: New.
(agent_capability_check, agent_capability_invalidate): New.
(symbol_list): New array element.
* common/agent.h (enum agent_capa): New.
* target.c (target_pre_inferior): Call agent_capability_invalidate.
gdb/gdbserver:
* 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.
Diffstat (limited to 'gdb/common')
-rw-r--r-- | gdb/common/agent.c | 40 | ||||
-rw-r--r-- | gdb/common/agent.h | 17 |
2 files changed, 57 insertions, 0 deletions
diff --git a/gdb/common/agent.c b/gdb/common/agent.c index 2bd3206d3e9..f3bdafcfaeb 100644 --- a/gdb/common/agent.c +++ b/gdb/common/agent.c @@ -51,6 +51,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. FIXME: this global should be made @@ -65,6 +66,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; @@ -303,3 +305,41 @@ agent_run_command (int pid, const char *cmd) return 0; } + +/* Each bit of it stands for a capability of agent. */ +static unsigned int agent_capability = 0; + +/* Return true if agent has capability AGENT_CAP, otherwise return false. */ + +int +agent_capability_check (enum agent_capa agent_capa) +{ + if (agent_capability == 0) + { +#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 + warning ("Error reading capability of agent"); + } + return agent_capability & agent_capa; +} + +/* Invalidate the cache of agent capability, so we'll read it from inferior + again. Call it when launches a new program or reconnect to remote stub. */ + +void +agent_capability_invalidate (void) +{ + agent_capability = 0; +} diff --git a/gdb/common/agent.h b/gdb/common/agent.h index 296521579ca..a1ac9b20d23 100644 --- a/gdb/common/agent.h +++ b/gdb/common/agent.h @@ -36,3 +36,20 @@ int 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 occupies 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_capability_check (enum agent_capa); + +void agent_capability_invalidate (void); |