(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>
+
+ * 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,
"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;
}
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
/* startup_gdbarch() */
};
-struct gdbarch *current_gdbarch = &startup_gdbarch;
struct gdbarch *target_gdbarch = &startup_gdbarch;
/* Create a new ``struct gdbarch'' based on information provided by
/* 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. */
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));
}
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;
}
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;
}
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);
/* 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);
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 ();
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
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
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
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.
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
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
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
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.
/* startup_gdbarch() */
};
-struct gdbarch *current_gdbarch = &startup_gdbarch;
struct gdbarch *target_gdbarch = &startup_gdbarch;
EOF
/* 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. */
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));
}
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;
}
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;
}
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);
/* 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);
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 ();