summaryrefslogtreecommitdiff
path: root/gdb/gdbarch.sh
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-07-02 17:29:17 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-07-02 17:29:17 +0000
commit09c0172cede50a4ee46c5388a538ce27d63820f0 (patch)
treecfc26929f862ca6631230a7190ad872723ad51ae /gdb/gdbarch.sh
parent15f6c8b9307c65161c184bc6d30c84e86699c05f (diff)
downloadgdb-09c0172cede50a4ee46c5388a538ce27d63820f0.tar.gz
* gdbarch.sh (current_gdbarch): Remove global variable.
(find_arch_by_info): Remove, inline into ... (gdbarch_find_by_info): ... this. Remove current_gdbarch swapping. (deprecated_current_gdbarch_select_hack): Rename to ... (deprecated_target_gdbarch_select_hack): ... this. Do not set or access current_gdbarch. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Update call. (set_gdbarch_from_file): Likewise.
Diffstat (limited to 'gdb/gdbarch.sh')
-rwxr-xr-xgdb/gdbarch.sh69
1 files changed, 17 insertions, 52 deletions
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 326849a2ec7..51b8004314c 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -849,8 +849,6 @@ struct target_desc;
struct displaced_step_closure;
struct core_regset_section;
-extern struct gdbarch *current_gdbarch;
-
/* The architecture associated with the connection to the target.
The architecture vector provides some information that is really
@@ -975,8 +973,7 @@ extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
of all the previously created architures for this architecture
family. The (possibly NULL) ARCHES->gdbarch can used to access
values from the previously selected architecture for this
- architecture family. The global \`\`current_gdbarch'' shall not be
- used.
+ architecture family.
The INIT function shall return any of: NULL - indicating that it
doesn't recognize the selected architecture; an existing \`\`struct
@@ -1085,12 +1082,12 @@ extern int gdbarch_update_p (struct gdbarch_info info);
set, and then finished using gdbarch_info_fill.
Returns the corresponding architecture, or NULL if no matching
- architecture was found. "current_gdbarch" is not updated. */
+ architecture was found. */
extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
-/* Helper function. Set the global "current_gdbarch" to "gdbarch".
+/* Helper function. Set the global "target_gdbarch" to "gdbarch".
FIXME: kettenis/20031124: Of the functions that follow, only
gdbarch_from_bfd is supposed to survive. The others will
@@ -1098,7 +1095,7 @@ extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
multi-arch. However, for now we're still stuck with the concept of
a single active architecture. */
-extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch);
+extern void deprecated_target_gdbarch_select_hack (struct gdbarch *gdbarch);
/* Register per-architecture data-pointer.
@@ -1320,7 +1317,6 @@ cat <<EOF
/* startup_gdbarch() */
};
-struct gdbarch *current_gdbarch = &startup_gdbarch;
struct gdbarch *target_gdbarch = &startup_gdbarch;
EOF
@@ -1902,19 +1898,14 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
/* Find an architecture that matches the specified INFO. Create a new
- architecture if needed. Return that new architecture. Assumes
- that there is no current architecture. */
+ architecture if needed. Return that new architecture. */
-static struct gdbarch *
-find_arch_by_info (struct gdbarch_info info)
+struct gdbarch *
+gdbarch_find_by_info (struct gdbarch_info info)
{
struct gdbarch *new_gdbarch;
struct gdbarch_registration *rego;
- /* The existing architecture has been swapped out - all this code
- works from a clean slate. */
- gdb_assert (current_gdbarch == NULL);
-
/* Fill in missing parts of the INFO struct using a number of
sources: "set ..."; INFOabfd supplied; and the global
defaults. */
@@ -1926,24 +1917,24 @@ find_arch_by_info (struct gdbarch_info info)
if (gdbarch_debug)
{
fprintf_unfiltered (gdb_stdlog,
- "find_arch_by_info: info.bfd_arch_info %s\n",
+ "gdbarch_find_by_info: info.bfd_arch_info %s\n",
(info.bfd_arch_info != NULL
? info.bfd_arch_info->printable_name
: "(null)"));
fprintf_unfiltered (gdb_stdlog,
- "find_arch_by_info: info.byte_order %d (%s)\n",
+ "gdbarch_find_by_info: info.byte_order %d (%s)\n",
info.byte_order,
(info.byte_order == BFD_ENDIAN_BIG ? "big"
: info.byte_order == BFD_ENDIAN_LITTLE ? "little"
: "default"));
fprintf_unfiltered (gdb_stdlog,
- "find_arch_by_info: info.osabi %d (%s)\n",
+ "gdbarch_find_by_info: info.osabi %d (%s)\n",
info.osabi, gdbarch_osabi_name (info.osabi));
fprintf_unfiltered (gdb_stdlog,
- "find_arch_by_info: info.abfd %s\n",
+ "gdbarch_find_by_info: info.abfd %s\n",
host_address_to_string (info.abfd));
fprintf_unfiltered (gdb_stdlog,
- "find_arch_by_info: info.tdep_info %s\n",
+ "gdbarch_find_by_info: info.tdep_info %s\n",
host_address_to_string (info.tdep_info));
}
@@ -1956,7 +1947,7 @@ find_arch_by_info (struct gdbarch_info info)
if (rego == NULL)
{
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"No matching architecture\n");
return 0;
}
@@ -1969,7 +1960,7 @@ find_arch_by_info (struct gdbarch_info info)
if (new_gdbarch == NULL)
{
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"Target rejected architecture\n");
return NULL;
}
@@ -1982,7 +1973,7 @@ find_arch_by_info (struct gdbarch_info info)
struct gdbarch_list **list;
struct gdbarch_list *this;
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"Previous architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
new_gdbarch->bfd_arch_info->printable_name);
@@ -2004,7 +1995,7 @@ find_arch_by_info (struct gdbarch_info info)
/* It's a new architecture. */
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
"New architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
new_gdbarch->bfd_arch_info->printable_name);
@@ -2030,39 +2021,13 @@ find_arch_by_info (struct gdbarch_info info)
return new_gdbarch;
}
-struct gdbarch *
-gdbarch_find_by_info (struct gdbarch_info info)
-{
- struct gdbarch *new_gdbarch;
-
- /* Save the previously selected architecture, setting the global to
- NULL. This stops things like gdbarch->init() trying to use the
- previous architecture's configuration. The previous architecture
- may not even be of the same architecture family. The most recent
- architecture of the same family is found at the head of the
- rego->arches list. */
- struct gdbarch *old_gdbarch = current_gdbarch;
- current_gdbarch = NULL;
-
- /* Find the specified architecture. */
- new_gdbarch = find_arch_by_info (info);
-
- /* Restore the existing architecture. */
- gdb_assert (current_gdbarch == NULL);
- current_gdbarch = old_gdbarch;
-
- return new_gdbarch;
-}
-
/* Make the specified architecture current. */
void
-deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch)
+deprecated_target_gdbarch_select_hack (struct gdbarch *new_gdbarch)
{
gdb_assert (new_gdbarch != NULL);
- gdb_assert (current_gdbarch != NULL);
gdb_assert (new_gdbarch->initialized_p);
- current_gdbarch = new_gdbarch;
target_gdbarch = new_gdbarch;
observer_notify_architecture_changed (new_gdbarch);
registers_changed ();