From 7a41266bbb4ac11fb6237b143556a02ef0020e18 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 9 Sep 2003 20:22:37 +0000 Subject: [PATCH] 2003-09-09 Andrew Cagney * rs6000-tdep.c (rs6000_store_struct_return): Delete function. (rs6000_push_dummy_call): Store the struct return address. * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Ditto. --- gdb/ChangeLog | 6 ++++++ gdb/ppc-sysv-tdep.c | 13 ++++++++++++- gdb/rs6000-tdep.c | 33 ++++++++++++++------------------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a502bca135d..75aa8c29c23 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-09-09 Andrew Cagney + + * rs6000-tdep.c (rs6000_store_struct_return): Delete function. + (rs6000_push_dummy_call): Store the struct return address. + * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Ditto. + 2003-09-09 Andrew Cagney * ppc-tdep.h (ppc_sysv_abi_push_dummy_call): Replace diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 24376b9cec6..bd801881837 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -69,12 +69,23 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, CORE_ADDR saved_sp; struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - greg = struct_return ? 4 : 3; + greg = 3; freg = 1; vreg = 2; argstkspace = 0; structstkspace = 0; + /* If the function is returning a `struct', then the first word + (which will be passed in r3) is used for struct return address. + In that case we should advance one word and start from r4 + register to copy parameters. */ + if (struct_return) + { + regcache_raw_write_signed (regcache, tdep->ppc_gp0_regnum + greg, + struct_addr); + greg++; + } + /* Figure out how much new stack space is required for arguments which don't fit in registers. Unlike the PowerOpen ABI, the SysV ABI doesn't reserve any extra space for parameters which diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 17bcb2439a2..8b90e75493e 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -1123,6 +1123,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); int ii; int len = 0; int argno; /* current argument number */ @@ -1137,14 +1138,19 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr, CORE_ADDR saved_sp; /* The first eight words of ther arguments are passed in registers. - Copy them appropriately. - - If the function is returning a `struct', then the first word (which - will be passed in r3) is used for struct return address. In that - case we should advance one word and start from r4 register to copy - parameters. */ - - ii = struct_return ? 1 : 0; + Copy them appropriately. */ + ii = 0; + + /* If the function is returning a `struct', then the first word + (which will be passed in r3) is used for struct return address. + In that case we should advance one word and start from r4 + register to copy parameters. */ + if (struct_return) + { + regcache_raw_write_unsigned (regcache, tdep->ppc_gp0_regnum + 3, + struct_addr); + ii++; + } /* effectively indirect call... gcc does... @@ -2051,16 +2057,6 @@ rs6000_stab_reg_to_regnum (int num) return regnum; } -/* Store the address of the place in which to copy the structure the - subroutine will return. */ - -static void -rs6000_store_struct_return (CORE_ADDR addr, CORE_ADDR sp) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - write_register (tdep->ppc_gp0_regnum + 3, addr); -} - /* Write into appropriate registers a function return value of type TYPE, given in virtual format. */ static void @@ -2973,7 +2969,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) else set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call); - set_gdbarch_deprecated_store_struct_return (gdbarch, rs6000_store_struct_return); set_gdbarch_extract_struct_value_address (gdbarch, rs6000_extract_struct_value_address); set_gdbarch_deprecated_pop_frame (gdbarch, rs6000_pop_frame); -- 2.30.2