This is the mail archive of the gdb-patches@sourceware.org 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]

[rfc] [08/17] Get rid of current_gdbarch in m2-lang.c



Hi,


this patch gets rid of some of the current_gdbarch's in m2-lang.c
Is this ok to commit?

ChangeLog:


* m2-lang.c: Add new include objfiles.h. (m2_create_fundamental_type): Use objfile->gdbarch to get at the current architecture. (build_m2_types): Replace current_gdbarch by gdbarch. * Makefile.in (m2-lang.o): Add dependency on objfile.h.



--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com




diff -urpN src/gdb/m2-lang.c dev/gdb/m2-lang.c
--- src/gdb/m2-lang.c	2007-09-23 18:25:05.000000000 +0200
+++ dev/gdb/m2-lang.c	2007-10-11 09:21:37.000000000 +0200
@@ -27,6 +27,7 @@
 #include "m2-lang.h"
 #include "c-lang.h"
 #include "valprint.h"
+#include "objfiles.h"
 
 extern void _initialize_m2_language (void);
 static struct type *m2_create_fundamental_type (struct objfile *, int);
@@ -204,7 +205,7 @@ m2_create_fundamental_type (struct objfi
          name "<?type?>".  When all the dust settles from the type
          reconstruction work, this should probably become an error. */
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "<?type?>", objfile);
       warning (_("internal error: no Modula fundamental type %d"), typeid);
       break;
@@ -240,96 +241,96 @@ m2_create_fundamental_type (struct objfi
       break;
     case FT_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "short", objfile);
       break;
     case FT_SIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "short", objfile);	/* FIXME-fnf */
       break;
     case FT_UNSIGNED_SHORT:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_short_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_short_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
       break;
     case FT_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "int", objfile);
       break;
     case FT_SIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "int", objfile);	/* FIXME -fnf */
       break;
     case FT_UNSIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
       break;
     case FT_FIXED_DECIMAL:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_int_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "fixed decimal", objfile);
       break;
     case FT_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);
       break;
     case FT_SIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "long", objfile);	/* FIXME -fnf */
       break;
     case FT_UNSIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_long_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
       break;
     case FT_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
+			gdbarch_long_long_bit (objfile->gdbarch)
 			  / TARGET_CHAR_BIT,
 			0, "long long", objfile);
       break;
     case FT_SIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
+			gdbarch_long_long_bit (objfile->gdbarch)
 			  / TARGET_CHAR_BIT,
 			0, "signed long long", objfile);
       break;
     case FT_UNSIGNED_LONG_LONG:
       type = init_type (TYPE_CODE_INT,
-			gdbarch_long_long_bit (current_gdbarch)
+			gdbarch_long_long_bit (objfile->gdbarch)
 			  / TARGET_CHAR_BIT,
 			TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
       break;
     case FT_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_float_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "float", objfile);
       break;
     case FT_DBL_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_double_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "double", objfile);
       break;
     case FT_FLOAT_DECIMAL:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_double_bit (current_gdbarch) / TARGET_CHAR_BIT,
+			gdbarch_double_bit (objfile->gdbarch) / TARGET_CHAR_BIT,
 			0, "floating decimal", objfile);
       break;
     case FT_EXT_PREC_FLOAT:
       type = init_type (TYPE_CODE_FLT,
-			gdbarch_long_double_bit (current_gdbarch)
+			gdbarch_long_double_bit (objfile->gdbarch)
 			  / TARGET_CHAR_BIT,
 			0, "long double", objfile);
       break;
     case FT_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_float_bit (current_gdbarch)
+			2 * gdbarch_float_bit (objfile->gdbarch)
 			  / TARGET_CHAR_BIT,
 			0, "complex", objfile);
       TYPE_TARGET_TYPE (type)
@@ -337,7 +338,7 @@ m2_create_fundamental_type (struct objfi
       break;
     case FT_DBL_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_double_bit (current_gdbarch)
+			2 * gdbarch_double_bit (objfile->gdbarch)
 			  / TARGET_CHAR_BIT,
 			0, "double complex", objfile);
       TYPE_TARGET_TYPE (type)
@@ -345,7 +346,7 @@ m2_create_fundamental_type (struct objfi
       break;
     case FT_EXT_PREC_COMPLEX:
       type = init_type (TYPE_CODE_COMPLEX,
-			2 * gdbarch_long_double_bit (current_gdbarch)
+			2 * gdbarch_long_double_bit (objfile->gdbarch)
 			  / TARGET_CHAR_BIT,
 			0, "long double complex", objfile);
       TYPE_TARGET_TYPE (type)
@@ -472,16 +473,16 @@ build_m2_types (struct gdbarch *gdbarch)
   /* Modula-2 "pervasive" types.  NOTE:  these can be redefined!!! */
   builtin_m2_type->builtin_int =
     init_type (TYPE_CODE_INT, 
-	       gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 	       0, "INTEGER", (struct objfile *) NULL);
   builtin_m2_type->builtin_card =
     init_type (TYPE_CODE_INT, 
-	       gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 	       TYPE_FLAG_UNSIGNED,
 	       "CARDINAL", (struct objfile *) NULL);
   builtin_m2_type->builtin_real =
     init_type (TYPE_CODE_FLT,
-	       gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT,
 	       0,
 	       "REAL", (struct objfile *) NULL);
   builtin_m2_type->builtin_char =
@@ -490,7 +491,7 @@ build_m2_types (struct gdbarch *gdbarch)
 	       "CHAR", (struct objfile *) NULL);
   builtin_m2_type->builtin_bool =
     init_type (TYPE_CODE_BOOL, 
-	       gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT,
+	       gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT,
 	       TYPE_FLAG_UNSIGNED,
 	       "BOOLEAN", (struct objfile *) NULL);
 
diff -urpN src/gdb/Makefile.in dev/gdb/Makefile.in
--- src/gdb/Makefile.in	2007-10-11 08:30:21.000000000 +0200
+++ dev/gdb/Makefile.in	2007-10-11 09:19:27.000000000 +0200
@@ -2251,7 +2251,7 @@ m2-exp.o: m2-exp.c $(defs_h) $(gdb_strin
 	$(objfiles_h) $(block_h)
 m2-lang.o: m2-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
 	$(parser_defs_h) $(language_h) $(m2_lang_h) $(c_lang_h) \
-	$(valprint_h)
+	$(valprint_h) $(objfiles_h)
 m2-typeprint.o: m2-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) \
 	$(symtab_h) $(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) \
 	$(m2_lang_h) $(target_h) $(language_h) $(demangle_h) $(c_lang_h) \




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