From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16685 invoked by alias); 26 Oct 2007 23:10:12 -0000 Received: (qmail 16673 invoked by uid 22791); 26 Oct 2007 23:10:11 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 26 Oct 2007 23:10:09 +0000 Received: (qmail 28583 invoked from network); 26 Oct 2007 23:10:07 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 26 Oct 2007 23:10:07 -0000 To: gdb-patches@sourceware.org Subject: RFC: tracepoints: Use constant-size trace opcodes where possible From: Jim Blandy Date: Fri, 26 Oct 2007 23:18:00 -0000 Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00727.txt.bz2 The comments should explain what's going on here. The Linux tracepoint agent was much simplified by restricting it to expressions whose data size could be estimated in advance. This should have no effect on other agents. Okay to commit? gdb/ChangeLog: 2007-10-25 Jim Blandy * ax-gdb.c (gen_traced_pop): Generate trace_quick or trace16 bytecodes whenever possible. diff -r cdc626576c72 -r 84b7570f26f4 gdb/ax-gdb.c --- a/gdb/ax-gdb.c Thu Oct 25 12:43:14 2007 -0700 +++ b/gdb/ax-gdb.c Thu Oct 25 12:47:24 2007 -0700 @@ -321,13 +321,22 @@ gen_traced_pop (struct agent_expr *ax, s { int length = TYPE_LENGTH (check_typedef (value->type)); - /* There's no point in trying to use a trace_quick bytecode - here, since "trace_quick SIZE pop" is three bytes, whereas - "const8 SIZE trace" is also three bytes, does the same - thing, and the simplest code which generates that will also - work correctly for objects with large sizes. */ - ax_const_l (ax, length); - ax_simple (ax, aop_trace); + /* Try to generate a trace_quick here if we can. The + bytecode stream generated isn't any shorter ('quick + pop' and 'const8 trace' are both three bytes long), + but this simplifies agent expression evaluators that want + to be able to easily put an upper bound on the memory + that will be collected by an expression. */ + if (length < 1 << 16) + { + ax_trace_quick (ax, length); + ax_simple (ax, aop_pop); + } + else + { + ax_const_l (ax, length); + ax_simple (ax, aop_trace); + } } break;