ctfconvert broken for C++ objects?

Dimitry Andric dim at FreeBSD.org
Sun Mar 2 13:26:21 UTC 2014


On 21 Feb 2014, at 23:47, Justin T. Gibbs <gibbs at FreeBSD.org> wrote:
> On Feb 20, 2014, at 10:26 AM, Roman Divacky <rdivacky at freebsd.org> wrote:
> 
>> The dwarf backend for ctfconvert was completely reimplemented a few weeks ago.
>> It's now based on elftoolchain libdwarf.
>> 
>> Test on current.
> 
> The failures I’ve experienced occur when attempting to ctfconvert the C++ code in the base (e.g. ATF or devd).  You can replicate the failures on head by applying the share/mk patch below (a version of my previous patch rebased on head).

I've just tried your patch, building devd, and it seemed to have worked
just fine (though I had to use DEBUG_FLAGS=-g, otherwise ctfconvert
would complain there was no type data to convert):

$ make WITH_CTF=x DEBUG_FLAGS=-g
c++ -O2 -pipe -I. -I/usr/src/sbin/devd -g -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wpointer-arith -Wno-uninitialized -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -g -Wno-c++11-extensions  -c /usr/src/sbin/devd/devd.cc
cc -O2 -pipe  -I. -I/usr/src/sbin/devd -g -std=gnu99 -Qunused-arguments  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -c token.c
ctfconvert -L VERSION -g token.o
cc -O2 -pipe  -I. -I/usr/src/sbin/devd -g -std=gnu99 -Qunused-arguments  -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-uninitialized -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -c parse.c
ctfconvert -L VERSION -g parse.o
c++ -O2 -pipe -I. -I/usr/src/sbin/devd -g -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wpointer-arith -Wno-uninitialized -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -g -Wno-c++11-extensions   -static -o devd devd.o token.o parse.o -ll -lutil
ctfmerge -L VERSION -g -o devd devd.o token.o parse.o
gzip -cn /usr/src/sbin/devd/devd.8 > devd.8.gz
gzip -cn /usr/src/sbin/devd/devd.conf.5 > devd.conf.5.gz

$ ctfdump -S /usr/obj/usr/src/sbin/devd/devd

- CTF Statistics -------------------------------------------------------------

  total number of data objects        = 627

  total number of functions           = 31
  total number of function arguments  = 25
  maximum argument list length        = 2
  average argument list length        = 0.81

  total number of types               = 97
  total number of integers            = 9
  total number of floats              = 0
  total number of pointers            = 24
  total number of arrays              = 16
  total number of func types          = 6
  total number of structs             = 7
  total number of unions              = 2
  total number of enums               = 0
  total number of forward tags        = 4
  total number of typedefs            = 25
  total number of volatile types      = 0
  total number of const types         = 4
  total number of restrict types      = 0
  total number of unknowns (holes)    = 0

  total number of struct members      = 64
  maximum number of struct members    = 25
  total size of all structs           = 3492
  maximum size of a struct            = 3156
  average number of struct members    = 9.14
  average size of a struct            = 498.86

  total number of union members       = 6
  maximum number of union members     = 4
  total size of all unions            = 132
  maximum size of a union             = 128
  average number of union members     = 3.00
  average size of a union             = 66.00

  total number of enum members        = 0
  maximum number of enum members      = 0

  total number of unique strings      = 112
  bytes of string data                = 1051
  maximum string length               = 26
  average string length               = 9.38


> On a slightly related node, do you know why there is a FreeBSD version ranged exclusion around bootstrapping the dtrace tools?
> 
> From src/Makefile.inc1:
> # dtrace tools are required for older bootstrap env and cross-build              
> .if ${MK_CDDL} != "no" && \                                                      
>    ((${BOOTSTRAPPING} < 1000034 && \                                            
>          !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999)) \          
>      || (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))         
> _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \                  
>    lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge                   
> .endif

This was last changed by Brooks in r251689: "Be more agressive about
bootstrapping ctfmerge and ctfconvert so builds from existing releases
have a chance of working properly".  The range check was modified from:

    ((${BOOTSTRAPPING} < 800038 && !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999))

to:

    ((${BOOTSTRAPPING} < 1000034 && !(${BOOTSTRAPPING} >= 901505 && ${BOOTSTRAPPING} < 999999))

but maybe the 9.x range check is now too narrow?

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20140302/a4508067/attachment.sig>


More information about the freebsd-toolchain mailing list