From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8680 invoked by alias); 27 Oct 2007 08:11:21 -0000 Received: (qmail 8668 invoked by uid 22791); 27 Oct 2007 08:11:20 -0000 X-Spam-Check-By: sourceware.org Received: from 216-129-118-140.cust.layer42.net (HELO bluesmobile.specifix.com) (216.129.118.140) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 27 Oct 2007 08:11:18 +0000 Received: from [127.0.0.1] (bluesmobile.specifix.com [216.129.118.140]) by bluesmobile.specifix.com (Postfix) with ESMTP id 594863B8CB; Sat, 27 Oct 2007 00:56:46 -0700 (PDT) Subject: Re: RFC: tracepoints: extend range of ax_trace_quick function From: Michael Snyder To: Jim Blandy Cc: gdb-patches@sourceware.org In-Reply-To: References: Content-Type: text/plain Date: Sat, 27 Oct 2007 08:12:00 -0000 Message-Id: <1193472363.16917.100.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 (2.10.3-4.fc7) Content-Transfer-Encoding: 7bit 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: 2007-10/txt/msg00736.txt.bz2 On Fri, 2007-10-26 at 15:59 -0700, Jim Blandy wrote: > In order to get Linux kernel tracepoints working, I needed to make a > number of fixes in GDB. This is one such patch; the code which uses > the function's new range comes a bit later. > > Okay to commit? If I understand correctly, a trace_quick was formerly of size up to 8 bits. You've added a trace16 for objects up to 16 bits, and this just allows trace_quick to handle those objects by forwarding them to trace16. In which case, it looks fine. Michael > > gdb/ChangeLog: > 2007-10-24 Jim Blandy > > * ax-general.c (ax_trace_quick): Generate trace16 instructions for > sizes from 256 to 65535. > > diff -r 7625042dd5a0 -r eb635294a14e gdb/ax-general.c > --- a/gdb/ax-general.c Wed Oct 24 10:17:42 2007 -0700 > +++ b/gdb/ax-general.c Wed Oct 24 18:02:15 2007 -0700 > @@ -166,17 +166,29 @@ ax_zero_ext (struct agent_expr *x, int n > } > > > -/* Append a trace_quick instruction to EXPR, to record N bytes. */ > +/* Append a trace_quick or trace16 instruction to EXPR, to record N bytes. */ > void > ax_trace_quick (struct agent_expr *x, int n) > { > - /* N must fit in a byte. */ > - if (n < 0 || n > 255) > - error (_("GDB bug: ax-general.c (ax_trace_quick): size out of range for trace_quick")); > - > - grow_expr (x, 2); > - x->buf[x->len++] = aop_trace_quick; > - x->buf[x->len++] = n; > + if (n < 0) > + internal_error (__FILE__, __LINE__, > + _("ax_trace_quick: negative size")); > + else if (n < (1 << 8)) > + { > + grow_expr (x, 2); > + x->buf[x->len++] = aop_trace_quick; > + x->buf[x->len++] = n; > + } > + else if (n < (1 << 16)) > + { > + grow_expr (x, 3); > + x->buf[x->len++] = aop_trace16; > + x->buf[x->len++] = n >> 8; > + x->buf[x->len++] = n; > + } > + else > + internal_error (__FILE__, __LINE__, > + _("ax_trace_quick: size out of range")); > } > > > diff -r 7625042dd5a0 -r eb635294a14e gdb/ax.h > --- a/gdb/ax.h Wed Oct 24 10:17:42 2007 -0700 > +++ b/gdb/ax.h Wed Oct 24 18:02:15 2007 -0700 > @@ -157,7 +157,8 @@ extern void ax_ext (struct agent_expr *E > /* Append a zero-extension instruction to EXPR, to extend an N-bit value. */ > extern void ax_zero_ext (struct agent_expr *EXPR, int N); > > -/* Append a trace_quick instruction to EXPR, to record N bytes. */ > +/* Append a trace_quick or trace16 instruction to EXPR, to record N bytes. > + N must be less than 65536. */ > extern void ax_trace_quick (struct agent_expr *EXPR, int N); > > /* Append a goto op to EXPR. OP is the actual op (must be aop_goto or