This is the mail archive of the gdb-patches@sources.redhat.com 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:] Minor sim callback endian cleanup.


Hans-Peter Nilsson wrote:
The supposedly-sim-independent sim/common/callback.c and syscall.c
(from sim/common/syscall.c:
/* This interface isn't intended to be specific to any particular kind
   of remote (hardware, simulator, whatever).  As such, support for it
   (e.g. sim/common/callback.c) should *not* live in the simulator source
   tree, nor should it live in the gdb source tree.  K&R C must be
   supported.  */
)
have no idea what the endian of the target is, and still are
supposed to store multi-byte values correctly without access to
proper multibyte-value-store functions.  Currently,
little-endian is assumed when storing struct stat members, which
of course is just broken.  This patch introduces a member of
host_callback to hold the endianness of the target.  Because of
sim-independentness those files must not include sim-config.h to
access CURRENT_TARGET_BYTE_ORDER.  Oh well.  I blissfully ignore
the possibility of different endian types (16-bit within 32-bit
different to 8-bit within 16-bit) but so does the rest of sim/.

Tested together with other dependent stuff using the CRIS sim.
Test-built on m32r-sim, arm-sim and frv-sim with this patch
only.

include/gdb:
	* callback.h (struct host_callback_struct): New member
	target_big_endian.
	(cb_store_target_endian): Prototype.

sim/common:
	* callback.c (default_callback): Initialize target_big_endian.
	(cb_store_target_endian): Renamed from store, new first parameter
	host_callback *cb, drop last parameter big_p.  Take endianness
	from cb.
	(cb_host_to_target_stat): Change to use cb_store_target_endian.
	Remove variable big_p.
	* nrun.c (main): Initialize default_callback.target_big_endian.

[draining my backlog, sorry]


Almost. Can you just modify it so that the field's type is bfd_endian instead of an int. If this means #including "bfd.h" explicitly, so be it (having a common, but not in bfd.h, type system is only a nice-to-have).

(Also, feel free to treat as obvious the ripping out any K&Risms you stumble across, or fixing of the definition of SIM_ADDR (it should be bfd's largest int).

this, and fallout pre-approved,
Andrew


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