summaryrefslogtreecommitdiff
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
commit59837fe086d095b2ce147ac6e3539f6843007f4f (patch)
treebda93985ec4a97fa9e42b3aee3d0db43e920d061
parente17a4113357102b55cfa5b80557d590a46a43300 (diff)
downloadbinutils-gdb-59837fe086d095b2ce147ac6e3539f6843007f4f.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.
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/arch-utils.c4
-rw-r--r--gdb/gdbarch.c58
-rw-r--r--gdb/gdbarch.h11
-rwxr-xr-xgdb/gdbarch.sh69
5 files changed, 49 insertions, 106 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 061ab4d69b2..155574db46a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+ * 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.
+
+2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
+
* defs.h (extract_signed_integer, extract_unsigned_integer,
extract_long_unsigned_integer, store_signed_integer,
store_unsigned_integer): Add BYTE_ORDER parameter.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 9e5e855fcc7..188dc9b6f77 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -504,7 +504,7 @@ gdbarch_update_p (struct gdbarch_info info)
"New architecture %s (%s) selected\n",
host_address_to_string (new_gdbarch),
gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
- deprecated_current_gdbarch_select_hack (new_gdbarch);
+ deprecated_target_gdbarch_select_hack (new_gdbarch);
return 1;
}
@@ -537,7 +537,7 @@ set_gdbarch_from_file (bfd *abfd)
if (gdbarch == NULL)
error (_("Architecture of file not recognized."));
- deprecated_current_gdbarch_select_hack (gdbarch);
+ deprecated_target_gdbarch_select_hack (gdbarch);
}
/* Initialize the current architecture. Update the ``set
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 1cf4f6c776d..db71a5c79e9 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -386,7 +386,6 @@ struct gdbarch startup_gdbarch =
/* startup_gdbarch() */
};
-struct gdbarch *current_gdbarch = &startup_gdbarch;
struct gdbarch *target_gdbarch = &startup_gdbarch;
/* Create a new ``struct gdbarch'' based on information provided by
@@ -3660,19 +3659,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. */
@@ -3684,24 +3678,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));
}
@@ -3714,7 +3708,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;
}
@@ -3727,7 +3721,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;
}
@@ -3740,7 +3734,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);
@@ -3762,7 +3756,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);
@@ -3788,39 +3782,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 ();
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 4b64af852f6..9ffef7e8c84 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -53,8 +53,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
@@ -919,8 +917,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
@@ -1029,12 +1026,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
@@ -1042,7 +1039,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.
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 ();