This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [05/17] Get rid of current_gdbarch in c-lang.c
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Thu, 11 Oct 2007 10:53:50 +0200
- Subject: [rfc] [05/17] Get rid of current_gdbarch in c-lang.c
Hi,
this patch gets rid of some of the current_gdbarch's in c-lang.c
Is this ok to commit?
ChangeLog:
* c-lang.c: Add new include objfiles.h
(c_create_fundamental_type): Use objfile->gdbarch to get
at the current architecture.
* Makefile.in (c-lang.o): Add dependency on objfile.h.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urpN src/gdb/c-lang.c dev/gdb/c-lang.c
--- src/gdb/c-lang.c 2007-09-23 18:25:05.000000000 +0200
+++ dev/gdb/c-lang.c 2007-10-11 09:29:00.000000000 +0200
@@ -33,6 +33,7 @@
#include "demangle.h"
#include "cp-abi.h"
#include "cp-support.h"
+#include "objfiles.h"
extern void _initialize_c_language (void);
static void c_emit_char (int c, struct ui_file * stream, int quoter);
@@ -217,7 +218,7 @@ c_create_fundamental_type (struct objfil
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 C/C++ fundamental type %d"), typeid);
break;
@@ -248,111 +249,111 @@ c_create_fundamental_type (struct objfil
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_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_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_FLT,
- 2 * gdbarch_float_bit (current_gdbarch)
+ 2 * gdbarch_float_bit (objfile->gdbarch)
/ TARGET_CHAR_BIT,
0, "complex float", objfile);
TYPE_TARGET_TYPE (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_COMPLEX:
type = init_type (TYPE_CODE_FLT,
- 2 * gdbarch_double_bit (current_gdbarch)
+ 2 * gdbarch_double_bit (objfile->gdbarch)
/ TARGET_CHAR_BIT,
0, "complex double", objfile);
TYPE_TARGET_TYPE (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_EXT_PREC_COMPLEX:
type = init_type (TYPE_CODE_FLT,
- 2 * gdbarch_long_double_bit (current_gdbarch)
+ 2 * gdbarch_long_double_bit (objfile->gdbarch)
/ TARGET_CHAR_BIT,
0, "complex long double", objfile);
TYPE_TARGET_TYPE (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;
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:26:49.000000000 +0200
@@ -1876,7 +1876,7 @@ charset.o: charset.c $(defs_h) $(charset
c-lang.o: c-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
$(parser_defs_h) $(language_h) $(c_lang_h) $(valprint_h) \
$(macroscope_h) $(gdb_assert_h) $(charset_h) $(gdb_string_h) \
- $(demangle_h) $(cp_abi_h) $(cp_support_h)
+ $(demangle_h) $(cp_abi_h) $(cp_support_h) $(objfiles_h)
cli-out.o: cli-out.c $(defs_h) $(ui_out_h) $(cli_out_h) $(gdb_string_h) \
$(gdb_assert_h)
coff-pe-read.o: coff-pe-read.c $(coff_pe_read_h) $(bfd_h) $(defs_h) \