This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
RE: [PATCH c++ 1/5] lm32: Add (const gdb_byte *) cast
- From: "Jon Beniston" <jon at beniston dot com>
- To: "'Pedro Alves'" <palves at redhat dot com>, "'Simon Marchi'" <simon dot marchi at polymtl dot ca>, <gdb-patches at sourceware dot org>
- Date: Mon, 12 Oct 2015 13:18:31 +0100
- Subject: RE: [PATCH c++ 1/5] lm32: Add (const gdb_byte *) cast
- Authentication-results: sourceware.org; auth=none
- References: <1444538238-7468-1-git-send-email-simon dot marchi at polymtl dot ca> <561B952D dot 8060909 at redhat dot com>
Hi Pedro,
Yes, I believe people are still using this port. (Probably no one on a host
with different byte ordering though!)
Regards,
Jon
-----Original Message-----
From: Pedro Alves [mailto:palves@redhat.com]
Sent: 12 October 2015 12:11
To: Simon Marchi; gdb-patches@sourceware.org
Cc: Jon Beniston
Subject: Re: [PATCH c++ 1/5] lm32: Add (const gdb_byte *) cast
On 10/11/2015 05:37 AM, Simon Marchi wrote:
> There might be a cleaner sequence of function calls to do what is done
> here (I don't know), but since I don't want to risk breaking anything,
> it's safer to just add the required cast.
>
> gdb/ChangeLog:
>
> * lm32-tdep.c (lm32_push_dummy_call): Add cast.
> ---
> gdb/lm32-tdep.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index 25a7e1e..a0defad
> 100644
> --- a/gdb/lm32-tdep.c
> +++ b/gdb/lm32-tdep.c
> @@ -289,7 +289,7 @@ lm32_push_dummy_call (struct gdbarch *gdbarch, struct
value *function,
> regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val);
> else
> {
> - write_memory (sp, (void *) &val, TYPE_LENGTH (arg_type));
> + write_memory (sp, (const gdb_byte *) &val, TYPE_LENGTH
> +(arg_type));
This reveals that the code has a host-dependency. It is assuming the byte
order of the target is the same as host's.
Please replace this with a call to write_memory_unsigned_integer.
Looks like this port hasn't been touched ever since it was originally
contributed. Jon, is there still interest in this port?
Thanks,
Pedro Alves