Re: [RFA/m32r] set return_value

Kei Sakamoto
2004-10-01T09:01:13Z

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

I'm sorry. I forgot to attach the patch file again...

> Hello,
>
> The attached patch removes deprecated_extract_struct_value_address
> and deprecated_use_struct_convention from m32r-tdep.c and
> sets return_value.
>
> OK to commit?
>
> 2004-10-01 Kei Sakamoto <sakamoto.kei@renesas.com>
>
> * m32r-tdep.c (m32r_use_struct_convention): Delete function.
> (m32r_extract_struct_value_address): Delete function.
> (m32r_return_value): New function.
> (m32r_gdbarch_init): Instead of store_return_value,
> extract_return_value, deprecated_extract_struct_value_address
> and deprecated_use_struct_convention, set return_value.

[-- Attachment #2: m32r-tdep.patch --]
[-- Type: application/octet-stream, Size: 2812 bytes --]

Index: m32r-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m32r-tdep.c,v
retrieving revision 1.31
diff -u -r1.31 m32r-tdep.c
--- m32r-tdep.c 1 Oct 2004 07:29:34 -0000 1.31
+++ m32r-tdep.c 1 Oct 2004 08:43:22 -0000
@@ -55,19 +55,6 @@
return sp & ~3;
}

-/* Should we use DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS instead of
- EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc and TYPE
- is the type (which is known to be struct, union or array).
-
- The m32r returns anything less than 8 bytes in size in
- registers. */
-
-static int
-m32r_use_struct_convention (int gcc_p, struct type *type)
-{
- return (TYPE_LENGTH (type) > 8);
-}
-

/* BREAKPOINT */
#define M32R_BE_BREAKPOINT32 {0x10, 0xf1, 0x70, 0x00}
@@ -266,19 +253,6 @@
}
}

-/* Extract from an array REGBUF containing the (raw) register state
- the address in which a function should return its structure value,
- as a CORE_ADDR (or an expression that can be used as one). */
-
-static CORE_ADDR
-m32r_extract_struct_value_address (struct regcache *regcache)
-{
- ULONGEST addr;
- regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &addr);
- return addr;
-}
-
-
/* This is required by skip_prologue. The results of decoding a prologue
should be cached because this thrashing is getting nuts. */

@@ -781,6 +755,24 @@
}
}

+enum return_value_convention
+m32r_return_value (struct gdbarch *gdbarch, struct type *valtype,
+ struct regcache *regcache, void *readbuf,
+ const void *writebuf)
+{
+ if (TYPE_LENGTH (valtype) > 8)
+ return RETURN_VALUE_STRUCT_CONVENTION;
+ else
+ {
+ if (readbuf != NULL)
+ m32r_extract_return_value (valtype, regcache, readbuf);
+ if (writebuf != NULL)
+ m32r_store_return_value (valtype, regcache, writebuf);
+ return RETURN_VALUE_REGISTER_CONVENTION;
+ }
+}
+
+

static CORE_ADDR
m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
@@ -900,13 +892,8 @@
set_gdbarch_register_name (gdbarch, m32r_register_name);
set_gdbarch_register_type (gdbarch, m32r_register_type);

- set_gdbarch_extract_return_value (gdbarch, m32r_extract_return_value);
set_gdbarch_push_dummy_call (gdbarch, m32r_push_dummy_call);
- set_gdbarch_store_return_value (gdbarch, m32r_store_return_value);
- set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
- m32r_extract_struct_value_address);
- set_gdbarch_deprecated_use_struct_convention (gdbarch,
- m32r_use_struct_convention);
+ set_gdbarch_return_value (gdbarch, m32r_return_value);

set_gdbarch_skip_prologue (gdbarch, m32r_skip_prologue);
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);