Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Cc: Morichetti@sourceware.org, Laurent <Laurent.Morichetti@amd.com>
Subject: Re: [PATCH 2/4] gdb: move regcache::regcaches to regcache.c
Date: Thu, 23 Jul 2020 21:03:14 +0100	[thread overview]
Message-ID: <09e7d7ca-1af0-f93e-6df5-7ad148c2e134@palves.net> (raw)
In-Reply-To: <20200720204101.2849535-3-simon.marchi@efficios.com>

On 7/20/20 9:40 PM, Simon Marchi via Gdb-patches wrote:
> I don't really understand why `regcache_thread_ptid_changed` is a static
> method of `struct regcache` instead of being a static free function in
> regcache.c.  And I don't understand why `current_regcache` is a static
> member of `struct regcache` instead of being a static global in
> regcache.c.  It's not wrong per-se, but there's no other place where we
> do it like this in GDB (as far as I remember) and it just exposes things
> unnecessarily in the .h.

current_regcache was made a static member of struct regcache in:

 commit e521e87e8514b9d3497208b70bcd067f132c58ed
 Author:     Yao Qi <yao.qi@linaro.org>
 AuthorDate: Wed May 24 22:15:23 2017 +0100

    Move current_regcache to regcache::current_regcache

 https://sourceware.org/pipermail/gdb-patches/2017-May/140583.html

which was needed for:

 commit b77b02a5ca5a021ee8b5e5453e8843447d1132b2
 Author:     Yao Qi <yao.qi@linaro.org>
 AuthorDate: Wed May 24 22:15:23 2017 +0100

    Add unit test to gdbarch methods register_to_value and value_to_register

 https://sourceware.org/pipermail/gdb-patches/2017-May/140589.html

But then later I redesigned the mocking environment:

 commit 55b11ddf16b97b9c50ed480bc9da8b3e1c6c4198
 Author:     Pedro Alves <palves@redhat.com>
 AuthorDate: Wed Oct 4 18:21:09 2017 +0100

    Redesign mock environment for gdbarch selftests

 https://sourceware.org/legacy-ml/gdb-patches/2017-10/msg00022.html

... and that got rid of the need to expose current_regcache.

> 
> Move them to be just static in regcache.c.  As a result,
> registers_changed_ptid doesn't need to be friend of the regcache class
> anymore.
> 
> Removing the include of forward_list in regcache.h showed that we were
> missing an include for it in dwarf2/index-write.c, record-btrace.c and
> sparc64-tdep.c.
> 
> gdb/ChangeLog:
> 
> 	* regcache.h (class regcache): Remove friend
> 	registers_changed_ptid.
> 	<regcache_thread_ptid_changed>: Remove.
> 	<regcaches>: Remove.
> 	* regcache.c (regcache::regcaches): Rename to...
> 	(regcaches): ... this.  Make static.
> 	(get_thread_arch_aspace_regcache): Update.
> 	(regcache::regcache_thread_ptid_changed): Rename to...
> 	(regcache_thread_ptid_changed): ... this.  Update.
> 	(class regcache_access): Remove.
> 	(regcaches_test): Update.
> 	(_initialize_regcache): Update.
> 	* sparc64-tdep.c, dwarf2/index-write.c, record-btrace.c: Include
> 	<forward_list>.
> 

OK.

Thanks,
Pedro Alves


  reply	other threads:[~2020-07-23 20:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-20 20:40 [PATCH 0/4] Regcache fix and optimization Simon Marchi
2020-07-20 20:40 ` [PATCH 1/4] gdb: rename regcache::current_regcache to regcache::regcaches Simon Marchi
2020-07-23 20:01   ` Pedro Alves
2020-07-20 20:40 ` [PATCH 2/4] gdb: move regcache::regcaches to regcache.c Simon Marchi
2020-07-23 20:03   ` Pedro Alves [this message]
2020-07-20 20:41 ` [PATCH 3/4] gdb: pass target to thread_ptid_changed observable Simon Marchi
2020-07-23 20:42   ` Pedro Alves
2020-07-30 15:27     ` Simon Marchi
2020-08-05 14:50       ` Pedro Alves
2020-08-05 19:08         ` Simon Marchi
2020-08-05 22:29           ` Pedro Alves
2020-07-20 20:41 ` [PATCH 4/4] gdb: change regcache list to be a map Simon Marchi
2020-07-24  1:53   ` Pedro Alves
2020-07-24 16:59     ` John Baldwin
2020-07-30 16:26       ` Simon Marchi
2020-07-30 16:58     ` Simon Marchi
2020-07-30 17:03       ` Simon Marchi
2020-08-05 18:02         ` Pedro Alves
2020-08-05 20:25           ` Simon Marchi
2020-07-30 17:07       ` Simon Marchi
2020-07-30 18:17     ` Simon Marchi
2020-08-05 18:14       ` Pedro Alves
2020-08-10 19:15   ` Tom Tromey
2020-08-10 19:25     ` Simon Marchi
2020-08-12 12:52   ` Tom Tromey
2020-08-12 15:17     ` Tom Tromey
2020-08-06 20:27 ` [PATCH 0/4] Regcache fix and optimization Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09e7d7ca-1af0-f93e-6df5-7ad148c2e134@palves.net \
    --to=pedro@palves.net \
    --cc=Laurent.Morichetti@amd.com \
    --cc=Morichetti@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox