From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27964 invoked by alias); 6 Feb 2014 20:58:38 -0000 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 Received: (qmail 27884 invoked by uid 89); 6 Feb 2014 20:58:37 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Feb 2014 20:58:35 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s16Ku0YJ003839 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 6 Feb 2014 15:56:01 -0500 Received: from barimba.redhat.com (ovpn-113-148.phx2.redhat.com [10.3.113.148]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s16KtfZk013306; Thu, 6 Feb 2014 15:56:00 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC v2 25/38] convert to_static_tracepoint_markers_by_strid Date: Thu, 06 Feb 2014 20:58:00 -0000 Message-Id: <1391720136-2121-26-git-send-email-tromey@redhat.com> In-Reply-To: <1391720136-2121-1-git-send-email-tromey@redhat.com> References: <1391720136-2121-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-02/txt/msg00161.txt.bz2 Note that this patch reformats the to_static_tracepoint_markers_by_strid field declaration in struct target_ops. This was needed because make-target-delegates requires the opening paren for the parameters to be on the same line as the method name, and I didn't see an easy way to fix this. 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_static_tracepoint_markers_by_strid. * target.h (struct target_ops) : Use TARGET_DEFAULT_NORETURN. convert to_traceframe_info 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_traceframe_info. (return_null): Remove. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. convert to_use_agent 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_use_agent. * target.h (struct target_ops) : Use TARGET_DEFAULT_NORETURN. convert to_can_use_agent 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_can_use_agent. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. convert to_augmented_libraries_svr4_read 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_augmented_libraries_svr4_read. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. convert to_supports_evaluation_of_breakpoint_conditions 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_supports_evaluation_of_breakpoint_conditions. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. convert to_can_run_breakpoint_commands 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_can_run_breakpoint_commands. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. convert to_stop 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (update_current_target): Don't inherit or default to_stop. * target.h (struct target_ops) : Use TARGET_DEFAULT_IGNORE. convert to_fetch_registers 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (target_fetch_registers): Unconditionally delegate. * target.h (struct target_ops) : Use TARGET_DEFAULT_NORETURN. convert to_ranged_break_num_registers 2014-02-06 Tom Tromey * target-delegates.c: Rebuild. * target.c (target_ranged_break_num_registers): Unconditionally delegate. * target.h (struct target_ops) : Use TARGET_DEFAULT_RETURN. --- gdb/ChangeLog | 82 +++++++++++++++++++++++++ gdb/target-delegates.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++ gdb/target.c | 73 ++++------------------- gdb/target.h | 31 ++++++---- 4 files changed, 273 insertions(+), 71 deletions(-) diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 968d2fd..98d3f17 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -61,6 +61,18 @@ tdefault_wait (struct target_ops *self, ptid_t arg1, struct target_waitstatus *a } static void +delegate_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2) +{ + self = self->beneath; + self->to_fetch_registers (self, arg1, arg2); +} + +static void +tdefault_fetch_registers (struct target_ops *self, struct regcache *arg1, int arg2) +{ +} + +static void delegate_store_registers (struct target_ops *self, struct regcache *arg1, int arg2) { self = self->beneath; @@ -126,6 +138,19 @@ tdefault_can_use_hw_breakpoint (struct target_ops *self, int arg1, int arg2, int } static int +delegate_ranged_break_num_registers (struct target_ops *self) +{ + self = self->beneath; + return self->to_ranged_break_num_registers (self); +} + +static int +tdefault_ranged_break_num_registers (struct target_ops *self) +{ + return -1; +} + +static int delegate_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *arg1, struct bp_target_info *arg2) { self = self->beneath; @@ -453,6 +478,18 @@ tdefault_thread_name (struct target_ops *self, struct thread_info *arg1) } static void +delegate_stop (struct target_ops *self, ptid_t arg1) +{ + self = self->beneath; + self->to_stop (self, arg1); +} + +static void +tdefault_stop (struct target_ops *self, ptid_t arg1) +{ +} + +static void delegate_rcmd (struct target_ops *self, char *arg1, struct ui_file *arg2) { self = self->beneath; @@ -630,6 +667,32 @@ tdefault_supports_string_tracing (struct target_ops *self) return 0; } +static int +delegate_supports_evaluation_of_breakpoint_conditions (struct target_ops *self) +{ + self = self->beneath; + return self->to_supports_evaluation_of_breakpoint_conditions (self); +} + +static int +tdefault_supports_evaluation_of_breakpoint_conditions (struct target_ops *self) +{ + return 0; +} + +static int +delegate_can_run_breakpoint_commands (struct target_ops *self) +{ + self = self->beneath; + return self->to_can_run_breakpoint_commands (self); +} + +static int +tdefault_can_run_breakpoint_commands (struct target_ops *self) +{ + return 0; +} + static struct gdbarch * delegate_thread_architecture (struct target_ops *self, ptid_t arg1) { @@ -958,6 +1021,58 @@ tdefault_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR arg1, s return 0; } +static VEC(static_tracepoint_marker_p) * +delegate_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1) +{ + self = self->beneath; + return self->to_static_tracepoint_markers_by_strid (self, arg1); +} + +static VEC(static_tracepoint_marker_p) * +tdefault_static_tracepoint_markers_by_strid (struct target_ops *self, const char *arg1) +{ + tcomplain (); +} + +static struct traceframe_info * +delegate_traceframe_info (struct target_ops *self) +{ + self = self->beneath; + return self->to_traceframe_info (self); +} + +static struct traceframe_info * +tdefault_traceframe_info (struct target_ops *self) +{ + return 0; +} + +static int +delegate_use_agent (struct target_ops *self, int arg1) +{ + self = self->beneath; + return self->to_use_agent (self, arg1); +} + +static int +tdefault_use_agent (struct target_ops *self, int arg1) +{ + tcomplain (); +} + +static int +delegate_can_use_agent (struct target_ops *self) +{ + self = self->beneath; + return self->to_can_use_agent (self); +} + +static int +tdefault_can_use_agent (struct target_ops *self) +{ + return 0; +} + static int delegate_supports_btrace (struct target_ops *self) { @@ -971,6 +1086,19 @@ tdefault_supports_btrace (struct target_ops *self) return 0; } +static int +delegate_augmented_libraries_svr4_read (struct target_ops *self) +{ + self = self->beneath; + return self->to_augmented_libraries_svr4_read (self); +} + +static int +tdefault_augmented_libraries_svr4_read (struct target_ops *self) +{ + return 0; +} + static void install_delegators (struct target_ops *ops) { @@ -984,6 +1112,8 @@ install_delegators (struct target_ops *ops) ops->to_resume = delegate_resume; if (ops->to_wait == NULL) ops->to_wait = delegate_wait; + if (ops->to_fetch_registers == NULL) + ops->to_fetch_registers = delegate_fetch_registers; if (ops->to_store_registers == NULL) ops->to_store_registers = delegate_store_registers; if (ops->to_prepare_to_store == NULL) @@ -996,6 +1126,8 @@ install_delegators (struct target_ops *ops) ops->to_remove_breakpoint = delegate_remove_breakpoint; if (ops->to_can_use_hw_breakpoint == NULL) ops->to_can_use_hw_breakpoint = delegate_can_use_hw_breakpoint; + if (ops->to_ranged_break_num_registers == NULL) + ops->to_ranged_break_num_registers = delegate_ranged_break_num_registers; if (ops->to_insert_hw_breakpoint == NULL) ops->to_insert_hw_breakpoint = delegate_insert_hw_breakpoint; if (ops->to_remove_hw_breakpoint == NULL) @@ -1050,6 +1182,8 @@ install_delegators (struct target_ops *ops) ops->to_extra_thread_info = delegate_extra_thread_info; if (ops->to_thread_name == NULL) ops->to_thread_name = delegate_thread_name; + if (ops->to_stop == NULL) + ops->to_stop = delegate_stop; if (ops->to_rcmd == NULL) ops->to_rcmd = delegate_rcmd; if (ops->to_pid_to_exec_file == NULL) @@ -1084,6 +1218,10 @@ install_delegators (struct target_ops *ops) ops->to_supports_enable_disable_tracepoint = delegate_supports_enable_disable_tracepoint; if (ops->to_supports_string_tracing == NULL) ops->to_supports_string_tracing = delegate_supports_string_tracing; + if (ops->to_supports_evaluation_of_breakpoint_conditions == NULL) + ops->to_supports_evaluation_of_breakpoint_conditions = delegate_supports_evaluation_of_breakpoint_conditions; + if (ops->to_can_run_breakpoint_commands == NULL) + ops->to_can_run_breakpoint_commands = delegate_can_run_breakpoint_commands; if (ops->to_thread_architecture == NULL) ops->to_thread_architecture = delegate_thread_architecture; if (ops->to_trace_init == NULL) @@ -1136,8 +1274,18 @@ install_delegators (struct target_ops *ops) ops->to_set_permissions = delegate_set_permissions; if (ops->to_static_tracepoint_marker_at == NULL) ops->to_static_tracepoint_marker_at = delegate_static_tracepoint_marker_at; + if (ops->to_static_tracepoint_markers_by_strid == NULL) + ops->to_static_tracepoint_markers_by_strid = delegate_static_tracepoint_markers_by_strid; + if (ops->to_traceframe_info == NULL) + ops->to_traceframe_info = delegate_traceframe_info; + if (ops->to_use_agent == NULL) + ops->to_use_agent = delegate_use_agent; + if (ops->to_can_use_agent == NULL) + ops->to_can_use_agent = delegate_can_use_agent; if (ops->to_supports_btrace == NULL) ops->to_supports_btrace = delegate_supports_btrace; + if (ops->to_augmented_libraries_svr4_read == NULL) + ops->to_augmented_libraries_svr4_read = delegate_augmented_libraries_svr4_read; } static void @@ -1148,12 +1296,14 @@ install_dummy_methods (struct target_ops *ops) ops->to_detach = tdefault_detach; ops->to_resume = tdefault_resume; ops->to_wait = tdefault_wait; + ops->to_fetch_registers = tdefault_fetch_registers; ops->to_store_registers = tdefault_store_registers; ops->to_prepare_to_store = tdefault_prepare_to_store; ops->to_files_info = tdefault_files_info; ops->to_insert_breakpoint = memory_insert_breakpoint; ops->to_remove_breakpoint = memory_remove_breakpoint; ops->to_can_use_hw_breakpoint = tdefault_can_use_hw_breakpoint; + ops->to_ranged_break_num_registers = tdefault_ranged_break_num_registers; ops->to_insert_hw_breakpoint = tdefault_insert_hw_breakpoint; ops->to_remove_hw_breakpoint = tdefault_remove_hw_breakpoint; ops->to_remove_watchpoint = tdefault_remove_watchpoint; @@ -1181,6 +1331,7 @@ install_dummy_methods (struct target_ops *ops) ops->to_has_exited = tdefault_has_exited; ops->to_extra_thread_info = tdefault_extra_thread_info; ops->to_thread_name = tdefault_thread_name; + ops->to_stop = tdefault_stop; ops->to_rcmd = default_rcmd; ops->to_pid_to_exec_file = tdefault_pid_to_exec_file; ops->to_log_command = tdefault_log_command; @@ -1198,6 +1349,8 @@ install_dummy_methods (struct target_ops *ops) ops->to_supports_multi_process = tdefault_supports_multi_process; ops->to_supports_enable_disable_tracepoint = tdefault_supports_enable_disable_tracepoint; ops->to_supports_string_tracing = tdefault_supports_string_tracing; + ops->to_supports_evaluation_of_breakpoint_conditions = tdefault_supports_evaluation_of_breakpoint_conditions; + ops->to_can_run_breakpoint_commands = tdefault_can_run_breakpoint_commands; ops->to_thread_architecture = default_thread_architecture; ops->to_trace_init = tdefault_trace_init; ops->to_download_tracepoint = tdefault_download_tracepoint; @@ -1224,5 +1377,10 @@ install_dummy_methods (struct target_ops *ops) ops->to_get_tib_address = tdefault_get_tib_address; ops->to_set_permissions = tdefault_set_permissions; ops->to_static_tracepoint_marker_at = tdefault_static_tracepoint_marker_at; + ops->to_static_tracepoint_markers_by_strid = tdefault_static_tracepoint_markers_by_strid; + ops->to_traceframe_info = tdefault_traceframe_info; + ops->to_use_agent = tdefault_use_agent; + ops->to_can_use_agent = tdefault_can_use_agent; ops->to_supports_btrace = tdefault_supports_btrace; + ops->to_augmented_libraries_svr4_read = tdefault_augmented_libraries_svr4_read; } diff --git a/gdb/target.c b/gdb/target.c index 31be211..8d041b7 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -66,8 +66,6 @@ static int nomemory (CORE_ADDR, char *, int, int, struct target_ops *); static int return_zero (void); -static void *return_null (void); - void target_ignore (void); static void target_command (char *, int); @@ -657,7 +655,7 @@ update_current_target (void) /* Do not inherit to_pid_to_str. */ /* Do not inherit to_extra_thread_info. */ /* Do not inherit to_thread_name. */ - INHERIT (to_stop, t); + /* Do not inherit to_stop. */ /* Do not inherit to_xfer_partial. */ /* Do not inherit to_rcmd. */ /* Do not inherit to_pid_to_exec_file. */ @@ -711,14 +709,15 @@ update_current_target (void) /* Do not inherit to_get_tib_address. */ /* Do not inherit to_set_permissions. */ /* Do not inherit to_static_tracepoint_marker_at. */ - INHERIT (to_static_tracepoint_markers_by_strid, t); - INHERIT (to_traceframe_info, t); - INHERIT (to_use_agent, t); - INHERIT (to_can_use_agent, t); - INHERIT (to_augmented_libraries_svr4_read, t); + /* Do not inherit to_static_tracepoint_markers_by_strid. */ + /* Do not inherit to_traceframe_info. */ + /* Do not inherit to_use_agent. */ + /* Do not inherit to_can_use_agent. */ + /* Do not inherit to_augmented_libraries_svr4_read. */ INHERIT (to_magic, t); - INHERIT (to_supports_evaluation_of_breakpoint_conditions, t); - INHERIT (to_can_run_breakpoint_commands, t); + /* Do not inherit + to_supports_evaluation_of_breakpoint_conditions. */ + /* Do not inherit to_can_run_breakpoint_commands. */ /* Do not inherit to_memory_map. */ /* Do not inherit to_flash_erase. */ /* Do not inherit to_flash_done. */ @@ -746,32 +745,7 @@ update_current_target (void) de_fault (to_can_run, (int (*) (struct target_ops *)) return_zero); - de_fault (to_stop, - (void (*) (struct target_ops *, ptid_t)) - target_ignore); current_target.to_read_description = NULL; - de_fault (to_static_tracepoint_markers_by_strid, - (VEC(static_tracepoint_marker_p) * (*) (struct target_ops *, - const char *)) - tcomplain); - de_fault (to_traceframe_info, - (struct traceframe_info * (*) (struct target_ops *)) - return_null); - de_fault (to_supports_evaluation_of_breakpoint_conditions, - (int (*) (struct target_ops *)) - return_zero); - de_fault (to_can_run_breakpoint_commands, - (int (*) (struct target_ops *)) - return_zero); - de_fault (to_use_agent, - (int (*) (struct target_ops *, int)) - tcomplain); - de_fault (to_can_use_agent, - (int (*) (struct target_ops *)) - return_zero); - de_fault (to_augmented_libraries_svr4_read, - (int (*) (struct target_ops *)) - return_zero); #undef de_fault @@ -3421,12 +3395,6 @@ return_zero (void) return 0; } -static void * -return_null (void) -{ - return 0; -} - /* * Find the next target down the stack from the specified target. */ @@ -3729,18 +3697,9 @@ debug_print_register (const char * func, void target_fetch_registers (struct regcache *regcache, int regno) { - struct target_ops *t; - - for (t = current_target.beneath; t != NULL; t = t->beneath) - { - if (t->to_fetch_registers != NULL) - { - t->to_fetch_registers (t, regcache, regno); - if (targetdebug) - debug_print_register ("target_fetch_registers", regcache, regno); - return; - } - } + current_target.to_fetch_registers (¤t_target, regcache, regno); + if (targetdebug) + debug_print_register ("target_fetch_registers", regcache, regno); } void @@ -3879,13 +3838,7 @@ target_masked_watch_num_registers (CORE_ADDR addr, CORE_ADDR mask) int target_ranged_break_num_registers (void) { - struct target_ops *t; - - for (t = current_target.beneath; t != NULL; t = t->beneath) - if (t->to_ranged_break_num_registers != NULL) - return t->to_ranged_break_num_registers (t); - - return -1; + return current_target.to_ranged_break_num_registers (¤t_target); } /* See target.h. */ diff --git a/gdb/target.h b/gdb/target.h index 40b3e57..29b3b96 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -406,7 +406,8 @@ struct target_ops ptid_t (*to_wait) (struct target_ops *, ptid_t, struct target_waitstatus *, int) TARGET_DEFAULT_NORETURN (noprocess ()); - void (*to_fetch_registers) (struct target_ops *, struct regcache *, int); + void (*to_fetch_registers) (struct target_ops *, struct regcache *, int) + TARGET_DEFAULT_IGNORE (); void (*to_store_registers) (struct target_ops *, struct regcache *, int) TARGET_DEFAULT_NORETURN (noprocess ()); void (*to_prepare_to_store) (struct target_ops *, struct regcache *) @@ -448,7 +449,8 @@ struct target_ops TARGET_DEFAULT_FUNC (memory_remove_breakpoint); int (*to_can_use_hw_breakpoint) (struct target_ops *, int, int, int) TARGET_DEFAULT_RETURN (0); - int (*to_ranged_break_num_registers) (struct target_ops *); + int (*to_ranged_break_num_registers) (struct target_ops *) + TARGET_DEFAULT_RETURN (-1); int (*to_insert_hw_breakpoint) (struct target_ops *, struct gdbarch *, struct bp_target_info *) TARGET_DEFAULT_RETURN (-1); @@ -546,7 +548,8 @@ struct target_ops TARGET_DEFAULT_RETURN (0); char *(*to_thread_name) (struct target_ops *, struct thread_info *) TARGET_DEFAULT_RETURN (0); - void (*to_stop) (struct target_ops *, ptid_t); + void (*to_stop) (struct target_ops *, ptid_t) + TARGET_DEFAULT_IGNORE (); void (*to_rcmd) (struct target_ops *, char *command, struct ui_file *output) TARGET_DEFAULT_FUNC (default_rcmd); @@ -717,11 +720,13 @@ struct target_ops /* Does this target support evaluation of breakpoint conditions on its end? */ - int (*to_supports_evaluation_of_breakpoint_conditions) (struct target_ops *); + int (*to_supports_evaluation_of_breakpoint_conditions) (struct target_ops *) + TARGET_DEFAULT_RETURN (0); /* Does this target support evaluation of breakpoint commands on its end? */ - int (*to_can_run_breakpoint_commands) (struct target_ops *); + int (*to_can_run_breakpoint_commands) (struct target_ops *) + TARGET_DEFAULT_RETURN (0); /* Determine current architecture of thread PTID. @@ -929,8 +934,8 @@ struct target_ops /* Return a vector of all tracepoints markers string id ID, or all markers if ID is NULL. */ - VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid) - (struct target_ops *, const char *id); + VEC(static_tracepoint_marker_p) *(*to_static_tracepoint_markers_by_strid) (struct target_ops *, const char *id) + TARGET_DEFAULT_NORETURN (tcomplain ()); /* Return a traceframe info object describing the current traceframe's contents. If the target doesn't support @@ -945,14 +950,17 @@ struct target_ops is available in the read-only sections. This method should not cache data; higher layers take care of caching, invalidating, and re-fetching when necessary. */ - struct traceframe_info *(*to_traceframe_info) (struct target_ops *); + struct traceframe_info *(*to_traceframe_info) (struct target_ops *) + TARGET_DEFAULT_RETURN (0); /* Ask the target to use or not to use agent according to USE. Return 1 successful, 0 otherwise. */ - int (*to_use_agent) (struct target_ops *, int use); + int (*to_use_agent) (struct target_ops *, int use) + TARGET_DEFAULT_NORETURN (tcomplain ()); /* Is the target able to use agent in current state? */ - int (*to_can_use_agent) (struct target_ops *); + int (*to_can_use_agent) (struct target_ops *) + TARGET_DEFAULT_RETURN (0); /* Check whether the target supports branch tracing. */ int (*to_supports_btrace) (struct target_ops *) @@ -1044,7 +1052,8 @@ struct target_ops /* Nonzero if TARGET_OBJECT_LIBRARIES_SVR4 may be read with a non-empty annex. */ - int (*to_augmented_libraries_svr4_read) (struct target_ops *); + int (*to_augmented_libraries_svr4_read) (struct target_ops *) + TARGET_DEFAULT_RETURN (0); /* Those unwinders are tried before any other arch unwinders. Use NULL if it is not used. */ -- 1.8.1.4