This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [09/17] Get rid of current_gdbarch in objc-lang.c
- From: Markus Deuling <deuling at de dot ibm dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>, fedor at gnu dot org
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>
- Date: Thu, 11 Oct 2007 10:54:01 +0200
- Subject: [rfc] [09/17] Get rid of current_gdbarch in objc-lang.c
Hi,
this patch gets rid of some of the current_gdbarch's in objc-lang.c
Is this ok to commit?
ChangeLog:
* objc-lang.c (objc_create_fundamental_type):Use objfile->gdbarch to get
at the current architecture.
(objc_skip_trampoline): Use get_frame_arch to get at the current
oarchitecture by frame_info.
--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com
diff -urpN src/gdb/objc-lang.c dev/gdb/objc-lang.c
--- src/gdb/objc-lang.c 2007-09-23 18:25:05.000000000 +0200
+++ dev/gdb/objc-lang.c 2007-10-11 09:18:07.000000000 +0200
@@ -459,7 +459,7 @@ objc_create_fundamental_type (struct obj
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;
@@ -485,81 +485,85 @@ objc_create_fundamental_type (struct obj
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)
+ 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;
@@ -576,11 +580,11 @@ objc_create_fundamental_type (struct obj
static CORE_ADDR
objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc)
{
+ struct gdbarch *gdbarch = get_frame_arch (frame);
CORE_ADDR real_stop_pc;
CORE_ADDR method_stop_pc;
- real_stop_pc = gdbarch_skip_trampoline_code
- (current_gdbarch, frame, stop_pc);
+ real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc);
if (real_stop_pc != 0)
find_objc_msgcall (real_stop_pc, &method_stop_pc);
@@ -589,8 +593,8 @@ objc_skip_trampoline (struct frame_info
if (method_stop_pc)
{
- real_stop_pc = gdbarch_skip_trampoline_code
- (current_gdbarch, frame, method_stop_pc);
+ real_stop_pc = gdbarch_skip_trampoline_code
+ (gdbarch, frame, method_stop_pc);
if (real_stop_pc == 0)
real_stop_pc = method_stop_pc;
}