From: Doug Evans <dje@google.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Add call to prune_program_spaces in mi_cmd_remove_inferior
Date: Mon, 29 Sep 2014 23:16:00 -0000 [thread overview]
Message-ID: <CADPb22ShP-iS7xeZpMx56w7jL9SUE=uV98C-Gp+nRbJwfq3w+w@mail.gmail.com> (raw)
In-Reply-To: <54299B61.7030107@ericsson.com>
On Mon, Sep 29, 2014 at 10:48 AM, Simon Marchi
<simon.marchi@ericsson.com> wrote:
> [...]
> If we tie the creation/deletion of program spaces with the creation/deletion of
> inferiors, could we go further and tie the concept of current program space and
> current inferior? I see very often a set_current_inferior (inf) followed by a
> set_current_program_space (inf->pspace). I don't really know when we would want
> a current program space that is not the program space of our current inferior.
This would be nice alright.
There are special cases, which we can handle in whatever way works,
but IWBN if this was the normal way of maintaining such state -
anytime we can remove unnecessary global state "works for me".
> From what I can see, the only times set_current_program_space is called alone
> is in constructs like this:
>
> old_chain = save_current_program_space ();
> ALL_PSPACES (ss)
> {
> set_current_program_space (ss);
> clear_section_table (current_target_sections);
> exec_close ();
> }
> do_cleanups (old_chain);
>
> where exec_close accesses the global "current_program_space". So in reality,
> it is passing a parameter indirectly using a global variable. I suppose we should
> rather see:
>
> ALL_PSPACES (ss)
> {
> clear_section_table (current_target_sections);
current_target_sections is actually a member of the
current_program_space, so this could be improved even more (gotta love
macros ...).
> exec_close (ss);
> }
>
> I realize that there is a lot of such indirect parameter passing in gdb. It
> wouldn't be easy do to such a change, but I think it would help in many regards.
Agreed!
I think it's a longterm todo on everyone's list.
prev parent reply other threads:[~2014-09-29 23:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-24 21:19 Simon Marchi
2014-09-24 22:43 ` Doug Evans
2014-09-25 15:07 ` Simon Marchi
2014-09-28 20:16 ` Doug Evans
2014-09-28 20:54 ` Doug Evans
2014-09-29 17:48 ` Simon Marchi
2014-09-29 23:16 ` Doug Evans [this message]
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='CADPb22ShP-iS7xeZpMx56w7jL9SUE=uV98C-Gp+nRbJwfq3w+w@mail.gmail.com' \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@ericsson.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