Home | History | Annotate | Download | only in cvt
History log of /src/external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c
RevisionDateAuthorComments
 1.30  25-Jul-2025  hans Fix typo introduced in 1.29
 1.29  24-Jul-2025  hans Fix OpenSolaris-derived headers and sources to avoid conflicts with
system headers when cross-building on illumos.
 1.28  05-May-2025  mrg fix the i386 build.

format specifiers didn't match between Dwarf_* types and printf(),
and since some of them want to be "long long unsigned" on i386,
force everything to be that type and those printf formats.
 1.27  04-May-2025  christos Apply diffs from FreeBSD to support CTF version 3 which eliminates the 64K
limits on various arrays holding items (eg. types)
 1.26  31-Mar-2021  simonb branches: 1.26.8;
Simplify the CTF float encoding type logic: all floating point types of
4 bytes or less are "float", 8 bytes or less are "double" and 16 bytes
or less are "long double". Make ctfconvert much happier with N32 ABI
where we have 4 byte pointers and 16 byte long doubles. Will also help
ctfconvert if ever used on m68k or 32-bit RISC-V.

@christos: LGTM
 1.25  28-May-2018  chs merge a new version of the CDDL dtrace and ZFS code.
this changes the upstream vendor from OpenSolaris to FreeBSD,
and this version is based on FreeBSD svn r315983.

in addition to the 10 years of improvements from upstream,
this version also has these NetBSD-specific enhancements:
- dtrace FBT probes can now be placed in kernel modules.
- ZFS now supports mmap().
 1.24  31-Dec-2017  christos branches: 1.24.2;
add trivial handling for DW_ATE_UTF, does not work.
 1.23  08-Jun-2016  christos Grr, gcc-5.4 creates DW_AT_typedef without DW_AT_type for HARD_REG_SET!

<1><c26b>: Abbrev Number: 4 (DW_TAG_typedef)
<c26c> DW_AT_name : (indirect string, offset: 0x16e30): HARD_REG_ELT_TYPE
<c270> DW_AT_decl_file : 57
<c271> DW_AT_decl_line : 43
<c272> DW_AT_type : <0x70>
<1><c276>: Abbrev Number: 102 (DW_TAG_typedef)
<c277> DW_AT_name : (indirect string, offset: 0x2f954): HARD_REG_SET
<c27b> DW_AT_decl_file : 57
<c27c> DW_AT_decl_line : 54
 1.22  18-Mar-2016  christos Add support for c++ classes.
 1.21  18-Mar-2016  christos fix printf format
 1.20  18-Mar-2016  christos - Add processing for c++ references.
- Make sure we load the DIE that contains the types of array elements so
we can resolve them later.
- Print t_id (die offsets) in hex.
 1.19  01-Mar-2016  joerg Merge r274564 from FreeBSD:
Fix a couple of bugs around the handling of structs and unions of size zero.
These would cause ctfconvert(1) to return an error when attempting to
resolve valid C types.
 1.18  21-Feb-2016  joerg Keep the if chain going.
 1.17  20-Feb-2016  joerg Clang 3.7 and newer provide the array size via DW_AT_count, not via
DW_AT_upper_bound. Recognize the former as well as the latter.
 1.16  20-Feb-2016  christos - don't barf if the object does not have DWARF debug data.
- bump size of types to 1K to avoid string overflow
(both are needed for the new elftoolchain).
 1.15  27-Dec-2015  christos add return
 1.14  29-Sep-2015  christos for the endian macros don't use the _ names, Darwin does not define them.
 1.13  24-Sep-2015  christos %j needs uintmax_t not uintptr_t
 1.12  07-Feb-2015  christos check and fix printf formats, negative array indices, uninitialized variables,
shadowed variables.
 1.11  01-Nov-2014  christos don't fail for anonymous unions.
 1.10  05-Apr-2014  christos branches: 1.10.2;
Handle assembly code built with -g
 1.9  09-Mar-2014  christos branches: 1.9.2;
put back our local fixes:
- don't die on unresolved types.
- it is ok to have 0 sized arrays in structs
- forward enum decls.
 1.8  09-Mar-2014  christos sync with freebsd
 1.7  03-Mar-2014  christos Don't core-dump if a type cannot be resolved. Still gives an error.
 1.6  18-Jan-2013  christos Handle enum forward declarations.
 1.5  10-Jan-2012  darran branches: 1.5.6;
Fix a segfault in ctfmerge.

GCC can generate bogus dwarf attributes with DW_AT_byte_size set to 0xFFFFFFFF.
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35998 .

GCC is currently doing this for external/bsd/tmux/dist/compat/imsg-buffer.c:
readelf -a --debug-dump imsg-buffer.o
...
<2><6e3>: Abbrev Number: 32 (DW_TAG_union_type)
<6e4> DW_AT_byte_size : 0xffffffff
<6e8> DW_AT_decl_file : 1
<6e9> DW_AT_decl_line : 229
<6ea> DW_AT_sibling : <0x705>

This resulted in ctfconvert generating a faulty CTF entry which then caused the
segfault in ctfmerge.

The fix has ctfconvert check for the bogus 0xFFFFFFFF value and works around it.
It also adds some protection to ctfmerge to avoid the segfault and fail
more gracefully if the error should occur in the future.
 1.4  24-Feb-2010  darran branches: 1.4.6;
DTrace: Get the CTF tools building as part of the toolchain.
 1.3  21-Feb-2010  darran Apply NetBSD changes to DTrace.

Ok with core@.
 1.2  21-Feb-2010  darran Add the FreeBSD 8-RC1 changes for DTrace.

Ok with core@.
 1.1  20-Feb-2010  darran branches: 1.1.1;
Initial revision
 1.1.1.2  28-May-2018  chs import new CDDL dtrace and ZFS code from FreeBSD svn r315983.
 1.1.1.1  20-Feb-2010  darran Import the rest of Opensolaris 20081117 needed for DTrace. No conflicts
with ZFS.
 1.4.6.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.6.2  23-Jan-2013  yamt sync with head
 1.4.6.1  17-Apr-2012  yamt sync with head
 1.5.6.2  19-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.1  25-Feb-2013  tls resync with head
 1.9.2.1  10-Aug-2014  tls Rebase.
 1.10.2.1  29-Jun-2015  snj Pull up following revision(s) (requested by chs in ticket #855):
external/cddl/osnet/dist/tools/ctf/cvt/dwarf.c: revision 1.11
don't fail for anonymous unions.
 1.24.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.26.8.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed