X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fm68k-tdep.c;h=c0662e4a0fb0a98b58ea9f66b8c2d33ca8ced1bb;hb=e76ff5abe375e1e7535f7827db01bce70bc9710d;hp=2706969dac5914d90b031cf048c0444ca6d8e686;hpb=8dccd430c9de0e6cf747ae4bb1bf9d944fe3397c;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c index 2706969dac..c0662e4a0f 100644 --- a/gdb/m68k-tdep.c +++ b/gdb/m68k-tdep.c @@ -1,8 +1,6 @@ /* Target-dependent code for the Motorola 68000 series. - Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 - Free Software Foundation, Inc. + Copyright (C) 1990-2013 Free Software Foundation, Inc. This file is part of GDB. @@ -317,7 +315,6 @@ static void m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache, gdb_byte *valbuf) { - int len = TYPE_LENGTH (type); gdb_byte buf[M68K_MAX_REGISTER_SIZE]; struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -328,7 +325,7 @@ m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache, regcache_raw_read (regcache, M68K_FP0_REGNUM, buf); convert_typed_floating (buf, fpreg_type, valbuf, type); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4) + else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf); else m68k_extract_return_value (type, regcache, valbuf); @@ -359,7 +356,6 @@ static void m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, const gdb_byte *valbuf) { - int len = TYPE_LENGTH (type); struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); @@ -370,7 +366,7 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, convert_typed_floating (valbuf, type, buf, fpreg_type); regcache_raw_write (regcache, M68K_FP0_REGNUM, buf); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4) + else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) { regcache_raw_write (regcache, M68K_A0_REGNUM, valbuf); regcache_raw_write (regcache, M68K_D0_REGNUM, valbuf); @@ -379,8 +375,8 @@ m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, m68k_store_return_value (type, regcache, valbuf); } -/* Return non-zero if TYPE, which is assumed to be a structure or - union type, should be returned in registers for architecture +/* Return non-zero if TYPE, which is assumed to be a structure, union or + complex type, should be returned in registers for architecture GDBARCH. */ static int @@ -390,7 +386,8 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) enum type_code code = TYPE_CODE (type); int len = TYPE_LENGTH (type); - gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION); + gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION + || code == TYPE_CODE_COMPLEX); if (tdep->struct_return == pcc_struct_return) return 0; @@ -405,14 +402,15 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) from WRITEBUF into REGCACHE. */ static enum return_value_convention -m68k_return_value (struct gdbarch *gdbarch, struct type *func_type, +m68k_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { enum type_code code = TYPE_CODE (type); /* GCC returns a `long double' in memory too. */ - if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION) + if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION + || code == TYPE_CODE_COMPLEX) && !m68k_reg_struct_return_p (gdbarch, type)) || (code == TYPE_CODE_FLT && TYPE_LENGTH (type) == 12)) { @@ -440,13 +438,14 @@ m68k_return_value (struct gdbarch *gdbarch, struct type *func_type, } static enum return_value_convention -m68k_svr4_return_value (struct gdbarch *gdbarch, struct type *func_type, +m68k_svr4_return_value (struct gdbarch *gdbarch, struct value *function, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { enum type_code code = TYPE_CODE (type); - if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION) + if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION + || code == TYPE_CODE_COMPLEX) && !m68k_reg_struct_return_p (gdbarch, type)) { /* The System V ABI says that: @@ -479,7 +478,7 @@ m68k_svr4_return_value (struct gdbarch *gdbarch, struct type *func_type, if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1) { type = check_typedef (TYPE_FIELD_TYPE (type, 0)); - return m68k_svr4_return_value (gdbarch, func_type, type, regcache, + return m68k_svr4_return_value (gdbarch, function, type, regcache, readbuf, writebuf); } @@ -856,7 +855,6 @@ m68k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc) { struct m68k_frame_cache cache; CORE_ADDR pc; - int op; cache.locals = -1; pc = m68k_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache); @@ -976,6 +974,7 @@ m68k_frame_prev_register (struct frame_info *this_frame, void **this_cache, static const struct frame_unwind m68k_frame_unwind = { NORMAL_FRAME, + default_frame_unwind_stop_reason, m68k_frame_this_id, m68k_frame_prev_register, NULL, @@ -1052,6 +1051,16 @@ m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) } +/* This is the implementation of gdbarch method + return_in_first_hidden_param_p. */ + +static int +m68k_return_in_first_hidden_param_p (struct gdbarch *gdbarch, + struct type *type) +{ + return 0; +} + /* System V Release 4 (SVR4). */ void @@ -1091,9 +1100,6 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) feature = tdesc_find_feature (info.target_desc, "org.gnu.gdb.m68k.core"); - if (feature != NULL) - /* Do nothing. */ - ; if (feature == NULL) { @@ -1237,6 +1243,8 @@ m68k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* Function call & return. */ set_gdbarch_push_dummy_call (gdbarch, m68k_push_dummy_call); set_gdbarch_return_value (gdbarch, m68k_return_value); + set_gdbarch_return_in_first_hidden_param_p (gdbarch, + m68k_return_in_first_hidden_param_p); /* Disassembler. */