This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Fix compile time warnings building iq2000-tdep.c


On Tue, Nov 28, 2006 at 05:02:59PM +0000, Nick Clifton wrote:
> +       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).

If your host and target have different endianness, this isn't going to
work so well.  And CORE_ADDR may be 32-bit or 64-bit.

I suspect that what you really want is extract_typed_address; and to
size the buffer according to a target pointer, not according to a
CORE_ADDR.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]