aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>2002-02-25 18:15:52 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>2002-02-25 18:15:52 +0000
commit19caaa451926df2ca71050758698fe8ef4a854c0 (patch)
tree17f106f3e4b178eb80fdb0be6747693d7c58d9f6
parent798bd83101cf19a7dd11d6e8c76018fc753da57d (diff)
downloadgdb-19caaa451926df2ca71050758698fe8ef4a854c0.zip
gdb-19caaa451926df2ca71050758698fe8ef4a854c0.tar.gz
gdb-19caaa451926df2ca71050758698fe8ef4a854c0.tar.bz2
* rs6000-nat.c (set_host_arch): Do not switch to a new architecture
if it already matches the current architecture from the exec file. Include arch-utils.h for gdbarch_info_init prototype. * Makefile.in (rs6000-nat.o): Update dependencies.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/rs6000-nat.c21
3 files changed, 28 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e153d08..e00dab6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-25 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
+
+ * rs6000-nat.c (set_host_arch): Do not switch to a new architecture
+ if it already matches the current architecture from the exec file.
+ Include arch-utils.h for gdbarch_info_init prototype.
+ * Makefile.in (rs6000-nat.o): Update dependencies.
+
2002-02-25 Eli Zaretskii <eliz@is.elta.co.il>
* config/djgpp/djconfig.sh: Set NM=nm and CFLAGS="-g -O2" in the
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index cf8b872..9ae5582 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1969,7 +1969,7 @@ rom68k-rom.o: rom68k-rom.c $(monitor_h) $(bfd_h) gdb_wait.h $(defs_h) \
rs6000-nat.o: rs6000-nat.c $(bfd_h) $(defs_h) $(inferior_h) $(target_h) \
$(gdbcore_h) $(xcoffsolib_h) $(symfile_h) $(objfiles_h) \
- $(gdb_stabs_h) $(regcache_h)
+ $(gdb_stabs_h) $(regcache_h) $(arch_utils_h)
rs6000-tdep.o: rs6000-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
$(target_h) ppc-tdep.h $(regcache_h) $(value_h) $(parser_defs_h)
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index f79e991..c2b1dd9 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -1,6 +1,6 @@
/* IBM RS/6000 native-dependent code for GDB, the GNU debugger.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000, 2001
+ 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GDB.
@@ -31,6 +31,7 @@
#include "bfd.h"
#include "gdb-stabs.h"
#include "regcache.h"
+#include "arch-utils.h"
#include <sys/ptrace.h>
#include <sys/reg.h>
@@ -928,6 +929,24 @@ set_host_arch (int pid)
arch = bfd_arch_powerpc;
mach = bfd_mach_ppc;
}
+
+ /* FIXME: schauer/2002-02-25:
+ We don't know if we are executing a 32 or 64 bit executable,
+ and have no way to pass the proper word size to rs6000_gdbarch_init.
+ So we have to avoid switching to a new architecture, if the architecture
+ matches already.
+ Blindly calling rs6000_gdbarch_init used to work in older versions of
+ GDB, as rs6000_gdbarch_init incorrectly used the previous tdep to
+ determine the wordsize. */
+ if (exec_bfd)
+ {
+ const struct bfd_arch_info *exec_bfd_arch_info;
+
+ exec_bfd_arch_info = bfd_get_arch_info (exec_bfd);
+ if (arch == exec_bfd_arch_info->arch)
+ return;
+ }
+
bfd_default_set_arch_mach (&abfd, arch, mach);
gdbarch_info_init (&info);