From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9376 invoked by alias); 20 Feb 2011 07:24:45 -0000 Received: (qmail 9324 invoked by uid 22791); 20 Feb 2011 07:24:35 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gy0-f169.google.com (HELO mail-gy0-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 20 Feb 2011 07:24:06 +0000 Received: by gyb13 with SMTP id 13so237988gyb.0 for ; Sat, 19 Feb 2011 23:23:38 -0800 (PST) Received: by 10.150.181.17 with SMTP id d17mr54239ybf.185.1298183018308; Sat, 19 Feb 2011 22:23:38 -0800 (PST) MIME-Version: 1.0 Received: by 10.146.84.8 with HTTP; Sat, 19 Feb 2011 22:23:18 -0800 (PST) In-Reply-To: References: <201102181856.05577.pedro@codesourcery.com> From: Hui Zhu Date: Sun, 20 Feb 2011 15:06:00 -0000 Message-ID: Subject: Re: RFC: move agent opcodes to common file To: Tom Tromey Cc: Pedro Alves , gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-02/txt/msg00519.txt.bz2 Thanks Tom. But when I try to add 0x31 to ax.def, I got some build error with gdbserver: gcc -c -g -I. -I../../../src/gdb/gdbserver -I../../../src/gdb/gdbserver/../common -I../../../src/gdb/gdbserver/../regformats -I../../../src/gdb/gdbserver/../../include -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Werror ../../../src/gdb/gdbserver/tracepoint.c cc1: warnings being treated as errors ../../../src/gdb/gdbserver/tracepoint.c:486: error: excess elements in array initializer ../../../src/gdb/gdbserver/tracepoint.c:486: error: (near initialization for 'gdb_agent_op_names') make[2]: *** [tracepoint.o] Error 1 make[2]: Leaving directory `/home/teawater/gdb/bgdbno/gdb/gdbserver' make[1]: *** [subdir_do] Error 1 make[1]: Leaving directory `/home/teawater/gdb/bgdbno/gdb' make: *** [all] Error 2 This is because: DEFOP (invalid2, 0, 0, 0, 0, 0x2f) static const char *gdb_agent_op_names [gdb_agent_op_last] Make the gdb_agent_op_last is not the right size of gdb_agent_op_names. Could you tell me how to handle it? Why we need invalid2? Best, Hui On Sat, Feb 19, 2011 at 05:11, Tom Tromey wrote: >>>>>> "Pedro" =3D=3D Pedro Alves writes: > > Pedro> Looks good to me. > > Pedro> Hmm. =A0I think it'd be a good idea to wrap the direct accesses > Pedro> to the gdb_agent_op_names array (there are a few > Pedro> `gdb_agent_op_names[op]' in the code, in a function that > Pedro> checks that "op" doesn't overflow the array length before > Pedro> dereferencing it, and returns "?undef?" or something like that > Pedro> if it does over- or underflow. =A0It look like it'll happen if > Pedro> you connect a new gdb to an older gdbserver with --debug enabled, > Pedro> and send it the new opcodes. > > I implemented this. > > I fixed gdbserver/Makefile.in, too. > > Here is what I am checking in. > > Tom > > 2011-02-18 =A0Tom Tromey =A0 > > =A0 =A0 =A0 =A0* common/ax.def: New file. > =A0 =A0 =A0 =A0* ax.h (enum agent_op): Use ax.def. > =A0 =A0 =A0 =A0* ax-general.c (aop_map): Use ax.def. > > 2011-02-18 =A0Tom Tromey =A0 > > =A0 =A0 =A0 =A0* Makefile.in (tracepoint-ipa.o): Depend on ax.def. > =A0 =A0 =A0 =A0(tracepoint.o): Likewise. > =A0 =A0 =A0 =A0* tracepoint.c (enum gdb_agent_op): Use ax.def. > =A0 =A0 =A0 =A0(gdb_agent_op_names): Likewise. > > Index: ax-general.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/ax-general.c,v > retrieving revision 1.24 > diff -u -r1.24 ax-general.c > --- ax-general.c =A0 =A0 =A0 =A018 Feb 2011 20:55:43 -0000 =A0 =A0 =A01.24 > +++ ax-general.c =A0 =A0 =A0 =A018 Feb 2011 21:10:10 -0000 > @@ -338,58 +338,11 @@ > > =A0struct aop_map aop_map[] =3D > =A0{ > - =A0{0, 0, 0, 0, 0}, > - =A0{"float", 0, 0, 0, 0}, =A0 =A0 =A0 /* 0x01 */ > - =A0{"add", 0, 0, 2, 1}, =A0 =A0 =A0 =A0 /* 0x02 */ > - =A0{"sub", 0, 0, 2, 1}, =A0 =A0 =A0 =A0 /* 0x03 */ > - =A0{"mul", 0, 0, 2, 1}, =A0 =A0 =A0 =A0 /* 0x04 */ > - =A0{"div_signed", 0, 0, 2, 1}, =A0/* 0x05 */ > - =A0{"div_unsigned", 0, 0, 2, 1}, =A0 =A0 =A0 =A0/* 0x06 */ > - =A0{"rem_signed", 0, 0, 2, 1}, =A0/* 0x07 */ > - =A0{"rem_unsigned", 0, 0, 2, 1}, =A0 =A0 =A0 =A0/* 0x08 */ > - =A0{"lsh", 0, 0, 2, 1}, =A0 =A0 =A0 =A0 /* 0x09 */ > - =A0{"rsh_signed", 0, 0, 2, 1}, =A0/* 0x0a */ > - =A0{"rsh_unsigned", 0, 0, 2, 1}, =A0 =A0 =A0 =A0/* 0x0b */ > - =A0{"trace", 0, 0, 2, 0}, =A0 =A0 =A0 /* 0x0c */ > - =A0{"trace_quick", 1, 0, 1, 1}, /* 0x0d */ > - =A0{"log_not", 0, 0, 1, 1}, =A0 =A0 /* 0x0e */ > - =A0{"bit_and", 0, 0, 2, 1}, =A0 =A0 /* 0x0f */ > - =A0{"bit_or", 0, 0, 2, 1}, =A0 =A0 =A0/* 0x10 */ > - =A0{"bit_xor", 0, 0, 2, 1}, =A0 =A0 /* 0x11 */ > - =A0{"bit_not", 0, 0, 1, 1}, =A0 =A0 /* 0x12 */ > - =A0{"equal", 0, 0, 2, 1}, =A0 =A0 =A0 /* 0x13 */ > - =A0{"less_signed", 0, 0, 2, 1}, /* 0x14 */ > - =A0{"less_unsigned", 0, 0, 2, 1}, =A0 =A0 =A0 /* 0x15 */ > - =A0{"ext", 1, 0, 1, 1}, =A0 =A0 =A0 =A0 /* 0x16 */ > - =A0{"ref8", 0, 8, 1, 1}, =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* 0x17 */ > - =A0{"ref16", 0, 16, 1, 1}, =A0 =A0 =A0/* 0x18 */ > - =A0{"ref32", 0, 32, 1, 1}, =A0 =A0 =A0/* 0x19 */ > - =A0{"ref64", 0, 64, 1, 1}, =A0 =A0 =A0/* 0x1a */ > - =A0{"ref_float", 0, 0, 1, 1}, =A0 /* 0x1b */ > - =A0{"ref_double", 0, 0, 1, 1}, =A0/* 0x1c */ > - =A0{"ref_long_double", 0, 0, 1, 1}, =A0 =A0 /* 0x1d */ > - =A0{"l_to_d", 0, 0, 1, 1}, =A0 =A0 =A0/* 0x1e */ > - =A0{"d_to_l", 0, 0, 1, 1}, =A0 =A0 =A0/* 0x1f */ > - =A0{"if_goto", 2, 0, 1, 0}, =A0 =A0 /* 0x20 */ > - =A0{"goto", 2, 0, 0, 0}, =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* 0x21 */ > - =A0{"const8", 1, 8, 0, 1}, =A0 =A0 =A0/* 0x22 */ > - =A0{"const16", 2, 16, 0, 1}, =A0 =A0/* 0x23 */ > - =A0{"const32", 4, 32, 0, 1}, =A0 =A0/* 0x24 */ > - =A0{"const64", 8, 64, 0, 1}, =A0 =A0/* 0x25 */ > - =A0{"reg", 2, 0, 0, 1}, =A0 =A0 =A0 =A0 /* 0x26 */ > - =A0{"end", 0, 0, 0, 0}, =A0 =A0 =A0 =A0 /* 0x27 */ > - =A0{"dup", 0, 0, 1, 2}, =A0 =A0 =A0 =A0 /* 0x28 */ > - =A0{"pop", 0, 0, 1, 0}, =A0 =A0 =A0 =A0 /* 0x29 */ > - =A0{"zero_ext", 1, 0, 1, 1}, =A0 =A0/* 0x2a */ > - =A0{"swap", 0, 0, 2, 2}, =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* 0x2b */ > - =A0{"getv", 2, 0, 0, 1}, =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* 0x2c */ > - =A0{"setv", 2, 0, 0, 1}, =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* 0x2d */ > - =A0{"tracev", 2, 0, 0, 1}, =A0 =A0 =A0/* 0x2e */ > - =A0{0, 0, 0, 0, 0}, =A0 =A0 =A0 =A0 =A0 =A0 /* 0x2f */ > - =A0{"trace16", 2, 0, 1, 1}, =A0 =A0 /* 0x30 */ > - =A0{0, 0, 0, 0, 0}, =A0 =A0 =A0 =A0 =A0 =A0 /* 0x31 */ > - =A0{"pick", 1, 0, 0, 1}, =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/* 0x32 */ > - =A0{"rot", 0, 0, 3, 3}, =A0 =A0 =A0 =A0 /* 0x33 */ > + =A0{0, 0, 0, 0, 0} > +#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) \ > + =A0, { # NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED } > +#include "ax.def" > +#undef DEFOP > =A0}; > > > Index: ax.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/ax.h,v > retrieving revision 1.16 > diff -u -r1.16 ax.h > --- ax.h =A0 =A0 =A0 =A018 Feb 2011 20:55:43 -0000 =A0 =A0 =A01.16 > +++ ax.h =A0 =A0 =A0 =A018 Feb 2011 21:10:10 -0000 > @@ -145,67 +145,14 @@ > =A0 =A0 unsigned char *reg_mask; > =A0 }; > > -/* The actual values of the various bytecode operations. > - > - =A0 Other independent implementations of the agent bytecode engine will > - =A0 rely on the exact values of these enums, and may not be recompiled > - =A0 when we change this table. =A0The numeric values should remain fixed > - =A0 whenever possible. =A0Thus, we assign them values explicitly here (= to > - =A0 allow gaps to form safely), and the disassembly table in > - =A0 agentexpr.h behaves like an opcode map. =A0If you want to see them > - =A0 grouped logically, see doc/agentexpr.texi. =A0*/ > +/* The actual values of the various bytecode operations. =A0*/ > > =A0enum agent_op > =A0 { > - =A0 =A0aop_float =3D 0x01, > - =A0 =A0aop_add =3D 0x02, > - =A0 =A0aop_sub =3D 0x03, > - =A0 =A0aop_mul =3D 0x04, > - =A0 =A0aop_div_signed =3D 0x05, > - =A0 =A0aop_div_unsigned =3D 0x06, > - =A0 =A0aop_rem_signed =3D 0x07, > - =A0 =A0aop_rem_unsigned =3D 0x08, > - =A0 =A0aop_lsh =3D 0x09, > - =A0 =A0aop_rsh_signed =3D 0x0a, > - =A0 =A0aop_rsh_unsigned =3D 0x0b, > - =A0 =A0aop_trace =3D 0x0c, > - =A0 =A0aop_trace_quick =3D 0x0d, > - =A0 =A0aop_log_not =3D 0x0e, > - =A0 =A0aop_bit_and =3D 0x0f, > - =A0 =A0aop_bit_or =3D 0x10, > - =A0 =A0aop_bit_xor =3D 0x11, > - =A0 =A0aop_bit_not =3D 0x12, > - =A0 =A0aop_equal =3D 0x13, > - =A0 =A0aop_less_signed =3D 0x14, > - =A0 =A0aop_less_unsigned =3D 0x15, > - =A0 =A0aop_ext =3D 0x16, > - =A0 =A0aop_ref8 =3D 0x17, > - =A0 =A0aop_ref16 =3D 0x18, > - =A0 =A0aop_ref32 =3D 0x19, > - =A0 =A0aop_ref64 =3D 0x1a, > - =A0 =A0aop_ref_float =3D 0x1b, > - =A0 =A0aop_ref_double =3D 0x1c, > - =A0 =A0aop_ref_long_double =3D 0x1d, > - =A0 =A0aop_l_to_d =3D 0x1e, > - =A0 =A0aop_d_to_l =3D 0x1f, > - =A0 =A0aop_if_goto =3D 0x20, > - =A0 =A0aop_goto =3D 0x21, > - =A0 =A0aop_const8 =3D 0x22, > - =A0 =A0aop_const16 =3D 0x23, > - =A0 =A0aop_const32 =3D 0x24, > - =A0 =A0aop_const64 =3D 0x25, > - =A0 =A0aop_reg =3D 0x26, > - =A0 =A0aop_end =3D 0x27, > - =A0 =A0aop_dup =3D 0x28, > - =A0 =A0aop_pop =3D 0x29, > - =A0 =A0aop_zero_ext =3D 0x2a, > - =A0 =A0aop_swap =3D 0x2b, > - =A0 =A0aop_getv =3D 0x2c, > - =A0 =A0aop_setv =3D 0x2d, > - =A0 =A0aop_tracev =3D 0x2e, > - =A0 =A0aop_trace16 =3D 0x30, > - =A0 =A0aop_pick =3D 0x32, > - =A0 =A0aop_rot =3D 0x33, > +#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) =A0\ > + =A0 =A0aop_ ## NAME =3D VALUE, > +#include "ax.def" > +#undef DEFOP > =A0 =A0 aop_last > =A0 }; > > Index: common/ax.def > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: common/ax.def > diff -N common/ax.def > --- /dev/null =A0 1 Jan 1970 00:00:00 -0000 > +++ common/ax.def =A0 =A0 =A0 18 Feb 2011 21:10:10 -0000 > @@ -0,0 +1,97 @@ > +/* Definition of agent opcode values. =A0 -*- c -*- > + =A0 Copyright (C) 1998, 1999, 2000, 2007, 2008, 2009, 2010, 2011 > + =A0 Free Software Foundation, Inc. > + > + =A0 This file is part of GDB. > + > + =A0 This program is free software; you can redistribute it and/or modify > + =A0 it under the terms of the GNU General Public License as published by > + =A0 the Free Software Foundation; either version 3 of the License, or > + =A0 (at your option) any later version. > + > + =A0 This program is distributed in the hope that it will be useful, > + =A0 but WITHOUT ANY WARRANTY; without even the implied warranty of > + =A0 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the > + =A0 GNU General Public License for more details. > + > + =A0 You should have received a copy of the GNU General Public License > + =A0 along with this program. =A0If not, see . =A0*/ > + > +/* The actual values of the various bytecode operations. > + > + =A0 Other independent implementations of the agent bytecode engine will > + =A0 rely on the exact values of these enums, and may not be recompiled > + =A0 when we change this table. =A0The numeric values should remain fixed > + =A0 whenever possible. =A0Thus, we assign them values explicitly here (= to > + =A0 allow gaps to form safely), and the disassembly table in > + =A0 agentexpr.h behaves like an opcode map. =A0If you want to see them > + =A0 grouped logically, see doc/agentexpr.texi. > + > + =A0 Each line is of the form: > + > + =A0 DEFOP (name, size, data_size, consumed, produced, opcode) > + > + =A0 NAME is the name of the operation. > + =A0 SIZE is the number of argument bytes that the operation takes from > + =A0 the bytecode stream. > + =A0 DATA_SIZE is the size of data operated on, in bits, for operations > + =A0 that care (ref and const). =A0It is zero otherwise. > + =A0 CONSUMED is the number of stack elements consumed. > + =A0 PRODUCED is the number of stack elements produced. > + =A0 OPCODE is the operation's encoding. =A0*/ > + > +DEFOP (float, 0, 0, 0, 0, 0x01) > +DEFOP (add, 0, 0, 2, 1, 0x02) > +DEFOP (sub, 0, 0, 2, 1, 0x03) > +DEFOP (mul, 0, 0, 2, 1, 0x04) > +DEFOP (div_signed, 0, 0, 2, 1, 0x05) > +DEFOP (div_unsigned, 0, 0, 2, 1, 0x06) > +DEFOP (rem_signed, 0, 0, 2, 1, 0x07) > +DEFOP (rem_unsigned, 0, 0, 2, 1, 0x08) > +DEFOP (lsh, 0, 0, 2, 1, 0x09) > +DEFOP (rsh_signed, 0, 0, 2, 1, 0x0a) > +DEFOP (rsh_unsigned, 0, 0, 2, 1, 0x0b) > +DEFOP (trace, 0, 0, 2, 0, 0x0c) > +DEFOP (trace_quick, 1, 0, 1, 1, 0x0d) > +DEFOP (log_not, 0, 0, 1, 1, 0x0e) > +DEFOP (bit_and, 0, 0, 2, 1, 0x0f) > +DEFOP (bit_or, 0, 0, 2, 1, 0x10) > +DEFOP (bit_xor, 0, 0, 2, 1, 0x11) > +DEFOP (bit_not, 0, 0, 1, 1, 0x12) > +DEFOP (equal, 0, 0, 2, 1, 0x13) > +DEFOP (less_signed, 0, 0, 2, 1, 0x14) > +DEFOP (less_unsigned, 0, 0, 2, 1, 0x15) > +DEFOP (ext, 1, 0, 1, 1, 0x16) > +DEFOP (ref8, 0, 8, 1, 1, 0x17) > +DEFOP (ref16, 0, 16, 1, 1, 0x18) > +DEFOP (ref32, 0, 32, 1, 1, 0x19) > +DEFOP (ref64, 0, 64, 1, 1, 0x1a) > +DEFOP (ref_float, 0, 0, 1, 1, 0x1b) > +DEFOP (ref_double, 0, 0, 1, 1, 0x1c) > +DEFOP (ref_long_double, 0, 0, 1, 1, 0x1d) > +DEFOP (l_to_d, 0, 0, 1, 1, 0x1e) > +DEFOP (d_to_l, 0, 0, 1, 1, 0x1f) > +DEFOP (if_goto, 2, 0, 1, 0, 0x20) > +DEFOP (goto, 2, 0, 0, 0, 0x21) > +DEFOP (const8, 1, 8, 0, 1, 0x22) > +DEFOP (const16, 2, 16, 0, 1, 0x23) > +DEFOP (const32, 4, 32, 0, 1, 0x24) > +DEFOP (const64, 8, 64, 0, 1, 0x25) > +DEFOP (reg, 2, 0, 0, 1, 0x26) > +DEFOP (end, 0, 0, 0, 0, 0x27) > +DEFOP (dup, 0, 0, 1, 2, 0x28) > +DEFOP (pop, 0, 0, 1, 0, 0x29) > +DEFOP (zero_ext, 1, 0, 1, 1, 0x2a) > +DEFOP (swap, 0, 0, 2, 2, 0x2b) > +DEFOP (getv, 2, 0, 0, 1, 0x2c) > +DEFOP (setv, 2, 0, 0, 1, 0x2d) > +DEFOP (tracev, 2, 0, 0, 1, 0x2e) > +/* We need something here just to make the tables come out ok. =A0*/ > +DEFOP (invalid, 0, 0, 0, 0, 0x2f) > +DEFOP (trace16, 2, 0, 1, 1, 0x30) > +/* We need something here just to make the tables come out ok. =A0*/ > +DEFOP (invalid2, 0, 0, 0, 0, 0x2f) > +/* The "consumed" number for pick is wrong, but there's no way to > + =A0 express the right thing. =A0*/ > +DEFOP (pick, 1, 0, 0, 1, 0x32) > +DEFOP (rot, 0, 0, 3, 3, 0x33) > Index: gdbserver/Makefile.in > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/gdbserver/Makefile.in,v > retrieving revision 1.102 > diff -u -r1.102 Makefile.in > --- gdbserver/Makefile.in =A0 =A0 =A0 11 Feb 2011 09:57:25 -0000 =A0 =A0 = =A01.102 > +++ gdbserver/Makefile.in =A0 =A0 =A0 18 Feb 2011 21:10:10 -0000 > @@ -382,7 +382,7 @@ > =A0 =A0 =A0 =A0-fvisibility=3Dhidden > > =A0# In-process agent object rules > -tracepoint-ipa.o: tracepoint.c $(server_h) > +tracepoint-ipa.o: tracepoint.c $(server_h) $(srcdir)/../common/ax.def > =A0 =A0 =A0 =A0$(CC) -c $(IPAGENT_CFLAGS) $< -o tracepoint-ipa.o > =A0utils-ipa.o: utils.c $(server_h) > =A0 =A0 =A0 =A0$(CC) -c $(IPAGENT_CFLAGS) $< -o utils-ipa.o > @@ -410,7 +410,7 @@ > =A0server.o: server.c $(server_h) > =A0target.o: target.c $(server_h) > =A0thread-db.o: thread-db.c $(server_h) $(linux_low_h) $(gdb_proc_service= _h) > -tracepoint.o: tracepoint.c $(server_h) > +tracepoint.o: tracepoint.c $(server_h) $(srcdir)/../common/ax.def > =A0utils.o: utils.c $(server_h) > =A0gdbreplay.o: gdbreplay.c config.h > > Index: gdbserver/tracepoint.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/gdbserver/tracepoint.c,v > retrieving revision 1.18 > diff -u -r1.18 tracepoint.c > --- gdbserver/tracepoint.c =A0 =A0 =A018 Feb 2011 20:55:45 -0000 =A0 =A0 = =A01.18 > +++ gdbserver/tracepoint.c =A0 =A0 =A018 Feb 2011 21:10:14 -0000 > @@ -470,112 +470,19 @@ > > =A0enum gdb_agent_op > =A0 { > - =A0 =A0gdb_agent_op_float =3D 0x01, > - =A0 =A0gdb_agent_op_add =3D 0x02, > - =A0 =A0gdb_agent_op_sub =3D 0x03, > - =A0 =A0gdb_agent_op_mul =3D 0x04, > - =A0 =A0gdb_agent_op_div_signed =3D 0x05, > - =A0 =A0gdb_agent_op_div_unsigned =3D 0x06, > - =A0 =A0gdb_agent_op_rem_signed =3D 0x07, > - =A0 =A0gdb_agent_op_rem_unsigned =3D 0x08, > - =A0 =A0gdb_agent_op_lsh =3D 0x09, > - =A0 =A0gdb_agent_op_rsh_signed =3D 0x0a, > - =A0 =A0gdb_agent_op_rsh_unsigned =3D 0x0b, > - =A0 =A0gdb_agent_op_trace =3D 0x0c, > - =A0 =A0gdb_agent_op_trace_quick =3D 0x0d, > - =A0 =A0gdb_agent_op_log_not =3D 0x0e, > - =A0 =A0gdb_agent_op_bit_and =3D 0x0f, > - =A0 =A0gdb_agent_op_bit_or =3D 0x10, > - =A0 =A0gdb_agent_op_bit_xor =3D 0x11, > - =A0 =A0gdb_agent_op_bit_not =3D 0x12, > - =A0 =A0gdb_agent_op_equal =3D 0x13, > - =A0 =A0gdb_agent_op_less_signed =3D 0x14, > - =A0 =A0gdb_agent_op_less_unsigned =3D 0x15, > - =A0 =A0gdb_agent_op_ext =3D 0x16, > - =A0 =A0gdb_agent_op_ref8 =3D 0x17, > - =A0 =A0gdb_agent_op_ref16 =3D 0x18, > - =A0 =A0gdb_agent_op_ref32 =3D 0x19, > - =A0 =A0gdb_agent_op_ref64 =3D 0x1a, > - =A0 =A0gdb_agent_op_ref_float =3D 0x1b, > - =A0 =A0gdb_agent_op_ref_double =3D 0x1c, > - =A0 =A0gdb_agent_op_ref_long_double =3D 0x1d, > - =A0 =A0gdb_agent_op_l_to_d =3D 0x1e, > - =A0 =A0gdb_agent_op_d_to_l =3D 0x1f, > - =A0 =A0gdb_agent_op_if_goto =3D 0x20, > - =A0 =A0gdb_agent_op_goto =3D 0x21, > - =A0 =A0gdb_agent_op_const8 =3D 0x22, > - =A0 =A0gdb_agent_op_const16 =3D 0x23, > - =A0 =A0gdb_agent_op_const32 =3D 0x24, > - =A0 =A0gdb_agent_op_const64 =3D 0x25, > - =A0 =A0gdb_agent_op_reg =3D 0x26, > - =A0 =A0gdb_agent_op_end =3D 0x27, > - =A0 =A0gdb_agent_op_dup =3D 0x28, > - =A0 =A0gdb_agent_op_pop =3D 0x29, > - =A0 =A0gdb_agent_op_zero_ext =3D 0x2a, > - =A0 =A0gdb_agent_op_swap =3D 0x2b, > - =A0 =A0gdb_agent_op_getv =3D 0x2c, > - =A0 =A0gdb_agent_op_setv =3D 0x2d, > - =A0 =A0gdb_agent_op_tracev =3D 0x2e, > - =A0 =A0gdb_agent_op_trace16 =3D 0x30, > - =A0 =A0gdb_agent_op_pick =3D 0x32, > - =A0 =A0gdb_agent_op_rot =3D 0x33, > +#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) =A0\ > + =A0 =A0gdb_agent_op_ ## NAME =3D VALUE, > +#include "ax.def" > +#undef DEFOP > =A0 =A0 gdb_agent_op_last > =A0 }; > > =A0static const char *gdb_agent_op_names [gdb_agent_op_last] =3D > =A0 { > - =A0 =A0"?undef?", > - =A0 =A0"float", > - =A0 =A0"add", > - =A0 =A0"sub", > - =A0 =A0"mul", > - =A0 =A0"div_signed", > - =A0 =A0"div_unsigned", > - =A0 =A0"rem_signed", > - =A0 =A0"rem_unsigned", > - =A0 =A0"lsh", > - =A0 =A0"rsh_signed", > - =A0 =A0"rsh_unsigned", > - =A0 =A0"trace", > - =A0 =A0"trace_quick", > - =A0 =A0"log_not", > - =A0 =A0"bit_and", > - =A0 =A0"bit_or", > - =A0 =A0"bit_xor", > - =A0 =A0"bit_not", > - =A0 =A0"equal", > - =A0 =A0"less_signed", > - =A0 =A0"less_unsigned", > - =A0 =A0"ext", > - =A0 =A0"ref8", > - =A0 =A0"ref16", > - =A0 =A0"ref32", > - =A0 =A0"ref64", > - =A0 =A0"ref_float", > - =A0 =A0"ref_double", > - =A0 =A0"ref_long_double", > - =A0 =A0"l_to_d", > - =A0 =A0"d_to_l", > - =A0 =A0"if_goto", > - =A0 =A0"goto", > - =A0 =A0"const8", > - =A0 =A0"const16", > - =A0 =A0"const32", > - =A0 =A0"const64", > - =A0 =A0"reg", > - =A0 =A0"end", > - =A0 =A0"dup", > - =A0 =A0"pop", > - =A0 =A0"zero_ext", > - =A0 =A0"swap", > - =A0 =A0"getv", > - =A0 =A0"setv", > - =A0 =A0"tracev", > - =A0 =A0"?undef?", > - =A0 =A0"trace16", > - =A0 =A0"?undef?", > - =A0 =A0"pick", > - =A0 =A0"rot" > + =A0 =A0"?undef?" > +#define DEFOP(NAME, SIZE, DATA_SIZE, CONSUMED, PRODUCED, VALUE) =A0, # N= AME > +#include "ax.def" > +#undef DEFOP > =A0 }; > > =A0struct agent_expr > @@ -4297,6 +4204,16 @@ > > =A0#endif > > +/* A wrapper for gdb_agent_op_names that does some bounds-checking. =A0*/ > + > +static const char * > +gdb_agent_op_name (int op) > +{ > + =A0if (op < 0 || op >=3D gdb_agent_op_last || gdb_agent_op_names[op] = =3D=3D NULL) > + =A0 =A0return "?undef?"; > + =A0return gdb_agent_op_names[op]; > +} > + > =A0/* The agent expression evaluator, as specified by the GDB docs. It > =A0 =A0returns 0 if everything went OK, and a nonzero error code > =A0 =A0otherwise. =A0*/ > @@ -4690,7 +4607,7 @@ > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 trace_debug ("Op %s -> sp=3D%d, top=3D0x%s", > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0gdb_agent_op_names[op], sp, pulonges= t (top)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0gdb_agent_op_name (op), sp, pulonges= t (top)); > =A0 =A0 } > =A0} > > @@ -6000,11 +5917,11 @@ > =A0 =A0 =A0 if (emit_error) > =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0trace_debug ("Error %d while emitting code for %s\n", > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0emit_error, gdb_agent_op_nam= es[op]); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0emit_error, gdb_agent_op_nam= e (op)); > =A0 =A0 =A0 =A0 =A0return expr_eval_unhandled_opcode; > =A0 =A0 =A0 =A0} > > - =A0 =A0 =A0trace_debug ("Op %s compiled\n", gdb_agent_op_names[op]); > + =A0 =A0 =A0trace_debug ("Op %s compiled\n", gdb_agent_op_name (op)); > =A0 =A0 } > > =A0 /* Now fill in real addresses as goto destinations. =A0*/ >