[patch 2/8] Add to_use_agent in target_ops

Yao Qi
2012-01-23T13:48:05Z

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

As agent goes in, we need to control the agent to perform debugging
operations. This new field in target_ops is used to control this, so
that we can implement different for remote debugging and native debugging.

--
Yao (é½å°§)

[-- Attachment #2: 0002-Add-to_use_agent-in-target.patch --]
[-- Type: text/x-patch, Size: 1887 bytes --]

2012-01-13 Yao Qi <yao@codesourcery.com>

* target.h (struct target_ops): New field `to_use_agent'.
(target_use_agent): New macro.
* target.c (update_current_target): Update.
---
gdb/target.c | 4 ++++
gdb/target.h | 7 +++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/gdb/target.c b/gdb/target.c
index 9aaa0ea..e1955fa 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -697,6 +697,7 @@ update_current_target (void)
INHERIT (to_static_tracepoint_marker_at, t);
INHERIT (to_static_tracepoint_markers_by_strid, t);
INHERIT (to_traceframe_info, t);
+ INHERIT (to_use_agent, t);
INHERIT (to_magic, t);
/* Do not inherit to_memory_map. */
/* Do not inherit to_flash_erase. */
@@ -924,6 +925,9 @@ update_current_target (void)
de_fault (to_traceframe_info,
(struct traceframe_info * (*) (void))
tcomplain);
+ de_fault (to_use_agent,
+ (int (*) (int))
+ tcomplain);
de_fault (to_execution_direction, default_execution_direction);

#undef de_fault
diff --git a/gdb/target.h b/gdb/target.h
index 7d0bed1..cd3f3d4 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -795,6 +795,10 @@ struct target_ops
re-fetching when necessary. */
struct traceframe_info *(*to_traceframe_info) (void);

+ /* Ask the target to use or not to use agent according to USE. Return the
+ actual value of updated flag. */
+ int (*to_use_agent) (int use);
+
int to_magic;
/* Need sub-structure for target machine related rather than comm related?
*/
@@ -1569,6 +1573,9 @@ extern int target_search_memory (CORE_ADDR start_addr,
#define target_traceframe_info() \
(*current_target.to_traceframe_info) ()

+#define target_use_agent(use) \
+ (*current_target.to_use_agent) (use)
+
/* Command logging facility. */

#define target_log_command(p) \
--
1.7.0.4