This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: initialize per-arch data in startup_gdbarch
Here's the (much simpler) patch that works the way you want, I think.
2001-06-06 Jim Blandy <jimb@redhat.com>
* gdbarch.sh: Changes to effect the following:
* gdbarch.c (initialize_non_multiarch): New function.
* gdbarch.h (initialize_non_multiarch): New declaration.
* arch-utils.c (initialize_current_architecture): For
non-multiarch configurations, call initialize_non_multiarch.
Index: gdb/arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.27
diff -c -r1.27 arch-utils.c
*** gdb/arch-utils.c 2001/05/10 18:36:26 1.27
--- gdb/arch-utils.c 2001/06/06 16:55:00
***************
*** 701,706 ****
--- 701,708 ----
"initialize_current_architecture: Selection of initial architecture failed");
}
}
+ else
+ initialize_non_multiarch ();
/* Create the ``set architecture'' command appending ``auto'' to the
list of architectures. */
Index: gdb/gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.61
diff -c -r1.61 gdbarch.c
*** gdb/gdbarch.c 2001/06/06 14:46:30 1.61
--- gdb/gdbarch.c 2001/06/06 16:55:03
***************
*** 387,392 ****
--- 387,401 ----
struct gdbarch *current_gdbarch = &startup_gdbarch;
+ /* Do any initialization needed for a non-multiarch configuration
+ after the _initialize_MODULE functions have been run. */
+ void
+ initialize_non_multiarch ()
+ {
+ alloc_gdbarch_data (&startup_gdbarch);
+ init_gdbarch_data (&startup_gdbarch);
+ }
+
/* Create a new ``struct gdbarch'' based on information provided by
``struct gdbarch_info''. */
Index: gdb/gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.49
diff -c -r1.49 gdbarch.h
*** gdb/gdbarch.h 2001/05/14 16:43:35 1.49
--- gdb/gdbarch.h 2001/06/06 16:55:04
***************
*** 1834,1839 ****
--- 1834,1843 ----
extern void initialize_current_architecture (void);
+ /* For non-multiarched targets, do any initialization of the default
+ gdbarch object necessary after the _initialize_MODULE functions
+ have run. */
+ extern void initialize_non_multiarch ();
/* gdbarch trace variable */
extern int gdbarch_debug;
Index: gdb/gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.64
diff -c -r1.64 gdbarch.sh
*** gdb/gdbarch.sh 2001/06/06 14:46:30 1.64
--- gdb/gdbarch.sh 2001/06/06 16:55:05
***************
*** 1065,1070 ****
--- 1065,1074 ----
extern void initialize_current_architecture (void);
+ /* For non-multiarched targets, do any initialization of the default
+ gdbarch object necessary after the _initialize_MODULE functions
+ have run. */
+ extern void initialize_non_multiarch ();
/* gdbarch trace variable */
extern int gdbarch_debug;
***************
*** 1246,1251 ****
--- 1250,1264 ----
};
struct gdbarch *current_gdbarch = &startup_gdbarch;
+
+ /* Do any initialization needed for a non-multiarch configuration
+ after the _initialize_MODULE functions have been run. */
+ void
+ initialize_non_multiarch ()
+ {
+ alloc_gdbarch_data (&startup_gdbarch);
+ init_gdbarch_data (&startup_gdbarch);
+ }
EOF
# Create a new gdbarch struct