From: Michael Snyder <msnyder@specifix.com>
To: Tea <teawater@gmail.com>
Cc: Thiago Jung Bauermann <bauerman@br.ibm.com>, gdb-patches@sourceware.org
Subject: Re: about current_gdbarch
Date: Mon, 21 Apr 2008 19:37:00 -0000 [thread overview]
Message-ID: <1208801950.4615.97.camel@localhost.localdomain> (raw)
In-Reply-To: <daef60380804210259h73828d7eude60eac272c84b1a@mail.gmail.com>
On Mon, 2008-04-21 at 17:59 +0800, Tea wrote:
> Hi Thiago,
>
> In your mail, you want me remove the "current_gdbarch" from my patch.
> But it's so hard to me.
> Because most of "current_gdbarch" is used in function "record_message"
> and sub-function of it(such as i386_record and mips_record).
> "record_message" will be called by function "resume" that use a lot of
> "current_gdbarch" in it. So I think get current gdbarch without
> "current_gdbarch" is so hard.
>
> Could you please help me about it? Or let me keep "current_gdbarch" in
> current time. Maybe I can remove it in the future.
gdbarch is a data structure that's meant to be passed around
as a token to the various functions that will use it. It's
a relatively new interface (though it's been in place for a
number of years now).
"current_gdbarch" is a cheat -- a global constant -- that
we have allowed ourselves to use while we transition various
parts of gdb into using the gdbarch interface.
I think what you are being encouraged to do is, rather than
just using the global constant whenever you need it, start
at highest possible level of calling into your code (eg.
"record_message" in infrun.c) and pass in a pointer to
current_gdbarch (assuming an actual gdbarch pointer is not
available). Then let the rest of your code pass that pointer
around, and use it instead of using the global.
That way, eventually, we only have one reference to the
global "current_gdbarch" to get rid of, instead of many.
Michael
next prev parent reply other threads:[~2008-04-21 18:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-21 12:55 Tea
2008-04-21 19:37 ` Michael Snyder [this message]
2008-04-22 5:16 ` Tea
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=1208801950.4615.97.camel@localhost.localdomain \
--to=msnyder@specifix.com \
--cc=bauerman@br.ibm.com \
--cc=gdb-patches@sourceware.org \
--cc=teawater@gmail.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