Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: deuling@de.ibm.com (Markus Deuling)
Cc: gdb-patches@sourceware.org (GDB Patches),
	        drow@false.org (Daniel Jacobowitz)
Subject: Re: [rfc] [01/05] Get rid of current_gdbarch in gdbarch.{c,h,sh}
Date: Thu, 08 Nov 2007 13:18:00 -0000	[thread overview]
Message-ID: <200711081318.lA8DI1q5012756@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <4731D20A.7020506@de.ibm.com> from "Markus Deuling" at Nov 07, 2007 03:56:10 PM

Markus Deuling wrote.

> Daniel Jacobowitz schrieb:
> > On Wed, Nov 07, 2007 at 12:11:00PM +0100, Markus Deuling wrote:
> >>       architecture.  This ensures that the new architectures initial
> >>       values are not influenced by the previous architecture.  Once
> >>       everything is parameterised with gdbarch, this will go away.  */
> >> -  struct gdbarch *current_gdbarch;
> >> +  struct gdbarch *gdbarch;
> > 
> > Please read the comment above this variable :-)
> > 
> 
> Hm, 
> 
> will gdbarch_alloc go away? I thought every target uses gdbarch_alloc to allocate a basic
> gdbarch structure and then it overwrites every necessary callback to fit to its architecture.
> 
> This patch just changes the name of current_gdbarch to gdbarch. For gdbarch_alloc current_gdbarch
> is a local variable invisible to the rest. Its not the global current_gdbarch what this patch changes.
> 
> For me its a bit confusing to have a global current_gdbarch and a local one. 

Of course it is a hack to have the local current_gdbarch shadowing the 
global one -- that is why the comment *says* it is a hack and should go
away at some time in future ("once everything is parameterised with gdbarch").

However, as your patch *implements* what the comment describes -- as of
right now, there are no macros implicitly using current_gdbarch any more,
and thus there is no need for the local current_gdbarch hack -- it does
not make any sense to leave the comment unchanged once your patch is in.

I would suggest you simply remove this comment as part of your patch.
Also, there is another comment that needs to be updated:

        # Variable declarations can refer to ``current_gdbarch'' which
        # will contain the current architecture.  Care should be
        # taken.

(at the description of "postdefault" in the loop immediately preceding
function_list).

In general, having stale comments in the code can be very confusing
for developers working on that code in the future, so when you work
on a patch, making sure comments are added/removed/changed as
appropriate is just as important as making sure the code changes
themselves are correct ...


Finally, I do think the change in inself is correct (provided the comments
are adapted).  In fact, the very same should be done to the other two
functions in gdbarch.sh that use the "local current_gdbarch variable" hack,
verify_gdbarch and gdbarch_dump.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  parent reply	other threads:[~2007-11-08 13:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 11:13 Markus Deuling
2007-11-07 12:59 ` Daniel Jacobowitz
2007-11-07 14:58   ` Markus Deuling
2007-11-07 15:05     ` Daniel Jacobowitz
2007-11-08 13:18     ` Ulrich Weigand [this message]
2007-11-09  7:30       ` Markus Deuling
2007-11-09 13:19         ` Ulrich Weigand
2007-11-12  6:48           ` Markus Deuling

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=200711081318.lA8DI1q5012756@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=deuling@de.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /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