From accc8979185dc83f810d1e76a6bb11ed5af36ff3 Mon Sep 17 00:00:00 2001 From: kettenis Date: Tue, 1 Aug 2006 18:27:51 +0000 Subject: [PATCH] * arm-tdep.h (enum struct_return): New. (struct gdbarch_tdep): Add struct_return member. * arm-tdep.c (arm_return_value): Return RETURN_VALUE_STRUCT_CONVENTION for aggregates when the ABI uses pcc_struct_return. (arm_gdbarch_init): Default to reg_struct_return. * armobsd-tdep.c (armobsd_init_abi): Set pcc_struct_return. --- gdb/ChangeLog | 10 ++++++++++ gdb/arm-tdep.c | 9 ++++++++- gdb/arm-tdep.h | 13 +++++++++++++ gdb/armobsd-tdep.c | 3 +++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c16fd241ad..c61bcb42c4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2006-08-01 Mark Kettenis + + * arm-tdep.h (enum struct_return): New. + (struct gdbarch_tdep): Add struct_return member. + * arm-tdep.c (arm_return_value): Return + RETURN_VALUE_STRUCT_CONVENTION for aggregates when the ABI uses + pcc_struct_return. + (arm_gdbarch_init): Default to reg_struct_return. + * armobsd-tdep.c (armobsd_init_abi): Set pcc_struct_return. + 2006-07-31 Mark Kettenis * alpha-tdep.h (ALPHA_S0_REGNUM): New define. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index c5c903b29b..a8c00d88ed 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2259,11 +2259,14 @@ arm_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT || TYPE_CODE (valtype) == TYPE_CODE_UNION || TYPE_CODE (valtype) == TYPE_CODE_ARRAY) { - if (arm_return_in_memory (gdbarch, valtype)) + if (tdep->struct_return == pcc_struct_return + || arm_return_in_memory (gdbarch, valtype)) return RETURN_VALUE_STRUCT_CONVENTION; } @@ -2757,6 +2760,10 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->lowest_pc = 0x20; tdep->jb_pc = -1; /* Longjump support not enabled by default. */ + /* The default, for both APCS and AAPCS, is to return small + structures in registers. */ + tdep->struct_return = reg_struct_return; + set_gdbarch_push_dummy_call (gdbarch, arm_push_dummy_call); set_gdbarch_frame_align (gdbarch, arm_frame_align); diff --git a/gdb/arm-tdep.h b/gdb/arm-tdep.h index f6dc6356f5..7b369d5fb9 100644 --- a/gdb/arm-tdep.h +++ b/gdb/arm-tdep.h @@ -125,6 +125,14 @@ enum arm_abi_kind ARM_ABI_LAST }; +/* Convention for returning structures. */ + +enum struct_return +{ + pcc_struct_return, /* Return "short" structures in memory. */ + reg_struct_return /* Return "short" structures in registers. */ +}; + /* Target-dependent structure in gdbarch. */ struct gdbarch_tdep { @@ -147,10 +155,15 @@ struct gdbarch_tdep will be disabled. */ size_t jb_elt_size; /* And the size of each entry in the buf. */ + /* Convention for returning structures. */ + enum struct_return struct_return; + /* Cached core file helpers. */ struct regset *gregset, *fpregset; }; + + #ifndef LOWEST_PC #define LOWEST_PC (gdbarch_tdep (current_gdbarch)->lowest_pc) #endif diff --git a/gdb/armobsd-tdep.c b/gdb/armobsd-tdep.c index 0f5e7a4007..9b14382a7d 100644 --- a/gdb/armobsd-tdep.c +++ b/gdb/armobsd-tdep.c @@ -88,6 +88,9 @@ armobsd_init_abi (struct gdbarch_info info, tdep->jb_pc = 24; tdep->jb_elt_size = 4; + + /* OpenBSD/arm uses -fpcc-struct-return by default. */ + tdep->struct_return = pcc_struct_return; } void -- 2.11.0