This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [04/17] Get rid of current_gdbarch: Prepare struct objfile
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>, Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Thu, 11 Oct 2007 10:53:47 +0200
- Subject: [rfc] [04/17] Get rid of current_gdbarch: Prepare struct objfile
Hi,
this patch comes from Ulrich Weigand. It adds "struct gdbarch" to "struct obfiles" to have the possibility
to refer to each objfiles's architecture. Most of the following patches are depending on this one.
Is this ok to commit?
ChangeLog:
* objfiles.h (struct objfile): Add gdbarch.
* objfiles.c: Add include arch-utils.h.
(allocate_objfile): Add gdbarch to newly allocated objfile.
* Makefile.in (objfiles.o): Add dependency on arch-utils.h.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urpN src/gdb/Makefile.in dev/gdb/Makefile.in
--- src/gdb/Makefile.in 2007-10-09 11:33:24.000000000 +0200
+++ dev/gdb/Makefile.in 2007-10-11 08:26:34.000000000 +0200
@@ -2427,7 +2427,7 @@ objfiles.o: objfiles.c $(defs_h) $(bfd_h
$(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(mdebugread_h) \
$(gdb_assert_h) $(gdb_stat_h) $(gdb_obstack_h) $(gdb_string_h) \
$(hashtab_h) $(breakpoint_h) $(block_h) $(dictionary_h) $(source_h) \
- $(parser_defs_h) $(expression_h)
+ $(parser_defs_h) $(expression_h) $(arch_utils_h)
observer.o: observer.c $(defs_h) $(observer_h) $(command_h) $(gdbcmd_h) \
$(observer_inc)
obsd-tdep.o: obsd-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(obsd_tdep_h)
diff -urpN src/gdb/objfiles.c dev/gdb/objfiles.c
--- src/gdb/objfiles.c 2007-08-23 20:08:36.000000000 +0200
+++ dev/gdb/objfiles.c 2007-10-11 08:25:49.000000000 +0200
@@ -47,6 +47,7 @@
#include "block.h"
#include "dictionary.h"
#include "source.h"
+#include "arch-utils.h"
/* Prototypes for local functions */
@@ -186,6 +187,8 @@ allocate_objfile (bfd *abfd, int flags)
}
if (abfd != NULL)
{
+ objfile->gdbarch = gdbarch_from_bfd (abfd);
+
objfile->name = xstrdup (bfd_get_filename (abfd));
objfile->mtime = bfd_get_mtime (abfd);
diff -urpN src/gdb/objfiles.h dev/gdb/objfiles.h
--- src/gdb/objfiles.h 2007-08-23 20:08:36.000000000 +0200
+++ dev/gdb/objfiles.h 2007-10-11 08:23:25.000000000 +0200
@@ -229,6 +229,10 @@ struct objfile
bfd *obfd;
+ /* The gdbarch associated with the BFD. */
+
+ struct gdbarch *gdbarch;
+
/* The modification timestamp of the object file, as of the last time
we read its symbols. */