History log of /freebsd-current/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
Revision Date Author Comments
# 78cd7539 01-Jan-2024 Mark Johnston <markj@FreeBSD.org>

ctfconvert: Handle DW_AT_data_bit_offset

This attribute is new in DWARF 4 and supersedes DW_AT_bit_offset.

PR: 276059
Reported by: rscheff
Tested by: rscheff
MFC after: 1 week


# 258a0d76 06-Jun-2023 Mark Johnston <markj@FreeBSD.org>

ctfconvert: Integer encoding types are unsigned

Before this change, encodings in the user-defined range were being
sign-extended.

MFC after: 1 week
Sponsored by: Innovate UK


# 6237c3e7 02-Aug-2022 Mark Johnston <markj@FreeBSD.org>

ctfconvert: Actually use the asprintf() helper

Fixes: 1165fc9a5266 ("ctfconvert: Give bitfield types names distinct from the base type")


# 1165fc9a 02-Aug-2022 Mark Johnston <markj@FreeBSD.org>

ctfconvert: Give bitfield types names distinct from the base type

CTF integers have an explicit width and so can be used to represent
bitfields. Bitfield types emitted by ctfconvert(1) share the name of
the base integer type, so a struct field with type "unsigned int : 15"
will have a type named "unsigned int".

To avoid ambiguity when looking up types by name, add a suffix to names
of bitfield types to distinguish them from the base type. Then, if
ctfmerge happens to order bitfield types before the corresponding base
type in a CTF file, a name lookup will return the base type, which is
always going to be the desired behaviour.

PR: 265403
Reported by: cy
MFC after: 1 week
Sponsored by: The FreeBSD Foundation


# 963f5dc7 30-Dec-2021 Mark Johnston <markj@FreeBSD.org>

ctfconvert: Handle arrays of empty structs

Members with such a type will legitimately have a size of zero, so don't
emit a warning.

PR: 260818
Reviewed by: bz
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33700


# 559af1ec 25-Feb-2019 Leandro Lupori <luporl@FreeBSD.org>

Increase ctfconvert buffer size

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D19353


# ecbde900 11-Jun-2018 Mark Johnston <markj@FreeBSD.org>

Process CUs with a language attribute of DW_LANG_Mips_Assembler.

At the moment ctfconvert(1) does not do much with such CUs, but
that may not be true in the future, and we run ctfconvert on several
assembly files during the build.

X-MFC with: r334883


# c5fda9ba 09-Jun-2018 Mark Johnston <markj@FreeBSD.org>

Don't process DWARF generated from non-C/C++ code.

ctfconvert(1) is not designed to handle DWARF generated from such code,
and will generally fail in non-obvious ways. Use an explicit check to
help catch such potential failures.

Reported by: Johannes Lundberg <johalun0@gmail.com>
MFC after: 2 weeks


# 1f52c1db 19-May-2018 Matt Macy <mmacy@FreeBSD.org>

ctf dwarf: don't report "no dwarf entry" as if it were an error


# 52f72944 26-Mar-2018 Conrad Meyer <cem@FreeBSD.org>

ctfconvert/ctfmerge: Fix a memory leak enumerating DWARF files

Reported by: Coverity
Sponsored by: Dell EMC Isilon


# 69718b78 03-Dec-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

Revert r253678, r253661:
Fix a segfault in ctfmerge(1) due to a bug in GCC.

The change was correct and the bug real, but upstream didn't adopt it
and we want to remain in sync. When/if upstream does something about it
we can bring their version.

The bug in question was fixed in GCC 4.9 which is now the default in
FreeBSD's ports. Our native gcc-4.2, which is still in use in some Tier-2
platforms also has a workaround so no end-user should be harmed by the
revert.


# eb9da1ad 13-Aug-2016 Mark Johnston <markj@FreeBSD.org>

Fix handling of forward enum declarations in the CTF tools.

Reported by: mmacy
MFC after: 2 weeks


# a4dc509f 23-Oct-2015 Mark Johnston <markj@FreeBSD.org>

DWARF emitted by clang 3.7 encodes array sizes using the DW_AT_count
attribute rather than DW_AT_upper_bound. Teach ctfconvert about this so that
array type sizes are encoded correctly.

PR: 203772
MFC after: 1 week


# bc96366c 17-Jan-2015 Steven Hartland <smh@FreeBSD.org>

Mechanically convert cddl sun #ifdef's to illumos

Since the upstream for cddl code is now illumos not sun, mechanically
convert all sun #ifdef's to illumos #ifdef's which have been used in all
newer code for some time.

Also do a manual pass to correct the use if #ifdef comments as per style(9)
as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos.

MFC after: 1 month
Sponsored by: Multiplay


# 7e00348e 15-Nov-2014 Mark Johnston <markj@FreeBSD.org>

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.

Reviewed by: Robert Mustacchi <rm@joyent.com>
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# d8b88105 29-Jan-2014 Kai Wang <kaiw@FreeBSD.org>

Only declare `bysz' variable under little endian archs.


# a52b8956 25-Jan-2014 Kai Wang <kaiw@FreeBSD.org>

Simplify DWARF version check.

Submitted by: emaste


# 529a53ab 22-Jan-2014 Kai Wang <kaiw@FreeBSD.org>

Let ctfconvert accept DWARF version 3 and 4.


# d32f0149 19-Jan-2014 Kai Wang <kaiw@FreeBSD.org>

Clang 3.4 will sometimes emit DIE for struct/union member before
emitting the DIE for the type of that member. ctfconvert can not
handle this properly and will calculate a wrong member bit offset.
Same struct/union type from different .o file will be treated as
different types when their member bit offsets are different, and
gets added/merged multiple times. This will in turn cause many other
structs/pointers/typedefs that refer to the duplicated struct/union
gets added/merged multiple times and eventually causes numerous
duplicated CTF types in the kernel.debug file.

The simple workaround here is to make use of DW_AT_byte_size attribute
of the member DIE to calculate the bits occupied by the member's type,
without actually resolving the type.


# e3fa6e64 19-Jan-2014 Kai Wang <kaiw@FreeBSD.org>

* Make die_mem_offset() be able to handle DW_AT_data_member_location
attributes generated by Clang 3.4.
* Document how different compilers generate DW_AT_data_member_location
attributes differently.
* Document the quirks about DW_FORM_data[48].


# aedbdd2c 17-Jan-2014 Kai Wang <kaiw@FreeBSD.org>

We should not set the unnamed DIE's name to "__anon__" since that will
bring back a known issue with DTrace regarding type name
comparison. Instead, we can set the name to an empty string.

Pointed out by: avg


# 1391789e 16-Jan-2014 Kai Wang <kaiw@FreeBSD.org>

If function die_name() finds a DIE without a name, set its name to
"__anon__". This hack is used to workaround a issue that compilers
like GCC could generate DW_TAG_base_type DIE without a name.

Note that we didn't need this before because the old libdwarf
internally set all the unnamed DIE's name to "__anon__".


# 58fc1c99 16-Jan-2014 Kai Wang <kaiw@FreeBSD.org>

Convert ctfconvert to use the new libdwarf API.


# d69c2869 26-Aug-2013 Pedro F. Giffuni <pfg@FreeBSD.org>

Merge various CTF fixes from illumos

2942 CTF tools need to handle files which legitimately lack data
2978 ctfconvert still needs to ignore legitimately dataless files on SPARC

Illumos Revisions: 13745:6b3106b4250f
13754:7231b684c18b

Reference:

https://www.illumos.org/issues/2942
https://www.illumos.org/issues/2978

MFC after: 3 weeks


# c7cdfecc 25-Jul-2013 Pedro F. Giffuni <pfg@FreeBSD.org>

Fix a segfault in ctfmerge due to a bug in gcc.

GCC can generate bogus dwarf attributes with DW_AT_byte_size
set to 0xFFFFFFFF.
The issue was originaly detected in NetBSD but it has been
adapted for portability and to avoid compiler warnings.

Reference:
https://www.illumos.org/issues/3776

Obtained from: NetBSD
MFC after: 1 month


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# e9c7a604 25-Apr-2008 John Birrell <jb@FreeBSD.org>

Use FreeBSD's libdwarf which is BSD licensed instead of the GPL'd one that
is used in Solaris.