From: Nick Clifton <nickc@redhat.com>
To: Nick Clifton <nickc@redhat.com>,
gdb-patches@sourceware.org, kevinb@redhat.com
Subject: Re: RFA: Fix compile time warnings building iq2000-tdep.c
Date: Tue, 28 Nov 2006 17:12:00 -0000 [thread overview]
Message-ID: <456C6BC3.3090006@redhat.com> (raw)
In-Reply-To: <20061128164758.GC20882@nevyn.them.org>
Hi Daniel,
> Looks OK except...
>
>> *************** iq2000_extract_return_value (struct type
>> *** 558,564 ****
>> returned in a register, and if larger than 8 bytes, it is
>> returned in a stack location which is pointed to by the same
>> register. */
>> ! CORE_ADDR return_buffer;
>> int len = TYPE_LENGTH (type);
>>
>> if (len <= (2 * 4))
>> --- 558,564 ----
>> returned in a register, and if larger than 8 bytes, it is
>> returned in a stack location which is pointed to by the same
>> register. */
>> ! gdb_byte return_buffer;
>> int len = TYPE_LENGTH (type);
>>
>> if (len <= (2 * 4))
>
> That? Aren't you going to run off the end of that if it's only a
> single byte?
Urk, yes. How about this version instead:
*************** iq2000_extract_return_value (struct type
*** 558,564 ****
returned in a register, and if larger than 8 bytes, it is
returned in a stack location which is pointed to by the same
register. */
- CORE_ADDR return_buffer;
int len = TYPE_LENGTH (type);
if (len <= (2 * 4))
--- 558,563 ----
*************** iq2000_extract_return_value (struct type
*** 582,598 ****
}
else
{
/* Return values > 8 bytes are returned in memory,
pointed to by FN_RETURN_REGNUM. */
! regcache_cooked_read (regcache, E_FN_RETURN_REGNUM, &
return_buffer);
! read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
}
}
--- 581,605 ----
}
else
{
+ CORE_ADDR dummy;
+ union
+ {
+ gdb_byte bytes[sizeof dummy];
+ CORE_ADDR addr;
+ }
+ return_buffer;
+
/* Return values > 8 bytes are returned in memory,
pointed to by FN_RETURN_REGNUM. */
! regcache_cooked_read (regcache, E_FN_RETURN_REGNUM,
return_buffer.bytes);
! read_memory (return_buffer.addr, valbuf, TYPE_LENGTH (type));
}
}
(Rest of the patch as before).
This makes the puning of gdb_byte and CORE_ADDR explicit, which I think
is a good thing, but maybe there is a preferred gdb way of doing this ?
(Also I could not think of a clean way of obtaining the size of a
CORE_ADDR without using a dummy variable).
Cheers
Nick
next prev parent reply other threads:[~2006-11-28 17:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-28 16:41 Nick Clifton
2006-11-28 16:56 ` Daniel Jacobowitz
2006-11-28 17:12 ` Nick Clifton [this message]
2006-11-28 17:17 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=456C6BC3.3090006@redhat.com \
--to=nickc@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox