Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PP?] [PATCH v2 12/16] Change remove_target_sections to method on program_space
Date: Wed, 28 Oct 2020 19:24:06 -0600	[thread overview]
Message-ID: <874kmdakp5.fsf@tromey.com> (raw)
In-Reply-To: <64804345-db3f-d562-6e82-137fb577df41@simark.ca> (Simon Marchi's message of "Tue, 20 Oct 2020 10:40:49 -0400")

>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:

>> void
>> -remove_target_sections (void *owner)
>> +program_space::remove_target_sections (void *owner)

Simon> Would it make sense to make a subsequent patch that just moves this
Simon> method to progspace.c?  I think it's ok to leave it in exec.c in this
Simon> patch, so we can more easily see the diff, but I think in the end it
Simon> belongs to progspace.c.

Yeah, makes sense to me.

Simon> The only thing that doesn't belong to progspace.c in this method is:

Simon>   unpush_target (&exec_ops);

Simon> But I think it just means that we need better decoupling.  We could have
Simon> a "program_space_target_sections_changed" observer, which exec.c would
Simon> attach to, and push/unpush as necessary.

I am not totally sure.  Sometimes observers make the code more obscure.

>> -	  if (inf->pspace != curr_pspace)
>> +	  if (inf->pspace != this)
>> continue;
>> 
>> if (!inf->pspace->target_sections.empty ())

Simon> This line can be simplified, I believe:

Simon>   if (!this->target_sections.empty ())

Simon> (you can omit `this` to be consistent with the rest of the code, I just
Simon> happen to like using `this` to access fields that aren't prefixed with
Simon> `m_`, for clarity)

Thanks for pointing this out.  I think the entire 'if' can be removed,
because we already know from an outer 'if' that target_sections is
empty.

Tom

  reply	other threads:[~2020-10-29  1:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 21:44 [PATCH v2 00/16] Remove some macros from exec.h and progspace.h Tom Tromey
2020-10-19 21:44 ` [PATCH v2 01/16] Add target_section constructor Tom Tromey
2020-10-19 21:44 ` [PATCH v2 02/16] Remove exec_filename macro Tom Tromey
2020-10-19 21:44 ` [PATCH v2 03/16] Change exec_close to be a method on program_space Tom Tromey
2020-10-19 21:44 ` [PATCH v2 04/16] Remove commented-out code from gcore.c Tom Tromey
2020-10-20 14:01   ` [PP?] " Simon Marchi
2020-10-29  1:19     ` Tom Tromey
2020-10-19 21:44 ` [PATCH v2 05/16] Remove exec_bfd_mtime define Tom Tromey
2020-10-19 21:44 ` [PATCH v2 06/16] Remove current_target_sections macro Tom Tromey
2020-10-19 21:44 ` [PATCH v2 07/16] Remove the exec_bfd macro Tom Tromey
2020-10-20 14:24   ` Simon Marchi
2020-10-20 21:20     ` Tom Tromey
2020-10-20 21:34       ` Simon Marchi
2020-10-19 21:44 ` [PATCH v2 08/16] Change program_space::ebfd to a gdb_bfd_ref_ptr Tom Tromey
2020-10-19 21:44 ` [PATCH v2 09/16] Remove symfile_objfile macro Tom Tromey
2020-10-19 21:44 ` [PATCH v2 10/16] Change clear_program_space_solib_cache to method on program_space Tom Tromey
2020-10-19 21:44 ` [PATCH v2 11/16] Change program_space_empty_p " Tom Tromey
2020-10-19 21:44 ` [PATCH v2 12/16] Change remove_target_sections " Tom Tromey
2020-10-20 14:40   ` [PP?] " Simon Marchi
2020-10-29  1:24     ` Tom Tromey [this message]
2020-10-19 21:44 ` [PATCH v2 13/16] Change add_target_sections " Tom Tromey
2020-10-19 21:44 ` [PATCH v2 14/16] Change add_target_sections_of_objfile " Tom Tromey
2020-10-19 21:44 ` [PATCH v2 15/16] Don't change current program space in exec_target::close Tom Tromey
2020-10-19 21:44 ` [PATCH v2 16/16] Remove call to exec_close Tom Tromey
2020-10-20 14:46 ` [PP?] [PATCH v2 00/16] Remove some macros from exec.h and progspace.h Simon Marchi
2020-10-29 21:06   ` Tom Tromey

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=874kmdakp5.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /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