From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 658 invoked by alias); 23 Sep 2011 17:38:04 -0000 Received: (qmail 497 invoked by uid 22791); 23 Sep 2011 17:38:01 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 23 Sep 2011 17:37:45 +0000 Received: from hpaq6.eem.corp.google.com (hpaq6.eem.corp.google.com [172.25.149.6]) by smtp-out.google.com with ESMTP id p8NHbhDI006552 for ; Fri, 23 Sep 2011 10:37:44 -0700 Received: from qyk4 (qyk4.prod.google.com [10.241.83.132]) by hpaq6.eem.corp.google.com with ESMTP id p8NHXHaP026626 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Fri, 23 Sep 2011 10:37:42 -0700 Received: by qyk4 with SMTP id 4so3745608qyk.20 for ; Fri, 23 Sep 2011 10:37:42 -0700 (PDT) Received: by 10.224.218.194 with SMTP id hr2mr2798318qab.61.1316799462188; Fri, 23 Sep 2011 10:37:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.218.194 with SMTP id hr2mr2798312qab.61.1316799462041; Fri, 23 Sep 2011 10:37:42 -0700 (PDT) Received: by 10.224.80.149 with HTTP; Fri, 23 Sep 2011 10:37:41 -0700 (PDT) In-Reply-To: <4E7A5B0C.2020802@earthlink.net> References: <4E7A5B0C.2020802@earthlink.net> Date: Sat, 24 Sep 2011 09:19:00 -0000 Message-ID: Subject: Re: [PATCH] Collect return addresses at tracepoints From: Doug Evans To: Stan Shebs Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes 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 X-SW-Source: 2011-09/txt/msg00435.txt.bz2 On Wed, Sep 21, 2011 at 2:45 PM, Stan Shebs wrote: > This patch introduces a new tracepoint collection directive $_ret, which > asks for the collection of the return address stored in the current stack > frame. =A0It's not the complete solution for what users really want, whic= h is > to collect several frames of the stack, but that's hard to get right with= out > adding a fancy unwinder to the tracepoint agent. =A0This is much simpler, > needing only an architecture-specific method to generate appropriate > bytecodes. > > Not too much controversial here - the testsuite exercises the code, but it > won't fail the test if the caller's name doesn't appear in the backtrace, > since we can't guarantee that the method's heuristic will always work. > > I'll commit this in a few days if there are no objections. > > Stan > stan@codesourcery.com > > 2011-09-21 =A0Stan Shebs > > =A0 =A0Add return address collection for tracepoints. > =A0 =A0* tracepoint.c (encode_actions_1): Add case for $_ret. > =A0 =A0(validate_actionline): Check for $_ret. > =A0 =A0(trace_dump_actions): Ditto. > =A0 =A0* ax-gdb.h (gen_trace_for_return_address): Declare. > =A0 =A0* ax-gdb.c: Include arch-utils.h. > =A0 =A0(gen_trace_for_return_address): New function. > =A0 =A0(agent_command): Add return address special case. > =A0 =A0* amd64-tdep.c: Include ax.h and ax-gdb.h. > =A0 =A0(amd64_gen_return_address): New function. > =A0 =A0(amd64_init_abi): Call it. > =A0 =A0* i386-tdep.c: Include ax.h and ax-gdb.h. > =A0 =A0(i386_gen_return_address): New function. > =A0 =A0(i386_init_abi): Call it. > =A0 =A0* arch-utils.h (default_gen_return_address): Declare. > =A0 =A0* arch-utils.c (default_gen_return_address): New function. > =A0 =A0* gdbarch.sh (gen_return_address): New method. > =A0 =A0* gdbarch.h, gdbarch.c: Regenerate. > > =A0 =A0* gdb.texinfo (Tracepoint Action Lists): Document $_ret. > > =A0 =A0* gdb.trace/collection.exp: Test collection of $_ret. Hi. Nit: + void + amd64_gen_return_address (struct gdbarch *gdbarch, + struct agent_expr *ax, struct axs_value *value, + CORE_ADDR scope) + void + i386_gen_return_address (struct gdbarch *gdbarch, + struct agent_expr *ax, struct axs_value *value, + CORE_ADDR scope) These should be static.