This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/hack] Force very early initialization of gdbtypes


Hello,

The attached patch forces the very early initialization of gdbtypes. This in turn stops problems with code trying to refer to uninitialized gdbtype data.

The ``correct fix'' is for gdbtypes to initialize itself on-demand. Unfortunatly, at present the language files contain static initializers that take the address of these global gdbtype variables :-(

Andrew

PS: I'll fill in the pr number and commit it once I've got notification back from prms.

2002-06-09  Andrew Cagney  <ac131313@redhat.com>

	* Makefile.in (init.c): Move the call to _initialize_gdbtypes to
	the front of the initialize list.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.205
diff -u -r1.205 Makefile.in
--- Makefile.in	31 May 2002 00:59:13 -0000	1.205
+++ Makefile.in	9 Jun 2002 14:30:06 -0000
@@ -843,7 +843,15 @@
 # list includes a file twice (because of some mistake somewhere else) 
 # the _initialize_* function will be included twice in init.c. Second, 
 # init.c may force unnecessary files to be linked in.
-#
+
+# FIXME: cagney/2002-06-09: gdb/NNN: Force the order so that the first
+# call is to _initialize_gdbtypes.  This is a hack to ensure that all
+# the global type variables are initialized before anything else.  The
+# ``correct fix'' is to have all the builtin types made part of the
+# architecture and initialize them on-demand (using gdbarch_data) just
+# like everything else.  The catch is that other modules still take
+# the address of these builtin types forcing them to be variables,
+# sigh!
 
 INIT_FILES = $(OBS) $(TSOBS) $(CONFIG_OBS) $(CONFIG_INITS)
 init.c: $(INIT_FILES)
@@ -868,7 +876,8 @@
 	    -e 's,signals\.c,signals/signals\.c,' \
 	    -e 's|\([^  ][^     ]*\)|$(srcdir)/\1|g' | \
 	while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \
-	sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' > init.l-tmp
+	sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' | \
+	( echo _initialize_gdbtypes ; grep -v -e '^_initialize_gdbtypes$$' ) > init.l-tmp
 	@echo '/* Do not modify this file.  */' >>init.c-tmp
 	@echo '/* It is created automatically by the Makefile.  */'>>init.c-tmp
 	@echo '#include "defs.h"' >>init.c-tmp

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]