Bug #6893

ctf_add_{struct,union,enum} can reuse forwards

Added by Robert Mustacchi over 3 years ago. Updated 10 months ago.

lib - userland libraries
Start date:
Due date:
% Done:


Estimated time:


The ctf_add_struct, ctf_add_union, and ctf_add_forward, routines all attempt to take an existing forward and instead transform it into the appropriate type if it exists. This is done in an effort to try and allow forwards to be replaced with references to actual types.

However, if something of the same name is added twice to the same container (which is legal) and it was originally a forward, then we'll clobber the original use of it, leading to confusion in terms of what's going on. This means that we may end up with two different structs that have the same id. Instead, if we encounter that we've already reassigned it, we should instead create a new entry.

Related issues

Related to illumos gate - Feature #6885: CTF Everywhere Part 1Closed2016-04-11




Updated by Robert Mustacchi over 3 years ago


Updated by Electric Monk 10 months ago

  • Status changed from New to Closed

git commit bc1f688b4872ace323eaddbb1a6365d054e7bf56

commit  bc1f688b4872ace323eaddbb1a6365d054e7bf56
Author: Robert Mustacchi <>
Date:   2019-02-11T17:40:04.000Z

    6885 CTF Everywhere Part 1
    6886 Want ctfdiff
    6887 ctfdump should be written in terms of libctf
    6888 ctfmerge should be implemented in terms of libctf
    6889 ctfconvert should be implemented in terms of libctf
    6890 Want general workq
    6891 Want general mergeq
    6892 ctf_add_encoded assigns() incorrect byte size to types
    6893 ctf_add_{struct,union,enum} can reuse forwards
    6894 ctf_add_{struct,union,enum} occasionally forget to dirty the ctf_file_t
    6895 ctf_add_member could better handle bitfields
    6896 ctf_type_size() reports wrong size for forwards
    6897 Want libctf ctf_kind_name() function
    6898 Want libctf function to set struct/union size
    Portions contributed by: John Levon <>
    Portions contributed by: Richard Lowe <>
    Reviewed by: John Levon <>
    Reviewed by: Andy Fiddaman <>
    Reviewed by: Gergő Doma <>
    Approved by: Dan McDonald <>

Also available in: Atom PDF