From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2012 invoked by alias); 17 Feb 2015 01:14:56 -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 1998 invoked by uid 89); 17 Feb 2015 01:14:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,LIKELY_SPAM_BODY,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=no 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 17 Feb 2015 01:14:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t1H1EktF006077 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Feb 2015 20:14:46 -0500 Received: from localhost (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1H1EjHt010474 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Mon, 16 Feb 2015 20:14:45 -0500 From: Sergio Durigan Junior To: "Jose E. Marchesi" Cc: gdb-patches@sourceware.org Subject: Re: [PATCH V4 4/9] New gdbarch functions: dtrace_parse_probe_argument, dtrace_probe_is_enabled, dtrace_enable_probe, dtrace_disable_probe. References: <1422874968-382-1-git-send-email-jose.marchesi@oracle.com> <1422874968-382-5-git-send-email-jose.marchesi@oracle.com> X-URL: http://blog.sergiodj.net Date: Tue, 17 Feb 2015 01:14:00 -0000 In-Reply-To: <1422874968-382-5-git-send-email-jose.marchesi@oracle.com> (Jose E. Marchesi's message of "Mon, 2 Feb 2015 12:02:43 +0100") Message-ID: <87vbj1730a.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00376.txt.bz2 On Monday, February 02 2015, Jose E. Marchesi wrote: > This patch adds several gdbarch functions (along with the corresponding > predicates): `dtrace_parse_probe_argument', `dtrace_probe_is_enabled', > `dtrace_enable_probe' and `dtrace_disable_probe'. These functions will > be implemented by target-specific code, and called from the DTrace > probes implementation in order to calculate the value of probe > arguments, and manipulate is-enabled probes. This was already approved. OK. > gdb/ChangeLog: > > 2015-02-02 Jose E. Marchesi > > * gdbarch.sh (dtrace_parse_probe_argument): New. > (dtrace_probe_is_enabled): Likewise. > (dtrace_enable_probe): Likewise. > (dtrace_disable_probe): Likewise. > * gdbarch.c: Regenerate. > * gdbarch.h: Regenerate. > --- > gdb/ChangeLog | 9 ++++ > gdb/gdbarch.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > gdb/gdbarch.h | 36 ++++++++++++++++ > gdb/gdbarch.sh | 16 +++++++ > 4 files changed, 189 insertions(+) > > diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c > index b35da35..aa1a369 100644 > --- a/gdb/gdbarch.c > +++ b/gdb/gdbarch.c > @@ -303,6 +303,10 @@ struct gdbarch > const char * stap_gdb_register_suffix; > gdbarch_stap_is_single_operand_ftype *stap_is_single_operand; > gdbarch_stap_parse_special_token_ftype *stap_parse_special_token; > + gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument; > + gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled; > + gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe; > + gdbarch_dtrace_disable_probe_ftype *dtrace_disable_probe; > int has_global_solist; > int has_global_breakpoints; > gdbarch_has_shared_address_space_ftype *has_shared_address_space; > @@ -632,6 +636,10 @@ verify_gdbarch (struct gdbarch *gdbarch) > /* Skip verify of stap_gdb_register_suffix, invalid_p == 0 */ > /* Skip verify of stap_is_single_operand, has predicate. */ > /* Skip verify of stap_parse_special_token, has predicate. */ > + /* Skip verify of dtrace_parse_probe_argument, has predicate. */ > + /* Skip verify of dtrace_probe_is_enabled, has predicate. */ > + /* Skip verify of dtrace_enable_probe, has predicate. */ > + /* Skip verify of dtrace_disable_probe, has predicate. */ > /* Skip verify of has_global_solist, invalid_p == 0 */ > /* Skip verify of has_global_breakpoints, invalid_p == 0 */ > /* Skip verify of has_shared_address_space, invalid_p == 0 */ > @@ -847,6 +855,30 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) > "gdbarch_dump: double_format = %s\n", > pformat (gdbarch->double_format)); > fprintf_unfiltered (file, > + "gdbarch_dump: gdbarch_dtrace_disable_probe_p() = %d\n", > + gdbarch_dtrace_disable_probe_p (gdbarch)); > + fprintf_unfiltered (file, > + "gdbarch_dump: dtrace_disable_probe = <%s>\n", > + host_address_to_string (gdbarch->dtrace_disable_probe)); > + fprintf_unfiltered (file, > + "gdbarch_dump: gdbarch_dtrace_enable_probe_p() = %d\n", > + gdbarch_dtrace_enable_probe_p (gdbarch)); > + fprintf_unfiltered (file, > + "gdbarch_dump: dtrace_enable_probe = <%s>\n", > + host_address_to_string (gdbarch->dtrace_enable_probe)); > + fprintf_unfiltered (file, > + "gdbarch_dump: gdbarch_dtrace_parse_probe_argument_p() = %d\n", > + gdbarch_dtrace_parse_probe_argument_p (gdbarch)); > + fprintf_unfiltered (file, > + "gdbarch_dump: dtrace_parse_probe_argument = <%s>\n", > + host_address_to_string (gdbarch->dtrace_parse_probe_argument)); > + fprintf_unfiltered (file, > + "gdbarch_dump: gdbarch_dtrace_probe_is_enabled_p() = %d\n", > + gdbarch_dtrace_probe_is_enabled_p (gdbarch)); > + fprintf_unfiltered (file, > + "gdbarch_dump: dtrace_probe_is_enabled = <%s>\n", > + host_address_to_string (gdbarch->dtrace_probe_is_enabled)); > + fprintf_unfiltered (file, > "gdbarch_dump: gdbarch_dummy_id_p() = %d\n", > gdbarch_dummy_id_p (gdbarch)); > fprintf_unfiltered (file, > @@ -4203,6 +4235,102 @@ set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, > } > > int > +gdbarch_dtrace_parse_probe_argument_p (struct gdbarch *gdbarch) > +{ > + gdb_assert (gdbarch != NULL); > + return gdbarch->dtrace_parse_probe_argument != NULL; > +} > + > +void > +gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, struct parser_state *pstate, int narg) > +{ > + gdb_assert (gdbarch != NULL); > + gdb_assert (gdbarch->dtrace_parse_probe_argument != NULL); > + if (gdbarch_debug >= 2) > + fprintf_unfiltered (gdb_stdlog, "gdbarch_dtrace_parse_probe_argument called\n"); > + gdbarch->dtrace_parse_probe_argument (gdbarch, pstate, narg); > +} > + > +void > +set_gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, > + gdbarch_dtrace_parse_probe_argument_ftype dtrace_parse_probe_argument) > +{ > + gdbarch->dtrace_parse_probe_argument = dtrace_parse_probe_argument; > +} > + > +int > +gdbarch_dtrace_probe_is_enabled_p (struct gdbarch *gdbarch) > +{ > + gdb_assert (gdbarch != NULL); > + return gdbarch->dtrace_probe_is_enabled != NULL; > +} > + > +int > +gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch, CORE_ADDR addr) > +{ > + gdb_assert (gdbarch != NULL); > + gdb_assert (gdbarch->dtrace_probe_is_enabled != NULL); > + if (gdbarch_debug >= 2) > + fprintf_unfiltered (gdb_stdlog, "gdbarch_dtrace_probe_is_enabled called\n"); > + return gdbarch->dtrace_probe_is_enabled (gdbarch, addr); > +} > + > +void > +set_gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch, > + gdbarch_dtrace_probe_is_enabled_ftype dtrace_probe_is_enabled) > +{ > + gdbarch->dtrace_probe_is_enabled = dtrace_probe_is_enabled; > +} > + > +int > +gdbarch_dtrace_enable_probe_p (struct gdbarch *gdbarch) > +{ > + gdb_assert (gdbarch != NULL); > + return gdbarch->dtrace_enable_probe != NULL; > +} > + > +void > +gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch, CORE_ADDR addr) > +{ > + gdb_assert (gdbarch != NULL); > + gdb_assert (gdbarch->dtrace_enable_probe != NULL); > + if (gdbarch_debug >= 2) > + fprintf_unfiltered (gdb_stdlog, "gdbarch_dtrace_enable_probe called\n"); > + gdbarch->dtrace_enable_probe (gdbarch, addr); > +} > + > +void > +set_gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch, > + gdbarch_dtrace_enable_probe_ftype dtrace_enable_probe) > +{ > + gdbarch->dtrace_enable_probe = dtrace_enable_probe; > +} > + > +int > +gdbarch_dtrace_disable_probe_p (struct gdbarch *gdbarch) > +{ > + gdb_assert (gdbarch != NULL); > + return gdbarch->dtrace_disable_probe != NULL; > +} > + > +void > +gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, CORE_ADDR addr) > +{ > + gdb_assert (gdbarch != NULL); > + gdb_assert (gdbarch->dtrace_disable_probe != NULL); > + if (gdbarch_debug >= 2) > + fprintf_unfiltered (gdb_stdlog, "gdbarch_dtrace_disable_probe called\n"); > + gdbarch->dtrace_disable_probe (gdbarch, addr); > +} > + > +void > +set_gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, > + gdbarch_dtrace_disable_probe_ftype dtrace_disable_probe) > +{ > + gdbarch->dtrace_disable_probe = dtrace_disable_probe; > +} > + > +int > gdbarch_has_global_solist (struct gdbarch *gdbarch) > { > gdb_assert (gdbarch != NULL); > diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h > index b266530..de773a3 100644 > --- a/gdb/gdbarch.h > +++ b/gdb/gdbarch.h > @@ -59,6 +59,7 @@ struct syscall; > struct agent_expr; > struct axs_value; > struct stap_parse_info; > +struct parser_state; > struct ravenscar_arch_ops; > struct elf_internal_linux_prpsinfo; > struct mem_range; > @@ -1241,6 +1242,41 @@ typedef int (gdbarch_stap_parse_special_token_ftype) (struct gdbarch *gdbarch, s > extern int gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p); > extern void set_gdbarch_stap_parse_special_token (struct gdbarch *gdbarch, gdbarch_stap_parse_special_token_ftype *stap_parse_special_token); > > +/* DTrace related functions. > + The expression to compute the NARTGth+1 argument to a DTrace USDT probe. > + NARG must be >= 0. */ > + > +extern int gdbarch_dtrace_parse_probe_argument_p (struct gdbarch *gdbarch); > + > +typedef void (gdbarch_dtrace_parse_probe_argument_ftype) (struct gdbarch *gdbarch, struct parser_state *pstate, int narg); > +extern void gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, struct parser_state *pstate, int narg); > +extern void set_gdbarch_dtrace_parse_probe_argument (struct gdbarch *gdbarch, gdbarch_dtrace_parse_probe_argument_ftype *dtrace_parse_probe_argument); > + > +/* True if the given ADDR does not contain the instruction sequence > + corresponding to a disabled DTrace is-enabled probe. */ > + > +extern int gdbarch_dtrace_probe_is_enabled_p (struct gdbarch *gdbarch); > + > +typedef int (gdbarch_dtrace_probe_is_enabled_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); > +extern int gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch, CORE_ADDR addr); > +extern void set_gdbarch_dtrace_probe_is_enabled (struct gdbarch *gdbarch, gdbarch_dtrace_probe_is_enabled_ftype *dtrace_probe_is_enabled); > + > +/* Enable a DTrace is-enabled probe at ADDR. */ > + > +extern int gdbarch_dtrace_enable_probe_p (struct gdbarch *gdbarch); > + > +typedef void (gdbarch_dtrace_enable_probe_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); > +extern void gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch, CORE_ADDR addr); > +extern void set_gdbarch_dtrace_enable_probe (struct gdbarch *gdbarch, gdbarch_dtrace_enable_probe_ftype *dtrace_enable_probe); > + > +/* Disable a DTrace is-enabled probe at ADDR. */ > + > +extern int gdbarch_dtrace_disable_probe_p (struct gdbarch *gdbarch); > + > +typedef void (gdbarch_dtrace_disable_probe_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); > +extern void gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, CORE_ADDR addr); > +extern void set_gdbarch_dtrace_disable_probe (struct gdbarch *gdbarch, gdbarch_dtrace_disable_probe_ftype *dtrace_disable_probe); > + > /* True if the list of shared libraries is one and only for all > processes, as opposed to a list of shared libraries per inferior. > This usually means that all processes, although may or may not share > diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh > index e12b8b0..fcca995 100755 > --- a/gdb/gdbarch.sh > +++ b/gdb/gdbarch.sh > @@ -985,6 +985,21 @@ M:int:stap_is_single_operand:const char *s:s > # parser), and should advance the buffer pointer (p->arg). > M:int:stap_parse_special_token:struct stap_parse_info *p:p > > +# DTrace related functions. > + > +# The expression to compute the NARTGth+1 argument to a DTrace USDT probe. > +# NARG must be >= 0. > +M:void:dtrace_parse_probe_argument:struct parser_state *pstate, int narg:pstate, narg > + > +# True if the given ADDR does not contain the instruction sequence > +# corresponding to a disabled DTrace is-enabled probe. > +M:int:dtrace_probe_is_enabled:CORE_ADDR addr:addr > + > +# Enable a DTrace is-enabled probe at ADDR. > +M:void:dtrace_enable_probe:CORE_ADDR addr:addr > + > +# Disable a DTrace is-enabled probe at ADDR. > +M:void:dtrace_disable_probe:CORE_ADDR addr:addr > > # True if the list of shared libraries is one and only for all > # processes, as opposed to a list of shared libraries per inferior. > @@ -1213,6 +1228,7 @@ struct syscall; > struct agent_expr; > struct axs_value; > struct stap_parse_info; > +struct parser_state; > struct ravenscar_arch_ops; > struct elf_internal_linux_prpsinfo; > struct mem_range; > -- > 1.7.10.4 -- Sergio GPG key ID: 0x65FC5E36 Please send encrypted e-mail if possible http://sergiodj.net/