Message ID | 1444538238-7468-1-git-send-email-simon.marchi@polymtl.ca |
---|---|
State | New, archived |
Headers |
Received: (qmail 111120 invoked by alias); 11 Oct 2015 04:37:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 111007 invoked by uid 89); 11 Oct 2015 04:37:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: smtp.electronicbox.net Received: from smtp.electronicbox.net (HELO smtp.electronicbox.net) (96.127.255.83) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Oct 2015 04:37:21 +0000 Received: from simark.lan. (cable-192.222.137.139.electronicbox.net [192.222.137.139]) by smtp.electronicbox.net (Postfix) with ESMTP id A7A59440E78; Sun, 11 Oct 2015 00:37:19 -0400 (EDT) From: Simon Marchi <simon.marchi@polymtl.ca> To: gdb-patches@sourceware.org Cc: Simon Marchi <simon.marchi@polymtl.ca> Subject: [PATCH c++ 1/5] lm32: Add (const gdb_byte *) cast Date: Sun, 11 Oct 2015 00:37:14 -0400 Message-Id: <1444538238-7468-1-git-send-email-simon.marchi@polymtl.ca> |
Commit Message
Simon Marchi
Oct. 11, 2015, 4:37 a.m. UTC
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(-)
Comments
Simon Marchi <simon.marchi@polymtl.ca> writes: > 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. Patch is OK.
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
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
On 15-10-11 12: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)); > sp -= 4; > } > } > Ping for patches 1 and 4.
On 10/21/2015 07:44 PM, Simon Marchi wrote:
> Ping for patches 1 and 4.
I think patch #1 is already in, it was the one that ended up
using write_memory_unsigned_integer.
Thanks,
Pedro Alves
On 15-10-22 06:55 AM, Pedro Alves wrote: > On 10/21/2015 07:44 PM, Simon Marchi wrote: > >> Ping for patches 1 and 4. > > I think patch #1 is already in, it was the one that ended up > using write_memory_unsigned_integer. > > Thanks, > Pedro Alves > Ah indeed, sorry about that.
On 15-10-21 02:44 PM, Simon Marchi wrote:
> Ping for patches 1 and 4.
This is now all pushed, except #5 which is dropped because
Pedro has a more appropriate fix.
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)); sp -= 4; } }