aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-05-04 15:21:05 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-05-04 15:21:05 +0000
commita7f1256dcb5a9bb35c3cb4bb659aeb1ac310c2c5 (patch)
tree00b60b3e417f730b6c7c54c17fb0e00e4c5fce08
parentb2de52bb5aa3fdd52a80d4d91cc4b55d530f4164 (diff)
downloadgdb-a7f1256dcb5a9bb35c3cb4bb659aeb1ac310c2c5.zip
gdb-a7f1256dcb5a9bb35c3cb4bb659aeb1ac310c2c5.tar.gz
gdb-a7f1256dcb5a9bb35c3cb4bb659aeb1ac310c2c5.tar.bz2
* arch-utils.c (gdbarch_update_p): Use default values for
info.abfd and info.target_desc if they are NULL. (gdbarch_from_bfd): Remove assertion. (set_gdbarch_from_file): Call gdbarch_find_by_info directly, using the current target description. (gdbarch_info_fill): Do not use default values for info->abfd and info->target_desc.
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/arch-utils.c39
2 files changed, 29 insertions, 20 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d213967..06d2870 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,13 @@
+2008-05-04 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * arch-utils.c (gdbarch_update_p): Use default values for
+ info.abfd and info.target_desc if they are NULL.
+ (gdbarch_from_bfd): Remove assertion.
+ (set_gdbarch_from_file): Call gdbarch_find_by_info directly,
+ using the current target description.
+ (gdbarch_info_fill): Do not use default values for info->abfd
+ and info->target_desc.
+
2008-05-04 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (reread_symbols): Reload EXEC_BFD on its change.
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index c1816da..259d1e3 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -466,7 +466,19 @@ set_architecture (char *ignore_args, int from_tty, struct cmd_list_element *c)
int
gdbarch_update_p (struct gdbarch_info info)
{
- struct gdbarch *new_gdbarch = gdbarch_find_by_info (info);
+ struct gdbarch *new_gdbarch;
+
+ /* Check for the current file. */
+ if (info.abfd == NULL)
+ info.abfd = exec_bfd;
+ if (info.abfd == NULL)
+ info.abfd = core_bfd;
+
+ /* Check for the current target description. */
+ if (info.target_desc == NULL)
+ info.target_desc = target_current_description ();
+
+ new_gdbarch = gdbarch_find_by_info (info);
/* If there no architecture by that name, reject the request. */
if (new_gdbarch == NULL)
@@ -507,14 +519,6 @@ struct gdbarch *
gdbarch_from_bfd (bfd *abfd)
{
struct gdbarch_info info;
-
- /* If we call gdbarch_find_by_info without filling in info.abfd,
- then it will use the global exec_bfd. That's fine if we don't
- have one of those either. And that's the only time we should
- reach here with a NULL ABFD argument - when we are discarding
- the executable. */
- gdb_assert (abfd != NULL || exec_bfd == NULL);
-
gdbarch_info_init (&info);
info.abfd = abfd;
return gdbarch_find_by_info (info);
@@ -526,9 +530,14 @@ gdbarch_from_bfd (bfd *abfd)
void
set_gdbarch_from_file (bfd *abfd)
{
+ struct gdbarch_info info;
struct gdbarch *gdbarch;
- gdbarch = gdbarch_from_bfd (abfd);
+ gdbarch_info_init (&info);
+ info.abfd = abfd;
+ info.target_desc = target_current_description ();
+ gdbarch = gdbarch_find_by_info (info);
+
if (gdbarch == NULL)
error (_("Architecture of file not recognized."));
deprecated_current_gdbarch_select_hack (gdbarch);
@@ -668,16 +677,6 @@ gdbarch_info_init (struct gdbarch_info *info)
void
gdbarch_info_fill (struct gdbarch_info *info)
{
- /* Check for the current file. */
- if (info->abfd == NULL)
- info->abfd = exec_bfd;
- if (info->abfd == NULL)
- info->abfd = core_bfd;
-
- /* Check for the current target description. */
- if (info->target_desc == NULL)
- info->target_desc = target_current_description ();
-
/* "(gdb) set architecture ...". */
if (info->bfd_arch_info == NULL
&& target_architecture_user)