From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32226 invoked by alias); 17 Feb 2015 01:13:46 -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 32215 invoked by uid 89); 17 Feb 2015 01:13:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 17 Feb 2015 01:13:44 +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 t1H1DfBU009379 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Feb 2015 20:13:41 -0500 Received: from localhost (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t1H1DenU031620 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Mon, 16 Feb 2015 20:13:41 -0500 From: Sergio Durigan Junior To: "Jose E. Marchesi" Cc: gdb-patches@sourceware.org Subject: Re: [PATCH V4 2/9] Move `compute_probe_arg' and `compile_probe_arg' to probe.c References: <1422874968-382-1-git-send-email-jose.marchesi@oracle.com> <1422874968-382-3-git-send-email-jose.marchesi@oracle.com> X-URL: http://blog.sergiodj.net Date: Tue, 17 Feb 2015 01:13:00 -0000 In-Reply-To: <1422874968-382-3-git-send-email-jose.marchesi@oracle.com> (Jose E. Marchesi's message of "Mon, 2 Feb 2015 12:02:41 +0100") Message-ID: <87zj8d7323.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/msg00375.txt.bz2 On Monday, February 02 2015, Jose E. Marchesi wrote: > This patch moves the `compute_probe_arg' and `compile_probe_arg' functions > from stap-probe.c to probe.c. The rationale is that it is reasonable to > assume that all backends will provide the `$_probe_argN' convenience > variables, and that the user must be placed on the PC of the probe when > requesting that information. The value and type of the argument can still be > determined by the probe backend via the `pops->evaluate_probe_argument' and > `pops->compile_to_ax' handlers. > > Note that a test in gdb.base/stap-probe.exp had to be adjusted because the "No > SystemTap probe at PC" messages are now "No probe at PC". Thanks for the patch. It was already approved before, and I have no further comments about it. OK. > gdb/ChangeLog: > > 2015-02-02 Jose E. Marchesi > > * probe.c (compute_probe_arg): Moved from stap-probe.c > (compile_probe_arg): Likewise. > (probe_funcs): Likewise. > * stap-probe.c (compute_probe_arg): Moved to probe.c. > (compile_probe_arg): Likewise. > (probe_funcs): Likewise. > > gdb/testsuite/ChangeLog: > > 2015-02-02 Jose E. Marchesi > > * gdb.base/stap-probe.exp (stap_test): Remove "SystemTap" from > expected message when trying to access $_probe_* convenience > variables while not on a probe. > --- > gdb/ChangeLog | 9 +++ > gdb/probe.c | 111 +++++++++++++++++++++++++++++++++ > gdb/stap-probe.c | 109 -------------------------------- > gdb/testsuite/ChangeLog | 6 ++ > gdb/testsuite/gdb.base/stap-probe.exp | 2 +- > 5 files changed, 127 insertions(+), 110 deletions(-) > > diff --git a/gdb/probe.c b/gdb/probe.c > index be3e656..98113eb 100644 > --- a/gdb/probe.c > +++ b/gdb/probe.c > @@ -30,6 +30,9 @@ > #include "gdb_regex.h" > #include "frame.h" > #include "arch-utils.h" > +#include "value.h" > +#include "ax.h" > +#include "ax-gdb.h" > #include > > typedef struct bound_probe bound_probe_s; > @@ -826,6 +829,87 @@ will show information about all types of probes."), > return &info_probes_cmdlist; > } > > + > + > +/* This is called to compute the value of one of the $_probe_arg* > + convenience variables. */ > + > +static struct value * > +compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar, > + void *data) > +{ > + struct frame_info *frame = get_selected_frame (_("No frame selected")); > + CORE_ADDR pc = get_frame_pc (frame); > + int sel = (int) (uintptr_t) data; > + struct bound_probe pc_probe; > + const struct sym_probe_fns *pc_probe_fns; > + unsigned n_args; > + > + /* SEL == -1 means "_probe_argc". */ > + gdb_assert (sel >= -1); > + > + pc_probe = find_probe_by_pc (pc); > + if (pc_probe.probe == NULL) > + error (_("No probe at PC %s"), core_addr_to_string (pc)); > + > + n_args = get_probe_argument_count (pc_probe.probe, frame); > + if (sel == -1) > + return value_from_longest (builtin_type (arch)->builtin_int, n_args); > + > + if (sel >= n_args) > + error (_("Invalid probe argument %d -- probe has %u arguments available"), > + sel, n_args); > + > + return evaluate_probe_argument (pc_probe.probe, sel, frame); > +} > + > +/* This is called to compile one of the $_probe_arg* convenience > + variables into an agent expression. */ > + > +static void > +compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr, > + struct axs_value *value, void *data) > +{ > + CORE_ADDR pc = expr->scope; > + int sel = (int) (uintptr_t) data; > + struct bound_probe pc_probe; > + const struct sym_probe_fns *pc_probe_fns; > + int n_args; > + struct frame_info *frame = get_selected_frame (NULL); > + > + /* SEL == -1 means "_probe_argc". */ > + gdb_assert (sel >= -1); > + > + pc_probe = find_probe_by_pc (pc); > + if (pc_probe.probe == NULL) > + error (_("No probe at PC %s"), core_addr_to_string (pc)); > + > + n_args = get_probe_argument_count (pc_probe.probe, frame); > + > + if (sel == -1) > + { > + value->kind = axs_rvalue; > + value->type = builtin_type (expr->gdbarch)->builtin_int; > + ax_const_l (expr, n_args); > + return; > + } > + > + gdb_assert (sel >= 0); > + if (sel >= n_args) > + error (_("Invalid probe argument %d -- probe has %d arguments available"), > + sel, n_args); > + > + pc_probe.probe->pops->compile_to_ax (pc_probe.probe, expr, value, sel); > +} > + > +static const struct internalvar_funcs probe_funcs = > +{ > + compute_probe_arg, > + compile_probe_arg, > + NULL > +}; > + > + > VEC (probe_ops_cp) *all_probe_ops; > > void _initialize_probe (void); > @@ -835,6 +919,33 @@ _initialize_probe (void) > { > VEC_safe_push (probe_ops_cp, all_probe_ops, &probe_ops_any); > > + create_internalvar_type_lazy ("_probe_argc", &probe_funcs, > + (void *) (uintptr_t) -1); > + create_internalvar_type_lazy ("_probe_arg0", &probe_funcs, > + (void *) (uintptr_t) 0); > + create_internalvar_type_lazy ("_probe_arg1", &probe_funcs, > + (void *) (uintptr_t) 1); > + create_internalvar_type_lazy ("_probe_arg2", &probe_funcs, > + (void *) (uintptr_t) 2); > + create_internalvar_type_lazy ("_probe_arg3", &probe_funcs, > + (void *) (uintptr_t) 3); > + create_internalvar_type_lazy ("_probe_arg4", &probe_funcs, > + (void *) (uintptr_t) 4); > + create_internalvar_type_lazy ("_probe_arg5", &probe_funcs, > + (void *) (uintptr_t) 5); > + create_internalvar_type_lazy ("_probe_arg6", &probe_funcs, > + (void *) (uintptr_t) 6); > + create_internalvar_type_lazy ("_probe_arg7", &probe_funcs, > + (void *) (uintptr_t) 7); > + create_internalvar_type_lazy ("_probe_arg8", &probe_funcs, > + (void *) (uintptr_t) 8); > + create_internalvar_type_lazy ("_probe_arg9", &probe_funcs, > + (void *) (uintptr_t) 9); > + create_internalvar_type_lazy ("_probe_arg10", &probe_funcs, > + (void *) (uintptr_t) 10); > + create_internalvar_type_lazy ("_probe_arg11", &probe_funcs, > + (void *) (uintptr_t) 11); > + > add_cmd ("all", class_info, info_probes_command, > _("\ > Show information about all type of probes."), > diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c > index e534b6d..e898f7e 100644 > --- a/gdb/stap-probe.c > +++ b/gdb/stap-probe.c > @@ -1365,79 +1365,6 @@ stap_probe_destroy (struct probe *probe_generic) > > > > -/* This is called to compute the value of one of the $_probe_arg* > - convenience variables. */ > - > -static struct value * > -compute_probe_arg (struct gdbarch *arch, struct internalvar *ivar, > - void *data) > -{ > - struct frame_info *frame = get_selected_frame (_("No frame selected")); > - CORE_ADDR pc = get_frame_pc (frame); > - int sel = (int) (uintptr_t) data; > - struct bound_probe pc_probe; > - const struct sym_probe_fns *pc_probe_fns; > - unsigned n_args; > - > - /* SEL == -1 means "_probe_argc". */ > - gdb_assert (sel >= -1); > - > - pc_probe = find_probe_by_pc (pc); > - if (pc_probe.probe == NULL) > - error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc)); > - > - n_args = get_probe_argument_count (pc_probe.probe, frame); > - if (sel == -1) > - return value_from_longest (builtin_type (arch)->builtin_int, n_args); > - > - if (sel >= n_args) > - error (_("Invalid probe argument %d -- probe has %u arguments available"), > - sel, n_args); > - > - return evaluate_probe_argument (pc_probe.probe, sel, frame); > -} > - > -/* This is called to compile one of the $_probe_arg* convenience > - variables into an agent expression. */ > - > -static void > -compile_probe_arg (struct internalvar *ivar, struct agent_expr *expr, > - struct axs_value *value, void *data) > -{ > - CORE_ADDR pc = expr->scope; > - int sel = (int) (uintptr_t) data; > - struct bound_probe pc_probe; > - const struct sym_probe_fns *pc_probe_fns; > - int n_args; > - struct frame_info *frame = get_selected_frame (NULL); > - > - /* SEL == -1 means "_probe_argc". */ > - gdb_assert (sel >= -1); > - > - pc_probe = find_probe_by_pc (pc); > - if (pc_probe.probe == NULL) > - error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc)); > - > - n_args = get_probe_argument_count (pc_probe.probe, frame); > - > - if (sel == -1) > - { > - value->kind = axs_rvalue; > - value->type = builtin_type (expr->gdbarch)->builtin_int; > - ax_const_l (expr, n_args); > - return; > - } > - > - gdb_assert (sel >= 0); > - if (sel >= n_args) > - error (_("Invalid probe argument %d -- probe has %d arguments available"), > - sel, n_args); > - > - pc_probe.probe->pops->compile_to_ax (pc_probe.probe, expr, value, sel); > -} > - > - > - > /* Set or clear a SystemTap semaphore. ADDRESS is the semaphore's > address. SET is zero if the semaphore should be cleared, or one > if it should be set. This is a helper function for `stap_semaphore_down' > @@ -1514,15 +1441,6 @@ stap_clear_semaphore (struct probe *probe_generic, struct objfile *objfile, > stap_modify_semaphore (addr, 0, gdbarch); > } > > -/* Implementation of `$_probe_arg*' set of variables. */ > - > -static const struct internalvar_funcs probe_funcs = > -{ > - compute_probe_arg, > - compile_probe_arg, > - NULL > -}; > - > /* Helper function that parses the information contained in a > SystemTap's probe. Basically, the information consists in: > > @@ -1793,33 +1711,6 @@ _initialize_stap_probe (void) > show_stapexpressiondebug, > &setdebuglist, &showdebuglist); > > - create_internalvar_type_lazy ("_probe_argc", &probe_funcs, > - (void *) (uintptr_t) -1); > - create_internalvar_type_lazy ("_probe_arg0", &probe_funcs, > - (void *) (uintptr_t) 0); > - create_internalvar_type_lazy ("_probe_arg1", &probe_funcs, > - (void *) (uintptr_t) 1); > - create_internalvar_type_lazy ("_probe_arg2", &probe_funcs, > - (void *) (uintptr_t) 2); > - create_internalvar_type_lazy ("_probe_arg3", &probe_funcs, > - (void *) (uintptr_t) 3); > - create_internalvar_type_lazy ("_probe_arg4", &probe_funcs, > - (void *) (uintptr_t) 4); > - create_internalvar_type_lazy ("_probe_arg5", &probe_funcs, > - (void *) (uintptr_t) 5); > - create_internalvar_type_lazy ("_probe_arg6", &probe_funcs, > - (void *) (uintptr_t) 6); > - create_internalvar_type_lazy ("_probe_arg7", &probe_funcs, > - (void *) (uintptr_t) 7); > - create_internalvar_type_lazy ("_probe_arg8", &probe_funcs, > - (void *) (uintptr_t) 8); > - create_internalvar_type_lazy ("_probe_arg9", &probe_funcs, > - (void *) (uintptr_t) 9); > - create_internalvar_type_lazy ("_probe_arg10", &probe_funcs, > - (void *) (uintptr_t) 10); > - create_internalvar_type_lazy ("_probe_arg11", &probe_funcs, > - (void *) (uintptr_t) 11); > - > add_cmd ("stap", class_info, info_probes_stap_command, > _("\ > Show information about SystemTap static probes.\n\ > diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp > index 73e6ca3..7310b25 100644 > --- a/gdb/testsuite/gdb.base/stap-probe.exp > +++ b/gdb/testsuite/gdb.base/stap-probe.exp > @@ -30,7 +30,7 @@ proc stap_test {exec_name {arg ""}} { > return -1 > } > > - gdb_test "print \$_probe_argc" "No SystemTap probe at PC $hex" \ > + gdb_test "print \$_probe_argc" "No probe at PC $hex" \ > "check argument not at probe point" > > gdb_test "info probes stap" \ > -- > 1.7.10.4 -- Sergio GPG key ID: 0x65FC5E36 Please send encrypted e-mail if possible http://sergiodj.net/