From: Orjan Friberg <orjan.friberg@axis.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [rfc] Swap out current when creating a new architecture
Date: Mon, 01 Oct 2001 04:34:00 -0000 [thread overview]
Message-ID: <3BB854B3.208DC17A@axis.com> (raw)
In-Reply-To: <3BB771A1.4070201@cygnus.com>
Andrew Cagney wrote:
>
> The CRIS target also dumps core with it applied. Like rs6000 was, it is
> refering to the previous (current_gdbarch) architecture.
>
> I'll sit on this for a bit longer. Could I encourage target maintainers
> to check their XXX_gdbarch_init() function for references to
> current_gdbarch.
Just a quick recap: what the old code was doing by referring to
current_gdbarch was to avoid changing the ABI (which I infer from the
bfd) if one of the other target specific commands were being used. The
patch below sets the abfd field in the info struct to exec_bfd before
calling gdbarch_update_p, so that information on the current bfd is
passed along, just as it is when gdbarch_update_p is called from
set_gdbarch_from_file.
Is this an acceptable way of doing it? I know I'm in the risky business
of dealing with global pointers. (I'm assuming a commit could go on
both trunk and branch.)
2001-10-01 Orjan Friberg <orjanf@axis.com>
* cris-tdep.c (cris_gdbarch_init): Remove reference to current_gdbarch.
(cris_version_update, cris_mode_update, cris_abi_update): Set abfd in
info struct to exec_bfd.
Index: cris-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/cris-tdep.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 cris-tdep.c
*** cris-tdep.c 2001/09/24 08:04:10 1.4
--- cris-tdep.c 2001/10/01 10:58:11
*************** cris_version_update (char *ignore_args,
*** 3596,3601 ****
--- 3596,3605 ----
/* Update the current architecture, if needed. */
memset (&info, 0, sizeof info);
+
+ /* Supply the current bfd (if any). */
+ info.abfd = exec_bfd;
+
if (!gdbarch_update_p (info))
internal_error (__FILE__, __LINE__, "cris_gdbarch_update:
failed to update architecture.");
}
*************** cris_mode_update (char *ignore_args, int
*** 3614,3619 ****
--- 3618,3627 ----
/* Update the current architecture, if needed. */
memset (&info, 0, sizeof info);
+
+ /* Supply the current bfd (if any). */
+ info.abfd = exec_bfd;
+
if (!gdbarch_update_p (info))
internal_error (__FILE__, __LINE__, "cris_gdbarch_update:
failed to update architecture.");
}
*************** cris_abi_update (char *ignore_args, int
*** 3632,3637 ****
--- 3640,3649 ----
/* Update the current architecture, if needed. */
memset (&info, 0, sizeof info);
+
+ /* Supply the current bfd (if any). */
+ info.abfd = exec_bfd;
+
if (!gdbarch_update_p (info))
internal_error (__FILE__, __LINE__, "cris_gdbarch_update:
failed to update architecture.");
}
*************** cris_gdbarch_init (struct gdbarch_info i
*** 3736,3748 ****
/* Unknown bfd flavour. Assume it's the new ABI. */
cris_abi = CRIS_ABI_V2;
}
- }
- else if (gdbarch_tdep (current_gdbarch))
- {
- /* No bfd available. Stick with whatever ABI we're currently
using.
- (This is to avoid changing the ABI when the user updates the
- architecture with the 'set cris-version' command.) */
- cris_abi = gdbarch_tdep (current_gdbarch)->cris_abi;
}
else
{
--- 3748,3753 ----
--
Orjan Friberg E-mail: orjan.friberg@axis.com
Axis Communications AB Phone: +46 46 272 17 68
next prev parent reply other threads:[~2001-10-01 4:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3BB16441.30805@cygnus.com>
2001-09-26 22:56 ` Kevin Buettner
2001-09-26 23:06 ` Andrew Cagney
2001-09-30 12:25 ` Andrew Cagney
2001-10-01 4:34 ` Orjan Friberg [this message]
2001-10-14 17:07 ` Andrew Cagney
2001-10-15 18:41 ` Andrew Cagney
2001-10-16 1:59 ` Orjan Friberg
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=3BB854B3.208DC17A@axis.com \
--to=orjan.friberg@axis.com \
--cc=ac131313@cygnus.com \
--cc=gdb-patches@sources.redhat.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