Commit Graph

11 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
a6425ab52d Maintain target's byte order for multi-byte fields in CTF structures.
CTF format is not cross-platform by design, e.g. it is not guaranteed
that data generated by ctfconvert/ctfmerge on one architecture will
be successfuly read on another. CTF structures are saved/restored
using naive approach. Roughly it looks like:
	write(fd, &ctf_struct, sizeof(ctf_struct))
	read(fd, &ctf_struct, sizeof(ctf_struct))

By sheer luck memory layout of all type-related CTF structures is the same
on amd64/i386/mips32/mips64. It's different on ARM though. sparc, ia64,
powerpc, and powerpc64 were not tested. So in order to get file compatible
with dtrace on ARM it should be compiled on ARM. Alternative solution would
be to have "signatures" for every platform and ctfmerge should convert host's
reperesentation of CTF structure to target's one using "signature" as template.

This patch checks byte order of ELF files used for generating CTF record
and makes sure that byte order of data written to resulting files is the same
as target's byte order.
2012-03-24 01:47:33 +00:00
Dimitry Andric
1e02cf9b8c In cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c, a size_t is passed
to fprintf as a field width.  It should be an int instead, so cast it.

MFC after:	1 week
2011-12-16 21:29:46 +00:00
Rui Paulo
1670a1c2a4 MFV OpenSolaris DTrace userland bits. 2010-08-02 13:40:53 +00:00
Navdeep Parhar
96d1cd1879 Catch up with r210324. d_buf will be NULL for SHT_NOBITS sections, do not
attempt to copy from it in that case.

MFC after:	1 month
2010-07-23 22:24:25 +00:00
Alexander Kabaev
59879e52c1 Do not encode more than CTF_MAX_VLEN(1023) enum members.
CTF can not represent enums with more than CTF_MAX_VLEN members, but
ctfconvert will happily ignore that limitation and create CTF section no
other tool can interpret.

This change is different from similar change from upstream, which just
returns an error if big enum is encountered.  Doing that means that
every FreeBSD kernel with compiled in hwpmc will have no useable CTF
information due to pmc_event enum having 1236+ members.
2010-05-03 18:04:17 +00:00
John Birrell
4cc75139b9 A lot of changes to make this code compile cleanly on FreeBSD. 2008-04-26 04:01:35 +00:00
John Birrell
e9c7a60421 Use FreeBSD's libdwarf which is BSD licensed instead of the GPL'd one that
is used in Solaris.
2008-04-26 03:59:24 +00:00
John Birrell
c01977ed3b We need to be consistent with prototype definitions. It isn't OK to
use 'const' and just override it whenever we feel like it. If we use
it at all, then we need to do it properly.

Add a couple of functions that were useful in getting this code ported.
2008-04-26 03:56:49 +00:00
John Birrell
9098da062c Make this file compile cleanly. 2008-04-26 03:54:23 +00:00
John Birrell
20594ebf90 This commit was generated by cvs2svn to compensate for changes in r178528,
which included commits to RCS files with non-trunk default branches.
2008-04-26 00:54:52 +00:00
John Birrell
1673e4046d This commit was generated by cvs2svn to compensate for changes in r178481,
which included commits to RCS files with non-trunk default branches.
2008-04-25 09:07:28 +00:00