From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25114 invoked by alias); 13 Jan 2014 19:23:42 -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 25042 invoked by uid 89); 13 Jan 2014 19:23:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 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; Mon, 13 Jan 2014 19:23:39 +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 s0DJD5Xv031882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 13 Jan 2014 14:13:05 -0500 Received: from barimba.redhat.com (ovpn-113-85.phx2.redhat.com [10.3.113.85]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s0DJCptN016701; Mon, 13 Jan 2014 14:13:04 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFC 17/32] Add target_ops argument to to_static_tracepoint_markers_by_strid Date: Mon, 13 Jan 2014 19:23:00 -0000 Message-Id: <1389640367-5571-18-git-send-email-tromey@redhat.com> In-Reply-To: <1389640367-5571-1-git-send-email-tromey@redhat.com> References: <1389640367-5571-1-git-send-email-tromey@redhat.com> X-SW-Source: 2014-01/txt/msg00351.txt.bz2 2014-01-08 Tom Tromey * target.h (target_static_tracepoint_markers_by_strid): Add argument. (struct target_ops) : Add 'self' argument. * target.c (update_current_target): Update. * remote.c (struct target_ops) : Add 'self' argument. * linux-nat.c (struct target_ops) : Add 'self' argument. Add target_ops argument to to_traceframe_info 2014-01-08 Tom Tromey * tracepoint.c (tfile_traceframe_info): Add 'self' argument. * target.h (struct target_ops) : Add argument. (target_traceframe_info): Add argument. * target.c (update_current_target): Update. * remote.c (remote_traceframe_info): Add 'self' argument. * ctf.c (ctf_traceframe_info): Add 'self' argument. Add target_ops argument to to_use_agent 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_use_agent): Add argument. * target.c (update_current_target): Update. * remote.c (remote_use_agent): Add 'self' argument. * inf-child.c (inf_child_use_agent): Add 'self' argument. Add target_ops argument to to_can_use_agent 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. (target_can_use_agent): Add argument. * target.c (update_current_target): Update. * remote.c (remote_can_use_agent): Add 'self' argument. * inf-child.c (inf_child_can_use_agent): Add 'self' argument. Add target_ops argument to to_enable_btrace 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_enable_btrace): Add argument. * remote.c (remote_enable_btrace): Add 'self' argument. * i386-linux-nat.c (i386_linux_enable_btrace): Add 'self' argument. * amd64-linux-nat.c (amd64_linux_enable_btrace): Add 'self' argument. Add target_ops argument to to_disable_btrace 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_disable_btrace): Add argument. * remote.c (remote_disable_btrace): Add 'self' argument. * i386-linux-nat.c (i386_linux_disable_btrace): Add 'self' argument. * amd64-linux-nat.c (amd64_linux_disable_btrace): Add 'self' argument. Add target_ops argument to to_teardown_btrace 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_teardown_btrace): Add argument. * remote.c (remote_teardown_btrace): Add 'self' argument. * i386-linux-nat.c (i386_linux_teardown_btrace): Add 'self' argument. * amd64-linux-nat.c (amd64_linux_teardown_btrace): Add 'self' argument. Add target_ops argument to to_read_btrace 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (struct target_ops) : Add argument. * remote.c (struct target_ops) : Add 'self' argument. * amd64-linux-nat.c (amd64_linux_read_btrace): New function. (_initialize_amd64_linux_nat): Use it. * i386-linux-nat.c (i386_linux_read_btrace): New function. (_initialize_i386_linux_nat): Use it. Add target_ops argument to to_stop_recording 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_stop_recording): Add argument. * record.c (record_stop): Add argument. * record-btrace.c (record_btrace_stop_recording): Add 'self' argument. Add target_ops argument to to_info_record 2014-01-08 Tom Tromey * target.h (struct target_ops) : Add argument. * target.c (target_info_record): Add argument. * record.c (info_record_command): Add argument. * record-full.c (record_full_info): Add 'self' argument. * record-btrace.c (record_btrace_info): Add 'self' argument. --- gdb/ChangeLog | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++ gdb/amd64-linux-nat.c | 18 +++++++--- gdb/ctf.c | 2 +- gdb/i386-linux-nat.c | 18 +++++++--- gdb/inf-child.c | 4 +-- gdb/linux-nat.c | 3 +- gdb/record-btrace.c | 4 +-- gdb/record-full.c | 2 +- gdb/record.c | 4 +-- gdb/remote.c | 19 ++++++----- gdb/target.c | 21 ++++++------ gdb/target.h | 33 ++++++++++-------- gdb/tracepoint.c | 2 +- 13 files changed, 174 insertions(+), 50 deletions(-) diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c index 237e936..cbec370 100644 --- a/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c @@ -1150,7 +1150,7 @@ amd64_linux_read_description (struct target_ops *ops) /* Enable branch tracing. */ static struct btrace_target_info * -amd64_linux_enable_btrace (ptid_t ptid) +amd64_linux_enable_btrace (struct target_ops *self, ptid_t ptid) { struct btrace_target_info *tinfo; struct gdbarch *gdbarch; @@ -1172,7 +1172,8 @@ amd64_linux_enable_btrace (ptid_t ptid) /* Disable branch tracing. */ static void -amd64_linux_disable_btrace (struct btrace_target_info *tinfo) +amd64_linux_disable_btrace (struct target_ops *self, + struct btrace_target_info *tinfo) { int errcode = linux_disable_btrace (tinfo); @@ -1183,12 +1184,21 @@ amd64_linux_disable_btrace (struct btrace_target_info *tinfo) /* Teardown branch tracing. */ static void -amd64_linux_teardown_btrace (struct btrace_target_info *tinfo) +amd64_linux_teardown_btrace (struct target_ops *self, + struct btrace_target_info *tinfo) { /* Ignore errors. */ linux_disable_btrace (tinfo); } +static VEC (btrace_block_s) * +amd64_linux_read_btrace (struct target_ops *self, + struct btrace_target_info *tinfo, + enum btrace_read_type type) +{ + return linux_read_btrace (tinfo, type); +} + /* Provide a prototype to silence -Wmissing-prototypes. */ void _initialize_amd64_linux_nat (void); @@ -1232,7 +1242,7 @@ _initialize_amd64_linux_nat (void) t->to_enable_btrace = amd64_linux_enable_btrace; t->to_disable_btrace = amd64_linux_disable_btrace; t->to_teardown_btrace = amd64_linux_teardown_btrace; - t->to_read_btrace = linux_read_btrace; + t->to_read_btrace = amd64_linux_read_btrace; /* Register the target. */ linux_nat_add_target (t); diff --git a/gdb/ctf.c b/gdb/ctf.c index db6032b..c41959b 100644 --- a/gdb/ctf.c +++ b/gdb/ctf.c @@ -1732,7 +1732,7 @@ ctf_has_registers (struct target_ops *ops) traceframe_info. */ static struct traceframe_info * -ctf_traceframe_info (void) +ctf_traceframe_info (struct target_ops *self) { struct traceframe_info *info = XCNEW (struct traceframe_info); const char *name; diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c index f886b39e..01d7f71 100644 --- a/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c @@ -1061,7 +1061,7 @@ i386_linux_read_description (struct target_ops *ops) /* Enable branch tracing. */ static struct btrace_target_info * -i386_linux_enable_btrace (ptid_t ptid) +i386_linux_enable_btrace (struct target_ops *self, ptid_t ptid) { struct btrace_target_info *tinfo; struct gdbarch *gdbarch; @@ -1083,7 +1083,8 @@ i386_linux_enable_btrace (ptid_t ptid) /* Disable branch tracing. */ static void -i386_linux_disable_btrace (struct btrace_target_info *tinfo) +i386_linux_disable_btrace (struct target_ops *self, + struct btrace_target_info *tinfo) { int errcode = linux_disable_btrace (tinfo); @@ -1094,12 +1095,21 @@ i386_linux_disable_btrace (struct btrace_target_info *tinfo) /* Teardown branch tracing. */ static void -i386_linux_teardown_btrace (struct btrace_target_info *tinfo) +i386_linux_teardown_btrace (struct target_ops *self, + struct btrace_target_info *tinfo) { /* Ignore errors. */ linux_disable_btrace (tinfo); } +static VEC (btrace_block_s) * +i386_linux_read_btrace (struct target_ops *self, + struct btrace_target_info *tinfo, + enum btrace_read_type type) +{ + return linux_read_btrace (tinfo, type); +} + /* -Wmissing-prototypes */ extern initialize_file_ftype _initialize_i386_linux_nat; @@ -1138,7 +1148,7 @@ _initialize_i386_linux_nat (void) t->to_enable_btrace = i386_linux_enable_btrace; t->to_disable_btrace = i386_linux_disable_btrace; t->to_teardown_btrace = i386_linux_teardown_btrace; - t->to_read_btrace = linux_read_btrace; + t->to_read_btrace = i386_linux_read_btrace; /* Register the target. */ linux_nat_add_target (t); diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 061a46a..af3f105 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -372,7 +372,7 @@ inf_child_fileio_readlink (struct target_ops *self, } static int -inf_child_use_agent (int use) +inf_child_use_agent (struct target_ops *self, int use) { if (agent_loaded_p ()) { @@ -384,7 +384,7 @@ inf_child_use_agent (int use) } static int -inf_child_can_use_agent (void) +inf_child_can_use_agent (struct target_ops *self) { return agent_loaded_p (); } diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 8dfeb40..3cfd4e7 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -4397,7 +4397,8 @@ cleanup_target_stop (void *arg) } static VEC(static_tracepoint_marker_p) * -linux_child_static_tracepoint_markers_by_strid (const char *strid) +linux_child_static_tracepoint_markers_by_strid (struct target_ops *self, + const char *strid) { char s[IPA_CMD_BUF_SIZE]; struct cleanup *old_chain; diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index d1f36c9..c99e7c2 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -174,7 +174,7 @@ record_btrace_open (char *args, int from_tty) /* The to_stop_recording method of target record-btrace. */ static void -record_btrace_stop_recording (void) +record_btrace_stop_recording (struct target_ops *self) { struct thread_info *tp; @@ -202,7 +202,7 @@ record_btrace_close (struct target_ops *self) /* The to_info_record method of target record-btrace. */ static void -record_btrace_info (void) +record_btrace_info (struct target_ops *self) { struct btrace_thread_info *btinfo; struct thread_info *tp; diff --git a/gdb/record-full.c b/gdb/record-full.c index 3b251c6..8769795 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -1746,7 +1746,7 @@ record_full_execution_direction (struct target_ops *self) } static void -record_full_info (void) +record_full_info (struct target_ops *self) { struct record_full_entry *p; diff --git a/gdb/record.c b/gdb/record.c index 0fd8756..77b1ce5 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -104,7 +104,7 @@ record_stop (struct target_ops *t) DEBUG ("stop %s", t->to_shortname); if (t->to_stop_recording != NULL) - t->to_stop_recording (); + t->to_stop_recording (t); } /* Unpush the record target. */ @@ -276,7 +276,7 @@ info_record_command (char *args, int from_tty) printf_filtered (_("Active record target: %s\n"), t->to_shortname); if (t->to_info_record != NULL) - t->to_info_record (); + t->to_info_record (t); } /* The "record save" command. */ diff --git a/gdb/remote.c b/gdb/remote.c index c7cb2d3..5721178 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2974,7 +2974,8 @@ remote_static_tracepoint_marker_at (struct target_ops *self, CORE_ADDR addr, } static VEC(static_tracepoint_marker_p) * -remote_static_tracepoint_markers_by_strid (const char *strid) +remote_static_tracepoint_markers_by_strid (struct target_ops *self, + const char *strid) { struct remote_state *rs = get_remote_state (); VEC(static_tracepoint_marker_p) *markers = NULL; @@ -11188,7 +11189,7 @@ remote_set_circular_trace_buffer (struct target_ops *self, int val) } static struct traceframe_info * -remote_traceframe_info (void) +remote_traceframe_info (struct target_ops *self) { char *text; @@ -11326,7 +11327,7 @@ remote_set_trace_notes (struct target_ops *self, } static int -remote_use_agent (int use) +remote_use_agent (struct target_ops *self, int use) { if (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE) { @@ -11348,7 +11349,7 @@ remote_use_agent (int use) } static int -remote_can_use_agent (void) +remote_can_use_agent (struct target_ops *self) { return (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE); } @@ -11377,7 +11378,7 @@ remote_supports_btrace (struct target_ops *self) /* Enable branch tracing. */ static struct btrace_target_info * -remote_enable_btrace (ptid_t ptid) +remote_enable_btrace (struct target_ops *self, ptid_t ptid) { struct btrace_target_info *tinfo = NULL; struct packet_config *packet = &remote_protocol_packets[PACKET_Qbtrace_bts]; @@ -11413,7 +11414,8 @@ remote_enable_btrace (ptid_t ptid) /* Disable branch tracing. */ static void -remote_disable_btrace (struct btrace_target_info *tinfo) +remote_disable_btrace (struct target_ops *self, + struct btrace_target_info *tinfo) { struct packet_config *packet = &remote_protocol_packets[PACKET_Qbtrace_off]; struct remote_state *rs = get_remote_state (); @@ -11445,7 +11447,8 @@ remote_disable_btrace (struct btrace_target_info *tinfo) /* Teardown branch tracing. */ static void -remote_teardown_btrace (struct btrace_target_info *tinfo) +remote_teardown_btrace (struct target_ops *self, + struct btrace_target_info *tinfo) { /* We must not talk to the target during teardown. */ xfree (tinfo); @@ -11454,7 +11457,7 @@ remote_teardown_btrace (struct btrace_target_info *tinfo) /* Read the branch trace. */ static VEC (btrace_block_s) * -remote_read_btrace (struct btrace_target_info *tinfo, +remote_read_btrace (struct target_ops *self, struct btrace_target_info *tinfo, enum btrace_read_type type) { struct packet_config *packet = &remote_protocol_packets[PACKET_qXfer_btrace]; diff --git a/gdb/target.c b/gdb/target.c index 35ce7e8..4a698fe 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -924,10 +924,11 @@ update_current_target (void) CORE_ADDR, struct static_tracepoint_marker *)) return_zero); de_fault (to_static_tracepoint_markers_by_strid, - (VEC(static_tracepoint_marker_p) * (*) (const char *)) + (VEC(static_tracepoint_marker_p) * (*) (struct target_ops *, + const char *)) tcomplain); de_fault (to_traceframe_info, - (struct traceframe_info * (*) (void)) + (struct traceframe_info * (*) (struct target_ops *)) return_zero); de_fault (to_supports_evaluation_of_breakpoint_conditions, (int (*) (struct target_ops *)) @@ -936,10 +937,10 @@ update_current_target (void) (int (*) (struct target_ops *)) return_zero); de_fault (to_use_agent, - (int (*) (int)) + (int (*) (struct target_ops *, int)) tcomplain); de_fault (to_can_use_agent, - (int (*) (void)) + (int (*) (struct target_ops *)) return_zero); de_fault (to_augmented_libraries_svr4_read, (int (*) (void)) @@ -4119,7 +4120,7 @@ target_enable_btrace (ptid_t ptid) for (t = current_target.beneath; t != NULL; t = t->beneath) if (t->to_enable_btrace != NULL) - return t->to_enable_btrace (ptid); + return t->to_enable_btrace (t, ptid); tcomplain (); return NULL; @@ -4135,7 +4136,7 @@ target_disable_btrace (struct btrace_target_info *btinfo) for (t = current_target.beneath; t != NULL; t = t->beneath) if (t->to_disable_btrace != NULL) { - t->to_disable_btrace (btinfo); + t->to_disable_btrace (t, btinfo); return; } @@ -4152,7 +4153,7 @@ target_teardown_btrace (struct btrace_target_info *btinfo) for (t = current_target.beneath; t != NULL; t = t->beneath) if (t->to_teardown_btrace != NULL) { - t->to_teardown_btrace (btinfo); + t->to_teardown_btrace (t, btinfo); return; } @@ -4169,7 +4170,7 @@ target_read_btrace (struct btrace_target_info *btinfo, for (t = current_target.beneath; t != NULL; t = t->beneath) if (t->to_read_btrace != NULL) - return t->to_read_btrace (btinfo, type); + return t->to_read_btrace (t, btinfo, type); tcomplain (); return NULL; @@ -4185,7 +4186,7 @@ target_stop_recording (void) for (t = current_target.beneath; t != NULL; t = t->beneath) if (t->to_stop_recording != NULL) { - t->to_stop_recording (); + t->to_stop_recording (t); return; } @@ -4202,7 +4203,7 @@ target_info_record (void) for (t = current_target.beneath; t != NULL; t = t->beneath) if (t->to_info_record != NULL) { - t->to_info_record (); + t->to_info_record (t); return; } diff --git a/gdb/target.h b/gdb/target.h index 2a17b02..ca70a9e 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -855,7 +855,7 @@ 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) - (const char *id); + (struct target_ops *, const char *id); /* Return a traceframe info object describing the current traceframe's contents. If the target doesn't support @@ -870,14 +870,14 @@ 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) (void); + struct traceframe_info *(*to_traceframe_info) (struct target_ops *); /* Ask the target to use or not to use agent according to USE. Return 1 successful, 0 otherwise. */ - int (*to_use_agent) (int use); + int (*to_use_agent) (struct target_ops *, int use); /* Is the target able to use agent in current state? */ - int (*to_can_use_agent) (void); + int (*to_can_use_agent) (struct target_ops *); /* Check whether the target supports branch tracing. */ int (*to_supports_btrace) (struct target_ops *) @@ -885,26 +885,30 @@ struct target_ops /* Enable branch tracing for PTID and allocate a branch trace target information struct for reading and for disabling branch trace. */ - struct btrace_target_info *(*to_enable_btrace) (ptid_t ptid); + struct btrace_target_info *(*to_enable_btrace) (struct target_ops *, + ptid_t ptid); /* Disable branch tracing and deallocate TINFO. */ - void (*to_disable_btrace) (struct btrace_target_info *tinfo); + void (*to_disable_btrace) (struct target_ops *, + struct btrace_target_info *tinfo); /* Disable branch tracing and deallocate TINFO. This function is similar to to_disable_btrace, except that it is called during teardown and is only allowed to perform actions that are safe. A counter-example would be attempting to talk to a remote target. */ - void (*to_teardown_btrace) (struct btrace_target_info *tinfo); + void (*to_teardown_btrace) (struct target_ops *, + struct btrace_target_info *tinfo); /* Read branch trace data. */ - VEC (btrace_block_s) *(*to_read_btrace) (struct btrace_target_info *, + VEC (btrace_block_s) *(*to_read_btrace) (struct target_ops *, + struct btrace_target_info *, enum btrace_read_type); /* Stop trace recording. */ - void (*to_stop_recording) (void); + void (*to_stop_recording) (struct target_ops *); /* Print information about the recording. */ - void (*to_info_record) (void); + void (*to_info_record) (struct target_ops *); /* Save the recorded execution trace into a file. */ void (*to_save_record) (const char *filename); @@ -1832,16 +1836,17 @@ extern char *target_fileio_read_stralloc (const char *filename); addr, marker) #define target_static_tracepoint_markers_by_strid(marker_id) \ - (*current_target.to_static_tracepoint_markers_by_strid) (marker_id) + (*current_target.to_static_tracepoint_markers_by_strid) (¤t_target, \ + marker_id) #define target_traceframe_info() \ - (*current_target.to_traceframe_info) () + (*current_target.to_traceframe_info) (¤t_target) #define target_use_agent(use) \ - (*current_target.to_use_agent) (use) + (*current_target.to_use_agent) (¤t_target, use) #define target_can_use_agent() \ - (*current_target.to_can_use_agent) () + (*current_target.to_can_use_agent) (¤t_target) #define target_augmented_libraries_svr4_read() \ (*current_target.to_augmented_libraries_svr4_read) () diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 0fde73c..96b8a89 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -5299,7 +5299,7 @@ build_traceframe_info (char blocktype, void *data) } static struct traceframe_info * -tfile_traceframe_info (void) +tfile_traceframe_info (struct target_ops *self) { struct traceframe_info *info = XCNEW (struct traceframe_info); -- 1.8.1.4