From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55834 invoked by alias); 1 Mar 2017 17:23:05 -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 55817 invoked by uid 89); 1 Mar 2017 17:23:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=*regcache, H*RU:209.85.128.182, Hx-languages-length:1547, sk:get_reg X-HELO: mail-wr0-f182.google.com Received: from mail-wr0-f182.google.com (HELO mail-wr0-f182.google.com) (209.85.128.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Mar 2017 17:23:03 +0000 Received: by mail-wr0-f182.google.com with SMTP id g10so35044145wrg.2 for ; Wed, 01 Mar 2017 09:23:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=ARV145zn81WZaXmcz+GDN0fQTGGFa7oB90IM6jCIsoQ=; b=EiB+pgkHkwfE6sfezyShPunin/HqBoB0nRK/PL3nbObGVrZYTrNFWlau9UDCfWvbJZ svzNXB3bQUaZHNaT0deUkQ7w4U7ZHy44hiJS3zcyODBn9Ez9F9WG4oZQWavqrGI9Lh2w WHJqdDNOM6sWn7FsNWf5hgZFqSoGN7WqJJiYQpyJ6HuWLurwo/Lk+ZTRMz4OUqJMY0wh 89rugoOuu/ClZiq/kEoG5kk/i2k30iyqGvwuhNUxr2DJ9vFkQcZYBOBvKTk9UiIij1zX K8HPJrEx5jSaK5NlyXlUGj4XwSYDLCMMx3yr2E56M70hxC800HLNvpS26YXFf73gnqyN RJLA== X-Gm-Message-State: AMke39kh5xwU4sMLEtPOy7VDK9LNXi+06pdjUC0f58yHzcBtQ2n6LGBF5kOMpw5W7veDXw== X-Received: by 10.223.151.138 with SMTP id s10mr8068953wrb.65.1488388981873; Wed, 01 Mar 2017 09:23:01 -0800 (PST) Received: from E107787-LIN ([194.214.185.158]) by smtp.gmail.com with ESMTPSA id o70sm7763553wmi.26.2017.03.01.09.23.00 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 01 Mar 2017 09:23:01 -0800 (PST) From: Yao Qi To: Alan Hayward Cc: "gdb-patches\@sourceware.org" , Subject: Re: [PATCH] Remove MAX_REGISTER_SIZE from target.c References: Date: Wed, 01 Mar 2017 17:23:00 -0000 In-Reply-To: (Alan Hayward's message of "Fri, 24 Feb 2017 10:08:58 +0000") Message-ID: <868toorjwz.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00010.txt.bz2 Alan Hayward writes: > +extern void regcache_debug_print_register (const char *func, > + struct regcache *regcache, > + int regno); Comments are needed. > + > #endif /* REGCACHE_H */ > diff --git a/gdb/regcache.c b/gdb/regcache.c > index f190eda0e47c5c03744fc26263505d1c30ea1ee8..31aa1baf7ef69c27c00e45e3c= 8d4eb3c41dc4203 100644 > --- a/gdb/regcache.c > +++ b/gdb/regcache.c > @@ -1259,6 +1259,42 @@ regcache_write_pc (struct regcache *regcache, CORE= _ADDR pc) > reinit_frame_cache (); > } > > +void > +regcache_debug_print_register (const char *func, struct regcache *regcac= he, > + int regno) > +{ > + struct gdbarch *gdbarch =3D get_regcache_arch (regcache); > + > + fprintf_unfiltered (gdb_stdlog, "%s ", func); > + if (regno >=3D 0 && regno < gdbarch_num_regs (gdbarch) > + && gdbarch_register_name (gdbarch, regno) !=3D NULL > + && gdbarch_register_name (gdbarch, regno)[0] !=3D '\0') > + fprintf_unfiltered (gdb_stdlog, "(%s)", > + gdbarch_register_name (gdbarch, regno)); > + else > + fprintf_unfiltered (gdb_stdlog, "(%d)", regno); > + if (regno >=3D 0 && regno < gdbarch_num_regs (gdbarch)) > + { > + enum bfd_endian byte_order =3D gdbarch_byte_order (gdbarch); > + int i, size =3D register_size (gdbarch, regno); > + gdb_byte *buf =3D register_buffer (regcache, regno); > + > + regcache_raw_collect (regcache, regno, buf); Don't need to call regcache_raw_collect, otherwise, the src and dst of copy is at the same address (register_buffer (regcache, regno)). --=20 Yao (=E9=BD=90=E5=B0=A7)