* stack.c (return_command): Use frame architecture to determine

default integer return type.

	* f-valprint.c (f77_get_dynamic_lowerbound): Use frame architecture
	to determine pointer types.
	(f77_get_dynamic_upperbound): Likewise.

	* objc-lang.c (OBJC_FETCH_POINTER_ARGUMENT): Remove.
	(resolve_msgsend): Use architecture of current frame to determine
	pointer types.  Inline OBJC_FETCH_POINTER_ARGUMENT.
	(resolve_msgsend_stret, resolve_msgsend_super,
	resolve_msgsend_super_stret): Likewise.
This commit is contained in:
Ulrich Weigand 2008-09-11 14:23:51 +00:00
parent 0dfff4cba7
commit 5ed92fa89a
4 changed files with 47 additions and 16 deletions

View file

@ -1,3 +1,18 @@
2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
* stack.c (return_command): Use frame architecture to determine
default integer return type.
* f-valprint.c (f77_get_dynamic_lowerbound): Use frame architecture
to determine pointer types.
(f77_get_dynamic_upperbound): Likewise.
* objc-lang.c (OBJC_FETCH_POINTER_ARGUMENT): Remove.
(resolve_msgsend): Use architecture of current frame to determine
pointer types. Inline OBJC_FETCH_POINTER_ARGUMENT.
(resolve_msgsend_stret, resolve_msgsend_super,
resolve_msgsend_super_stret): Likewise.
2008-09-11 Ulrich Weigand <uweigand@de.ibm.com> 2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
* alpha-tdep.c (alpha_register_type): Use builtin_type (gdbarch) * alpha-tdep.c (alpha_register_type): Use builtin_type (gdbarch)

View file

@ -99,10 +99,11 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
current_frame_addr = get_frame_base (frame); current_frame_addr = get_frame_base (frame);
if (current_frame_addr > 0) if (current_frame_addr > 0)
{ {
struct gdbarch *arch = get_frame_arch (frame);
ptr_to_lower_bound = ptr_to_lower_bound =
read_memory_typed_address (current_frame_addr + read_memory_typed_address (current_frame_addr +
TYPE_ARRAY_LOWER_BOUND_VALUE (type), TYPE_ARRAY_LOWER_BOUND_VALUE (type),
builtin_type_void_data_ptr); builtin_type (arch)->builtin_data_ptr);
*lower_bound = read_memory_integer (ptr_to_lower_bound, 4); *lower_bound = read_memory_integer (ptr_to_lower_bound, 4);
} }
else else
@ -165,10 +166,11 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
current_frame_addr = get_frame_base (frame); current_frame_addr = get_frame_base (frame);
if (current_frame_addr > 0) if (current_frame_addr > 0)
{ {
struct gdbarch *arch = get_frame_arch (frame);
ptr_to_upper_bound = ptr_to_upper_bound =
read_memory_typed_address (current_frame_addr + read_memory_typed_address (current_frame_addr +
TYPE_ARRAY_UPPER_BOUND_VALUE (type), TYPE_ARRAY_UPPER_BOUND_VALUE (type),
builtin_type_void_data_ptr); builtin_type (arch)->builtin_data_ptr);
*upper_bound = read_memory_integer (ptr_to_upper_bound, 4); *upper_bound = read_memory_integer (ptr_to_upper_bound, 4);
} }
else else

View file

@ -1679,19 +1679,19 @@ find_implementation (CORE_ADDR object, CORE_ADDR sel)
return find_implementation_from_class (ostr.isa, sel); return find_implementation_from_class (ostr.isa, sel);
} }
#define OBJC_FETCH_POINTER_ARGUMENT(argi) \
gdbarch_fetch_pointer_argument (current_gdbarch, get_current_frame (), \
argi, builtin_type_void_func_ptr)
static int static int
resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc) resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc)
{ {
struct frame_info *frame = get_current_frame ();
struct gdbarch *gdbarch = get_frame_arch (frame);
struct type *ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
CORE_ADDR object; CORE_ADDR object;
CORE_ADDR sel; CORE_ADDR sel;
CORE_ADDR res; CORE_ADDR res;
object = OBJC_FETCH_POINTER_ARGUMENT (0); object = gdbarch_fetch_pointer_argument (gdbarch, frame, 0, ptr_type);
sel = OBJC_FETCH_POINTER_ARGUMENT (1); sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
res = find_implementation (object, sel); res = find_implementation (object, sel);
if (new_pc != 0) if (new_pc != 0)
@ -1704,12 +1704,16 @@ resolve_msgsend (CORE_ADDR pc, CORE_ADDR *new_pc)
static int static int
resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc) resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
{ {
struct frame_info *frame = get_current_frame ();
struct gdbarch *gdbarch = get_frame_arch (frame);
struct type *ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
CORE_ADDR object; CORE_ADDR object;
CORE_ADDR sel; CORE_ADDR sel;
CORE_ADDR res; CORE_ADDR res;
object = OBJC_FETCH_POINTER_ARGUMENT (1); object = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
sel = OBJC_FETCH_POINTER_ARGUMENT (2); sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type);
res = find_implementation (object, sel); res = find_implementation (object, sel);
if (new_pc != 0) if (new_pc != 0)
@ -1722,14 +1726,18 @@ resolve_msgsend_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
static int static int
resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc) resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
{ {
struct frame_info *frame = get_current_frame ();
struct gdbarch *gdbarch = get_frame_arch (frame);
struct type *ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
struct objc_super sstr; struct objc_super sstr;
CORE_ADDR super; CORE_ADDR super;
CORE_ADDR sel; CORE_ADDR sel;
CORE_ADDR res; CORE_ADDR res;
super = OBJC_FETCH_POINTER_ARGUMENT (0); super = gdbarch_fetch_pointer_argument (gdbarch, frame, 0, ptr_type);
sel = OBJC_FETCH_POINTER_ARGUMENT (1); sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
read_objc_super (super, &sstr); read_objc_super (super, &sstr);
if (sstr.class == 0) if (sstr.class == 0)
@ -1746,14 +1754,18 @@ resolve_msgsend_super (CORE_ADDR pc, CORE_ADDR *new_pc)
static int static int
resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc) resolve_msgsend_super_stret (CORE_ADDR pc, CORE_ADDR *new_pc)
{ {
struct frame_info *frame = get_current_frame ();
struct gdbarch *gdbarch = get_frame_arch (frame);
struct type *ptr_type = builtin_type (gdbarch)->builtin_func_ptr;
struct objc_super sstr; struct objc_super sstr;
CORE_ADDR super; CORE_ADDR super;
CORE_ADDR sel; CORE_ADDR sel;
CORE_ADDR res; CORE_ADDR res;
super = OBJC_FETCH_POINTER_ARGUMENT (1); super = gdbarch_fetch_pointer_argument (gdbarch, frame, 1, ptr_type);
sel = OBJC_FETCH_POINTER_ARGUMENT (2); sel = gdbarch_fetch_pointer_argument (gdbarch, frame, 2, ptr_type);
read_objc_super (super, &sstr); read_objc_super (super, &sstr);
if (sstr.class == 0) if (sstr.class == 0)

View file

@ -1780,11 +1780,13 @@ down_command (char *count_exp, int from_tty)
void void
return_command (char *retval_exp, int from_tty) return_command (char *retval_exp, int from_tty)
{ {
struct frame_info *thisframe;
struct symbol *thisfun; struct symbol *thisfun;
struct value *return_value = NULL; struct value *return_value = NULL;
const char *query_prefix = ""; const char *query_prefix = "";
thisfun = get_frame_function (get_selected_frame ("No selected frame.")); thisframe = get_selected_frame ("No selected frame.");
thisfun = get_frame_function (thisframe);
/* Compute the return value. If the computation triggers an error, /* Compute the return value. If the computation triggers an error,
let it bail. If the return type can't be handled, set let it bail. If the return type can't be handled, set
@ -1803,7 +1805,7 @@ return_command (char *retval_exp, int from_tty)
if (thisfun != NULL) if (thisfun != NULL)
return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun)); return_type = TYPE_TARGET_TYPE (SYMBOL_TYPE (thisfun));
if (return_type == NULL) if (return_type == NULL)
return_type = builtin_type_int; return_type = builtin_type (get_frame_arch (thisframe))->builtin_int;
CHECK_TYPEDEF (return_type); CHECK_TYPEDEF (return_type);
return_value = value_cast (return_type, return_value); return_value = value_cast (return_type, return_value);