XS-libdwarf

 view release on metacpan or  search on metacpan

libdwarf-code-0.11.1/ChangeLog  view on Meta::CPAN


2024-01-26:  David Anderson
    commit 0bae85ef5ac5eac3b5bf21aff32eb607be9db742

    Now with latest git log
            modified:   ChangeLog

2024-01-26:  David Anderson
    commit cc343150beab8de77ae28c493ce8a83db152bda3

    A compiler used R_386_GOTOFF for a relocation
    for DWARF data.
    Now that relocation is handled.
            modified:   src/lib/libdwarf/dwarf_elf_defines.h
            modified:   src/lib/libdwarf/dwarf_elf_rel_detector.c

2024-01-26:  David Anderson
    commit bef1fc97f1da8e0a9e0609c2572fd79179a3b7bb

    One place in generic_ehdr_from_64()
    needed a check for e_shnum zero.
            modified:   src/lib/libdwarf/dwarf_elf_load_headers.c

libdwarf-code-0.11.1/ChangeLog  view on Meta::CPAN

    agree on the argument and return types and the variables
    are appropriately typed.

2024-01-09:  David Anderson
    commit 13cf9ff0ec8593e5bf494c4e33fd0da6b4727888

    Now we can read DWARF2 produced by an obsolete
    compiler from Metrowerks. It uses DW_FORM_ref_addr
    where it means DW_FORM_addr (DW_AT_low_pc
    for example). It sets the
    relocation section type to SHT_RELA correctly
    and then names the section with .rel (not .rela
    as it should).
    It has two .rel.debug_line sections for no reason.

    libdwarf checks the CU die DW_AT_producer string
    and notes when a CU was produced by the Metrowerks
    compiler, recording that internally for use
    in dealing with attributes and FORMs.
            modified:   src/lib/libdwarf/dwarf_die_deliv.c
            modified:   src/lib/libdwarf/dwarf_elf_load_headers.c

libdwarf-code-0.11.1/ChangeLog2020  view on Meta::CPAN

    * configure.ac: Now version 20200315
    * configure: Regenerated.
2020-03-09  David Anderson
    * configure.ac: Now version 20200307.
    * configure: Regenerated.
2020-02-25  David Anderson
    * configure.ac: now 20200225
    * configure: Regenerated.
2020-02-15  David Anderson
    * configure.ac: Version string now 20200215 as we now
      deal with libelf-reading-relocation-sections.
      (nolibelf code already did those as of 20200213
    * configure: Regenerated.
2020-02-13  David Anderson
    * configure.ac: Version string now 20200213
    * configure: Regenerated.
2020-01-05  David Anderson
    * configure.ac: Version string now 20200105
    * configure: Regenerated.

libdwarf-code-0.11.1/ChangeLog2021  view on Meta::CPAN

            modified:   src/bin/dwarfdump/dd_regex.c

2021-09-03:  David Anderson
    commit ee98aefb1c51e9dc2b654c783217dad765323e2d

    Now, with --enable-shared the shared library
    uses gcc -visibility=hidden (if your non-Windows compiler
    supports it) to reduce the size of the elf .dynsym
    section.  For libdwarf, this reduces the
    external symbol count from 542 to 373, a 32 percent
    savings in symbols to be read/relocated
    in loading libdwarf.so

    Windows builds already supported Windows
    facilities with the same effect.
            modified:   configure.ac

2021-09-03:  David Anderson
    commit d1f5ea7a91a8d66e35f1574633bb58fe45d69f83

    Renamed all the libdwarfp  source file names

libdwarf-code-0.11.1/ChangeLog2021  view on Meta::CPAN

    It is renamed _dwarf_skip_leb128 in dwarf_opaque.h
            modified:   src/lib/libdwarf/dwarf_opaque.h
            modified:   src/lib/libdwarf/dwarf_util.h
            modified:   src/lib/libdwarf/libdwarf.h
            modified:   test/dwarf_leb_test.c

2021-08-09:  David Anderson
    commit 79342e6f7ed03581268d3932ec03b39180cc704e

    The table of nearly 500 error strings is now a simple
    array, eliminating nearly 500 relocations
    from DSO startup. It does take 50K space, whereas
    the real strings are about 24K. But the relocations
    are a time waster.
    Shortened a few default error strings that were
    overly long --- Reducing the string length static dimension
    by about 13 bytes each entry compared to previous.
            modified:   src/lib/libdwarf/dwarf_errmsg_list.h
            modified:   src/lib/libdwarf/dwarf_error.c
    Added new checks to determine the wasted space and
    check that the new message content is set up properly.
    The short report it prints is for maintainers
    who change these things.

libdwarf-code-0.11.1/ChangeLog2022  view on Meta::CPAN

            modified:   dwarf_elf_load_headers.c

2022-12-01:  David Anderson
    commit 1f462173f1c905954733c5228d80b1fe64124a5f

    Removed unused and unusable code.
            modified:   src/bin/dwarfdump/dd_checkutil.c
    Removed pointless argument from PrintBucketGroup().
            modified:   src/bin/dwarfdump/dd_checkutil.h
    Removed lots of code relating to unusable options:
    -o (was used for printing Elf relocation records)
            modified:   src/bin/dwarfdump/dd_command_options.c

    Removing unneeded arg from PrintBucketGroup() call.
            modified:   src/bin/dwarfdump/dwarfdump.c
    Removing unneeded arg from PrintBucketGroup() call.
    Removed very old #if 0 set of lines.
            modified:   src/bin/dwarfdump/print_die.c

    Removed code once used to process archives.
    We do not process those now.

libdwarf-code-0.11.1/ChangeLog2022  view on Meta::CPAN

2022-10-17:  David Anderson
    commit 129d6fa0b5cb935b3915aa88b0867c4e2bab3530

    Remove trailing whitespace.
            modified:   src/bin/dwarfdump/dwarfdump.c
            modified:   src/bin/dwarfdump/print_lines.c

2022-10-17:  David Anderson
    commit 06c9b536ff50199dc798f7d1faa34cffb632baf8

    In a relocatable object .debug_names needs
    to be relocated, otherwise we get
    an error from reading with libdwarf.
    Now it is relocated when appropriate.
            modified:   src/lib/libdwarf/dwarf_elfread.c

2022-10-13:  David Anderson
    commit 43a23049a6a7392c46e4339a9e1ee7b6a73bb32b

    With latest git log information.
            modified:   ChangeLog

2022-10-13:  David Anderson
    commit a6a8be137502b750f63b57eee89aba4e0e1bf9ce

libdwarf-code-0.11.1/ChangeLog2022  view on Meta::CPAN

2022-07-15:  David Anderson
    commit d68c167e90dd03758e8a548d612d38a608dfd5b5

    Latest git log entry now in ChangeLog
            modified:   ChangeLog

2022-07-15:  David Anderson
    commit 78005a95d916c84b92f0ca58f75ded3a2e3f91d8

    Implemented a better, faster, universal way to deal
    with R_<machine>_NONE relocation records.
    Should have done it this way years ago.
            modified:   lib/libdwarf/dwarf_elfread.c

2022-07-15:  David Anderson
    commit def530e467d6f15bdd87bc96a368a96c4b3f7ac3

    Several lines had indentation errors.
    Fixed.
            modified:   lib/libdwarf/dwarf_global.c

libdwarf-code-0.11.1/ChangeLog2022  view on Meta::CPAN


2022-07-15:  David Anderson
    commit b90af706cd68fe41b824b15824a3bda44d640818

    So we have latest git log data here.
            modified:   ChangeLog

2022-07-14:  David Anderson
    commit e85fbe398ec44ec322b5996e4db70ed66d131d73

    Added R_AARCH64_NONE (means no relocation  to do)
            modified:   src/lib/libdwarf/dwarf_elf_defines.h
    Now handles R_AARCH64_NONE
            modified:   src/lib/libdwarf/dwarf_elfread.c

2022-06-25:  David Anderson
    commit 5f721888872503179a43db68ce2263742279a6d8

    Now with git log data about 0.4.2.
            modified:   ChangeLog

libdwarf-code-0.11.1/ChangeLog2023  view on Meta::CPAN

    We lost track that this was an open bug.
    Now fixed.
    It has been in existence for years.
            modified:   dwarf_frame2.c

2023-08-25:  David Anderson
    commit 4442d453370b50b943331e359e40dd981668175c

    Expanded the description of the
    bug fix where an ET_EXEC object
    was having relocations applied
    (linkers do not normally produce
    a non-relocatable object with
    relocation sections).
            modified:   ChangeLog

2023-08-23:  David Anderson
    commit 5bdbcf570cc3f999528a7421c6d4bc0e31fb3565

    Up to date with git log
            modified:   ChangeLog

2023-08-23:  David Anderson
    commit 96bd161d41050ed367716cdcb249a9e55bfe60a9

    An executable with relocations exposed
    the mistake of running relocations on
    non-relocatable objects.
    Now we test the elf header e_type field and if
    the e_type is not ET_REL we do no relocations.
            modified:   src/lib/libdwarf/dwarf_elfread.c

2023-08-20:  David Anderson
    commit b6e314cd78a79c36252dd4948529f0c2e58605ff

    Up to date with git log
            modified:   ChangeLog

2023-08-20:  David Anderson
    commit 2c47b4816685d6e2b9f097a718b155baaa587899

libdwarf-code-0.11.1/INSTALL  view on Meta::CPAN

both of the following shortcuts of passing variable assignments to the
'make install' command line to change installation locations without
having to reconfigure or recompile.

   The first method involves providing an override variable for each
affected directory.  For example, 'make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
'${prefix}'.  Any directories that were specified during 'configure',
but not in terms of '${prefix}', must each be overridden at install time
for the entire installation to be relocated.  The approach of makefile
variable overrides for each directory variable is required by the GNU
Coding Standards, and ideally causes no recompilation.  However, some
platforms have known limitations with the semantics of shared libraries
that end up requiring recompilation when using this method, particularly
noticeable in packages that use GNU Libtool.

   The second method involves providing the 'DESTDIR' variable.  For
example, 'make install DESTDIR=/alternate/directory' will prepend
'/alternate/directory' before all installation names.  The approach of
'DESTDIR' overrides is not required by the GNU Coding Standards, and

libdwarf-code-0.11.1/NEWS  view on Meta::CPAN

  On Windows-MinGW the full regression tests
  have not been tested, but 'make check' works
  for dwarfdump/libdwarf (the current dwarfdump
  make check actually does run dwarfdump and
  checks that dwarfdump basically works).
2019-04-16:
  Now a --disable-libelf configure/build of libdwarf/dwarfdump
  can read elf, mach-o DSYM, and PE executable/dll object files.
  Such a build will not need or use libelf or elf.h .
  The dwarfdump options that display Elf section headers
  or relocation record data are not available in a
  --disable-libelf build.
  Nor is dwarfdump's support of reading archive files
  available in a --disable-libelf build.
  This libdwarf detects corrupt Elf object files much sooner
  than before, but does not explain what the corruption
  really is. Use GNU readelf (or readelfobj, a project
  on sourceforge) to get more detail about the problems found.
  See https://www.prevanders.net/dwarf.html for the git clone
  command for readelfobj.
  With --disable-libelf the --enable-dwarfgen option

libdwarf-code-0.11.1/bugxml/data.txt  view on Meta::CPAN

datefixed: 2015-05-18
references: regressiontests/liu/OOB0517_01.elf
gitfixid: ac6673e32f3443a5d36c2217cb814000930b2c54
tarrelease: libdwarf-20160923.tar.gz
endrec:

id: DW201605-012
cve: CVE-2016-5034
datereported: 2016-05-13
reportedby: Yue Liu
vulnerability: OOB write. From relocation records
product: libdwarf
description: Test object shows
 an invalid write in dwarf_elf_access.c
 (when doing the relocations).
 Adding the relocation value to anything overflowed
 and disguised the bad relocation record.
 With a 32bit kernel build the test could show
 a double-free and coredump due to the unchecked invalid
 writes from relocations.
datefixed: 2016-05-17
references: regressiontests/liu/HeapOverflow0513.elf
gitfixid: 10ca310f64368dc083efacac87732c02ef560a92
tarrelease: libdwarf-20160923.tar.gz
endrec:

id: DW201605-011
cve: CVE-2016-5035
datereported: 2016-05-06
reportedby: Yue Liu

libdwarf-code-0.11.1/bugxml/dwarfbug.html  view on Meta::CPAN

<h3 id="DW201605-012">173) DW201605-012</h3>
<p>id: DW201605-012
</p>
<p>cve: CVE-2016-5034
</p>
<p>fuzzer:</p>
<p>datereported: 2016-05-13
</p>
<p>reportedby: Yue Liu
</p>
<p>vulnerability: OOB write. From relocation records
</p>
<p>product: libdwarf
</p>
<p>description: Test object shows
 an invalid write in dwarf_elf_access.c
 (when doing the relocations).
 Adding the relocation value to anything overflowed
 and disguised the bad relocation record.
 With a 32bit kernel build the test could show
 a double-free and coredump due to the unchecked invalid
 writes from relocations.
</p>
<p>datefixed: 2016-05-17
</p>
<p>references: regressiontests/liu/HeapOverflow0513.elf
</p>
<p>gitfixid: 10ca310f64368dc083efacac87732c02ef560a92
</p>
<p>tarrelease: libdwarf-20160923.tar.gz
</p>
<p> <a href="#top">[top]</a> </p>

libdwarf-code-0.11.1/bugxml/dwarfbug.xml  view on Meta::CPAN

<gitfixid>ac6673e32f3443a5d36c2217cb814000930b2c54</gitfixid>
<tarrelease>libdwarf-20160923.tar.gz</tarrelease>
</dwbug>
<dwbug>
<dwid>DW201605-012</dwid>
<cve>CVE-2016-5034</cve>
<fuzzer></fuzzer>
<datereported>2016-05-13</datereported>
<reportedby>Yue Liu</reportedby>
<product>libdwarf</product>
<vulnerability> OOB write. From relocation records
</vulnerability>
<description> Test object shows
 an invalid write in dwarf_elf_access.c
 (when doing the relocations).
 Adding the relocation value to anything overflowed
 and disguised the bad relocation record.
 With a 32bit kernel build the test could show
 a double-free and coredump due to the unchecked invalid
 writes from relocations.
</description>
<datefixed>2016-05-17</datefixed>
<references> regressiontests/liu/HeapOverflow0513.elf
</references>
<gitfixid>10ca310f64368dc083efacac87732c02ef560a92</gitfixid>
<tarrelease>libdwarf-20160923.tar.gz</tarrelease>
</dwbug>
<dwbug>
<dwid>DW201605-011</dwid>
<cve>CVE-2016-5035</cve>

libdwarf-code-0.11.1/bugxml/dwarfbuglohi.html  view on Meta::CPAN

<h3 id="DW201605-012">17) DW201605-012</h3>
<p>id: DW201605-012
</p>
<p>cve: CVE-2016-5034
</p>
<p>fuzzer:</p>
<p>datereported: 2016-05-13
</p>
<p>reportedby: Yue Liu
</p>
<p>vulnerability: OOB write. From relocation records
</p>
<p>product: libdwarf
</p>
<p>description: Test object shows
 an invalid write in dwarf_elf_access.c
 (when doing the relocations).
 Adding the relocation value to anything overflowed
 and disguised the bad relocation record.
 With a 32bit kernel build the test could show
 a double-free and coredump due to the unchecked invalid
 writes from relocations.
</p>
<p>datefixed: 2016-05-17
</p>
<p>references: regressiontests/liu/HeapOverflow0513.elf
</p>
<p>gitfixid: 10ca310f64368dc083efacac87732c02ef560a92
</p>
<p>tarrelease: libdwarf-20160923.tar.gz
</p>
<p> <a href="#top">[top]</a> </p>

libdwarf-code-0.11.1/doc/dwarfgen.1  view on Meta::CPAN

Default is -1 which won't match anything.
.El
.Pp
Other options:
.Bl -tag -compact
.It Fl h
transform high PC to const. 
.It Fl s
output as text.
.It Fl r
show relocation details.
.It Fl v Ar version
DWARF version 2, 3, 4, or 5. 
.It Fl p Ar size
pointer size, 4 or 8.
.It Fl f Ar offset
offset size, 4 or 8.
.El
.
.\" .Sh ENVIRONMENT
.\" For sections 1, 6, 7, and 8 only.

libdwarf-code-0.11.1/doc/jitaccess.dox  view on Meta::CPAN

            int                       * error);
        Dwarf_Small      (*om_get_byte_order)(void* obj);
        Dwarf_Small      (*om_get_length_size)(void* obj);
        Dwarf_Small      (*om_get_pointer_size)(void* obj);
        Dwarf_Unsigned   (*om_get_filesize)(void* obj);
        Dwarf_Unsigned   (*om_get_section_count)(void* obj);
        int              (*om_load_section)(void* obj,
            Dwarf_Half    section_index,
            Dwarf_Small** return_data,
            int         * error);
        int              (*om_relocate_a_section)(void* obj,
            Dwarf_Half  section_index,
            Dwarf_Debug dbg,
            int        *error);
    };

    typedef struct Dwarf_Obj_Access_Section_a_s
        Dwarf_Obj_Access_Section_a
    struct Dwarf_Obj_Access_Section_a_s {
        const char*    as_name;
        Dwarf_Unsigned as_type;

libdwarf-code-0.11.1/doc/jitaccess.dox  view on Meta::CPAN

    error         - Pointer to an integer for returning
        libdwarf-defined error numbers.

    Return
    DW_DLV_OK       - No error.
    DW_DLV_ERROR    - Error. Use 'error' to indicate
        a libdwarf-defined error number.
    DW_DLV_NO_ENTRY - No such section.  */
    @endcode

    @b om_relocate_a_section

    @code
    Leave this pointer NULL.
    If relocations are required it is probably simpler
    for you do to them yourself n your
    implementation of @b om_load_section .
    Any relocations this function pointer
    is to use must be in standard Elf
    relocation (32 or 64 bit) form and must be
    in an appropriately named Elf relocation section.

    Parameters
    obj  -  Your data
    section_index - Zero-based index of the
        section to be relocated.
    error - Pointer to an integer for returning libdwarf-defined
        error numbers.

    Return
    DW_DLV_OK - No error.
    DW_DLV_ERROR - Error. Use 'error' to indicate
        a libdwarf-defined
        error number.
    DW_DLV_NO_ENTRY - No such section.
    @endcode

libdwarf-code-0.11.1/doc/libdwarf.dox  view on Meta::CPAN

            int* error);
        Dwarf_Small      (*om_get_byte_order)(void* obj);
        Dwarf_Small      (*om_get_length_size)(void* obj);
        Dwarf_Small      (*om_get_pointer_size)(void* obj);
        Dwarf_Unsigned   (*om_get_filesize)(void* obj);

        Dwarf_Unsigned   (*om_get_section_count)(void* obj);
        int              (*om_load_section)(void* obj,
            Dwarf_Unsigned section_index,
            Dwarf_Small** return_data, int* error);
        int              (*om_relocate_a_section)(void* obj,
            Dwarf_Unsigned section_index,
            Dwarf_Debug dbg,
            int* error);
    };

    typedef struct Dwarf_Obj_Access_Section_a_s
        Dwarf_Obj_Access_Section_a
    struct Dwarf_Obj_Access_Section_a_s {
        const char*    as_name;
        Dwarf_Unsigned as_type;

libdwarf-code-0.11.1/doc/libdwarf.dox  view on Meta::CPAN

        Dwarf_Unsigned as_entrysize;
    };
    @endcode

    @b Dwarf_Obj_Access_Section_a:
    Your implementation of a @b om_get_section_info
    must fill in a few fields for @e libdwarf.
    The fields here are
    standard Elf, but for most you can just use
    the value zero.  We assume here you will not be
    doing relocations at runtime.

    @b as_name: Here you set a section name via
    the pointer.  The section names must be names
    as defined in the DWARF standard, so if such do
    not appear in your data you have to create the
    strings yourself.

    @b as_type: Fill in zero.

    @b as_flags: Fill in zero.

libdwarf-code-0.11.1/doc/libdwarf.dox  view on Meta::CPAN

    in it and each section in such a group will be
    assigned the same group number by @e libdwarf.

    Sections that are in a .dwp .dwo object file
    are assigned to DW_GROUPNUMBER_DWO,

    Sections not part of a .dwp package file or
    a.dwo section, or a COMDAT group are assigned
    DW_GROUPNUMBER_BASE.

    At least one compiler relies on relocations to
    identify COMDAT groups, but the compiler authors
    do not publicly document how this works so we
    ignore such (these COMDAT groups will result in
    @e libdwarf returning DW_DLV_ERROR).

    Popular compilers and tools are using such
    sections. There is no detailed documentation that
    we can find (so far) on how the COMDAT section
    groups are used, so @e libdwarf is based on
    observations of what compilers generate.

libdwarf-code-0.11.1/doc/libdwarf.dox  view on Meta::CPAN

    to <b>Dwarf_Unsigned</b> as abbrev codes are
    not constrained by the DWARF Standard.

    The section count returned by dwarf_get_section_count()
    is now of type <b>Dwarf_Unsigned</b>. The previous type
    of <b>int</b> never made sense in @e libdwarf.
    Callers will, in practice, see the same value as before.

    All type-warnings issued by MSVC have been fixed.

    Problems reading Macho (Apple) relocatable
    object files have been fixed.

    Each of the build systems available now has an option
    which eliminates @e libdwarf references to the
    object section decompression libraries.
    See the respective READMEs.

    <b>Changes 0.8.0 to 0.9.0</b>

    Version 0.9.0 released 8 December 2023

libdwarf-code-0.11.1/doc/libdwarf.dox  view on Meta::CPAN


    v0.7.0 released 2023-05-20

    Elf section counts can exceed 16 bits
    (on linux see <b>man 5 elf</b>)
    so some function prototype members
    of struct <b>Dwarf_Obj_Access_Methods_a_s</b>
    changed.
    Specifically, om_get_section_info()
    om_load_section(), and
    om_relocate_a_section()
    now pass section indexes as Dwarf_Unsigned
    instead of Dwarf_Half.
    Without this change executables/objects
    with more than 64K sections cannot
    be read by @e libdwarf.  This is unlikely
    to affect your code since for most users
    @e libdwarf takes care of this and dwarfdump
    is aware of this change.

    Two functions have been removed from libdwarf.h

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN


.H 2 "Namespace issues"
Application programs should avoid creating names
beginning with 
\f(CWDwarf_\fP
\f(CWdwarf_\fP
or 
\f(CWDW_\fP
as these are reserved to dwarf and libdwarf.

.H 1 "libdwarf and Elf and relocations"
Much of the description below presumes that 
Elf is the object
format in use.
The library is probably usable with other object formats
that allow arbitrary sections to be created.
The library does not write anything to disk.
Instead it provides access so that callers
can do that in whatever object format
is appropriate.

.H 2 "binary or assembler output"
With 
\f(CWDW_DLC_STREAM_RELOCATIONS\fP 
(see below)
it is assumed that the calling app will simply
write the streams and relocations directly into
an Elf file, without going through an assembler.

With 
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP 
the calling app must either 
A) generate binary relocation streams and write
the generated debug information streams and
the relocation streams direct to an elf file
or
B) generate assembler output text for an assembler
to read and produce an object file. 

With case B) the libdwarf-calling application must
use the relocation information to change
points of each binary stream into references to 
symbolic names.  
It is necessary for the assembler to be
willing to accept and generate relocations
for references from arbitrary byte boundaries.
For example:
.sp
.nf
.in +4
 .data 0a0bcc    #producing 3 bytes of data.
 .word mylabel   #producing a reference
 .word endlabel - startlabel #producing absolute length
.in -4
.fi

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

a sequence of integers back (with 1 as the lowest).

When the documentation below refers to 'an Elf symbol index'
it is really dependent on 
Elf symbol numbers
only if
\f(CWDW_DLC_STREAM_RELOCATIONS\fP 
are being generated (see below).
With 
\f(CWDW_DLC_STREAM_RELOCATIONS\fP 
the library is generating Elf relocations
and the section numbers in binary form so
the section numbers and symbol indices must really 
be Elf (or elf-like) numbers.

With
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP 
the values passed as symbol indexes can be any
integer set or even pointer set.
All that libdwarf assumes is that where values
are unique they get unique values.
Libdwarf does not generate any kind of symbol table
from the numbers and does not check their
uniqueness or lack thereof.

.H 2 "libdwarf and relocations"
With
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP 
libdwarf creates binary streams of debug information
and arrays of relocation information describing
the necessary relocation.
The Elf section numbers and symbol numbers appear
nowhere in the binary streams. Such appear
only in the relocation information and the passed-back
information from calls requesting the relocation information.
As a consequence, the 'symbol indices' can be
any pointer or integer value as the caller must
arrange that the output deal with relocations.

With 
\f(CWDW_DLC_STREAM_RELOCATIONS\fP 
all the relocations are directly created by libdwarf
as binary streams (libdwarf only creates the streams
in memory,
it does not write them to disk).

.H 2 "symbols, addresses, and offsets"
The following applies to calls that
pass in symbol indices, addresses, and offsets, such
as
\f(CWdwarf_add_AT_targ_address_c() \fP 
\f(CWdwarf_add_arange_c()\fP 

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

a passed in address is one of:
a) a section offset and the (non-global) symbol index of
a section symbol.
b) A symbol index (global symbol) and a zero offset.

With \f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP
the same approach can be used, or, instead,
a passed in address may be
c) a symbol handle and an offset.
In this case, since it is up to the calling app to
generate binary relocations (if appropriate)
or to turn the binary stream into 
a text stream (for input to an assembler, if appropriate)
the application has complete control of the interpretation
of the symbol handles.

.H 1 "Memory Management"

Several of the functions that comprise the \fILibdwarf\fP 
producer interface dynamically allocate values and some
return pointers to those spaces.

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

The function \f(CWdwarf_producer_init() \fP returns a new 
\f(CWDwarf_P_Debug\fP descriptor that can be used to add
\f(CWDwarf\fP 
information to the object.  
On success it returns \f(CWDW_DLV_OK\fP.  
On error it returns \f(CWDW_DLV_ERROR\fP.  
\f(CWflags\fP determine whether the target object is 64-bit or 32-bit.  
\f(CWfunc\fP
is a pointer to a function called-back from \f(CWLibdwarf\fP 
whenever \f(CWLibdwarf\fP needs to create a new object section (as it will 
for each .debug_* section and related relocation section).  

.P
The \f(CWflags\fP
values (to be OR'd together in the flags field
in the calling code) are as follows:
.in +4
\f(CWDW_DLC_WRITE\fP 
is required.
The values
\f(CWDW_DLC_READ\fP  

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN


Either one of two output forms is specifiable:
\f(CWDW_DLC_STREAM_RELOCATIONS\fP 
or
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP .

The default is
\f(CWDW_DLC_STREAM_RELOCATIONS\fP . 
The
\f(CWDW_DLC_STREAM_RELOCATIONS\fP
are relocations in a binary stream (as used
in a MIPS/IRIX Elf object).

The
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP
are the same relocations but expressed in an
array of structures defined by libdwarf,
which the caller of the relevant function
(see below) must deal with appropriately.
This method of expressing relocations allows 
the producer-application to easily produce
assembler text output of debugging information.

When
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP
is ORed into \f(CWflags\fP
then relocations are returned not as streams
but through an array of structures.

.in -4

.P
The function 
\f(CWfunc\fP 
must be provided by the user of this library.
Its prototype is:
.DS

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

    int*                error) \fP
.DE
For each section in the object file that \f(CWlibdwarf\fP
needs to create, it calls this function once (calling it
from \f(CWdwarf_transform_to_disk_form()\fP), passing in
the section \f(CWname\fP, the section \f(CWtype\fP,
the section \f(CWflags\fP, the \f(CWlink\fP field, and
the \f(CWinfo\fP field.  
For an Elf object file these values
should be appropriate Elf section header values.
For example, for relocation callbacks, the \f(CWlink\fP
field is supposed to be set (by the app) to the index
of the symtab section (the link field passed through the
callback must be ignored by the app).
And, for relocation callbacks, the \f(CWinfo\fP field
is passed as the elf section number of the section
the relocations apply to.
.P
The  \f(CWsect_name_index\fP field is a field you use
to pass a symbol index back to libdwarf.
In Elf, each section gets an elf symbol table entry
so that relocations have an address to refer to
(relocations rely on addresses in the Elf symbol table).
You will create the Elf symbol table, so you have to tell
libdwarf the index to put into relocation records for the
section newly defined here.
.P
On success
the user function should return the Elf section number of the
newly created Elf section.
.P
On success, the function should also set the integer
pointed to by \f(CWsect_name_index\fP to the
Elf symbol number assigned in the Elf symbol table of the
new Elf section.
This symbol number is needed with relocations
dependent on the relocation of this new section.
.P
Use the 
\f(CWdwarf_producer_init_c()\fP
interface instead of this interface.
.P
For example, the \f(CW.debug_line\fP section's third
data element (in a compilation unit) is the offset from the
beginning of the \f(CW.debug_info\fP section of the compilation
unit entry for this \f(CW.debug_line\fP set.
The relocation entry in \f(CW.rel.debug_line\fP
for this offset
must have the relocation symbol index of the 
symbol \f(CW.debug_info\fP  returned
by the callback of that section-creation through 
the pointer \f(CWsect_name_index\fP.
.P
On failure, the function should return -1 and set the \f(CWerror\fP
integer to an error code.
.P
Nothing in libdwarf actually depends on the section index
returned being a real Elf section.
The Elf section is simply useful for generating relocation
records.
Similarly, the Elf symbol table index returned through 
the \f(CWsect_name_index\fP must be an index
that can be used in relocations against this section.
The application will probably want to note the
values passed to this function in some form, even if
no Elf file is being produced.

.P
\f(CWerrhand\fP 
is a pointer to a function that will be used as
a default fall-back function for handling errors detected 
by \f(CWLibdwarf\fP.  

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

The \f(CWisa_name\fP argument 
must be non-null and contain one of the
strings defined in the isa_relocs array
in pro_init.c: "irix","mips","x86",
"x86_64","arm","arm64","ppc","ppc64",
"sparc". 
The names are not strictly ISA
names (nor ABI names) but a hopefully-meaningful
mixing of the concepts of ISA and ABI.
The intent is mainly to 
define relocation codes applicable to DW_DLC_STREAM_RELOCATIONS.
New \f(CWisa_name\fP values will be provided as users
request. In the "irix" case a special relocation is defined
so a special CIE reference field can be created (if and
only if the augmentation
string is "z").
.P
The \f(CWdwarf_version\fP argument 
should be one of 
"V2",
"V3",
"V4",
"V5"

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

The callback provides the connection
between Elf sections (which we presume
is the object format to be emitted) and
the 
\f(CWlibdwarf()\fP 
internal section numbering.
.P
For \f(CWDW_DLC_STREAM_RELOCATIONS\fP
a call to 
\f(CWDwarf_Callback_Func\fP is made
by libdwarf for each relocation section.
Calls to \f(CWdwarf_get_section_bytes_a()\fP (see below).
allow the 
\f(CWdwarf_transform_to_disk_form_a()\fP  caller
to get byte streams and write them to
an object file as desired, just as with
the other sections of the object being created.
.P
For \f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP
the user code should use
\f(CWdwarf_get_relocation_info_count()\fP
and
\f(CWdwarf_get_relocation_info()\fP
to retrieve the relocation info
generated by 
\f(CWdwarf_transform_to_disk_form()\fP
and do something with it.

.P
On failure it returns 
\f(CWDW_DLV_ERROR\fP
and returns an error pointer through
\f(CW*error\fP .

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

required sequence.
.P
In case of an error, 
\f(CWDW_DLV_ERROR\fP
is returned and 
the \f(CWerror\fP argument is set to indicate the error.
.P
There is no requirement that the section bytes actually 
be written to an elf file.
For example, consider the .debug_info section and its
relocation section (the call back function would resulted in
assigning 'section' numbers and the link field to tie these
together (.rel.debug_info would have a link to .debug_info).
One could examine the relocations, split the .debug_info
data at relocation boundaries, emit byte streams (in hex)
as assembler output, and at each relocation point,
emit an assembler directive with a symbol name for the assembler.
Examining the relocations is awkward though. 
It is much better to use \f(CWdwarf_get_section_relocation_info() \fP
.P

The memory space of the section byte stream is freed
by the \f(CWdwarf_producer_finish_a() \fP call
(or would be if the \f(CWdwarf_producer_finish_a() \fP
was actually correct), along
with all the other space in use with that Dwarf_P_Debug.


.H 3 "dwarf_get_relocation_info_count()"
.DS
\f(CWint dwarf_get_relocation_info_count(
        Dwarf_P_Debug dbg,
        Dwarf_Unsigned *count_of_relocation_sections ,
	int            *drd_buffer_version,
        Dwarf_Error* error)\fP
.DE
The function \f(CWdwarf_get_relocation_info() \fP
returns, through  the pointer \f(CWcount_of_relocation_sections\fP, the
number of times that \f(CWdwarf_get_relocation_info() \fP
should be called.

The function \f(CWdwarf_get_relocation_info() \fP
returns DW_DLV_OK if the call was successful (the 
\f(CWcount_of_relocation_sections\fP is therefore meaningful,
though \f(CWcount_of_relocation_sections\fP
could be zero).

\f(CW*drd_buffer_version\fP
is the value 2.
If the structure pointed to by
the \f(CW*reldata_buffer\fP
changes this number will change.
The application should verify that the number is
the version it understands (that it matches
the value of DWARF_DRD_BUFFER_VERSION (from libdwarf.h)).
The value 1 version was never used in production 
MIPS libdwarf (version 1 did exist in source).

It returns DW_DLV_NO_ENTRY if 
\f(CWcount_of_relocation_sections\fP is not meaningful
because \f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP was not
passed to the
\f(CWdwarf_producer_init_c()\fP
\f(CWdwarf_producer_init_b()\fP or 
\f(CWdwarf_producer_init()\fP  call
(whichever one was used).

It returns DW_DLV_ERROR if there was an error,
in which case
\f(CWcount_of_relocation_sections\fP is not meaningful.

.H 3 "dwarf_get_relocation_info()"
.DS
\f(CWint dwarf_get_relocation_info(
        Dwarf_P_Debug dbg,
        Dwarf_Signed *elf_section_index, 
	Dwarf_Signed *elf_section_index_link, 
        Dwarf_Unsigned *relocation_buffer_count,
	Dwarf_Relocation_Data *reldata_buffer,
        Dwarf_Error* error)\fP
.DE

The function \f(CWdwarf_get_relocation_info() \fP 
should normally be called repetitively, 
for the number of relocation sections that 
\f(CWdwarf_get_relocation_info_count() \fP
indicated exist.

It returns \f(CWDW_DLV_OK\fP to indicate that 
valid values are returned through the pointer arguments.
The \f(CWerror\fP argument is not set.

It returns DW_DLV_NO_ENTRY if there are no entries
(the count of relocation arrays is zero.).
The \f(CWerror\fP argument is not set.

It returns \f(CWDW_DLV_ERROR\fP if there is an error.
Calling \f(CWdwarf_get_relocation_info() \fP
more than the number of times indicated by
\f(CWdwarf_get_relocation_info_count() \fP
(without an intervening call to
\f(CWdwarf_reset_section_bytes() \fP )
results in a return of \f(CWDW_DLV_ERROR\fP once past
the valid count.
The \f(CWerror\fP argument is set to indicate the error.

Now consider the returned-through-pointer values for
\f(CWDW_DLV_OK\fP .

\f(CW*elf_section_index\fP
is the 'elf section index' of the section implied by
this group of relocations.


\f(CW*elf_section_index_link\fP
is the section index of the section that these
relocations apply to.

\f(CW*relocation_buffer_count\fP
is the number of array entries of relocation information
in the array pointed to by
\f(CW*reldata_buffer\fP .


\f(CW*reldata_buffer\fP
points to an array of 'struct Dwarf_Relocation_Data_s'
structures.

The version 2 array information is as follows:

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

        Dwarf_Unsigned       drd_symbol_index;
};

.fi

The \f(CWDwarf_Rel_Type\fP enum is encoded (via casts if necessary)
into the single unsigned char \f(CWdrd_type\fP field to control
the space used for this information (keep the space to 1 byte).

The unsigned char \f(CWdrd_length\fP field
holds the size in bytes of the field to be relocated.
So for elf32 object formats with 32 bit apps, \f(CWdrd_length\fP
will be 4.  For objects with MIPS -64 contents,
\f(CWdrd_length\fP will be 8.  
For some dwarf 64 bit environments, such as ia64, \f(CWdrd_length\fP
is 4 for some relocations (file offsets, for example) 
and 8 for others (run time
addresses, for example).

If \f(CWdrd_type\fP is \f(CWdwarf_drt_none\fP, this is an unused slot
and it should be ignored.

If \f(CWdrd_type\fP is \f(CWdwarf_drt_data_reloc\fP 
this is an ordinary relocation.
The relocation type means either
(R_MIPS_64) or (R_MIPS_32) (or the like for
the particular ABI.
\f(CWdrd_length\fP gives the length of the field to be relocated.
\f(CWdrd_offset\fP
is an offset (of the
value to be relocated) in
the section this relocation stuff is linked to.
\f(CWdrd_symbol_index\fP
is the symbol index (if elf symbol
indices were provided) or the handle to arbitrary
information (if that is what the caller passed in 
to the relocation-creating dwarf calls) of the symbol
that the relocation is relative to.


When \f(CWdrd_type\fP is \f(CWdwarf_drt_first_of_length_pair\fP
the next data record will be \f(CWdrt_second_of_length_pair\fP
and the \f(CWdrd_offset\fP of the two data records will match.
The relevant 'offset' in the section this reloc applies to
should contain a symbolic pair like
.nf
.in +4
 .word    second_symbol - first_symbol
.in -4
.fi
to generate a length.
\f(CWdrd_length\fP gives the length of the field to be relocated.

\f(CWdrt_segment_rel\fP
means (R_MIPS_SCN_DISP)
is the real relocation (R_MIPS_SCN_DISP applies to
exception tables and this part may need further work).
\f(CWdrd_length\fP gives the length of the field to be relocated.

.P
The memory space of the section byte stream is freed
by the \f(CWdwarf_producer_finish_a() \fP call
(or would be if the \f(CWdwarf_producer_finish_a() \fP
was actually correct), along
with all the other space in use with that Dwarf_P_Debug.

.H 3 "dwarf_reset_section_bytes()"

.DS
\f(CWvoid dwarf_reset_section_bytes(
        Dwarf_P_Debug dbg
        )\fP
.DE
The function \f(CWdwarf_reset_section_bytes() \fP 
is used to reset the internal information so that
\f(CWdwarf_get_section_bytes_a() \fP will begin (on the next
call) at the initial dwarf section again.
It also resets so that calls to 
\f(CWdwarf_get_relocation_info() \fP
will begin again at the initial array of relocation information.

Some dwarf producers need to be able to run through
the \f(CWdwarf_get_section_bytes_a()\fP
and/or
the \f(CWdwarf_get_relocation_info()\fP
calls more than once and this call makes additional 
passes possible.
The set of Dwarf_Ptr values returned is identical to the
set returned by the first pass.
It is acceptable to call this before finishing a pass
of \f(CWdwarf_get_section_bytes_a()\fP
or
\f(CWdwarf_get_relocation_info()\fP
calls.
No errors are possible as this just resets some
internal pointers.
It is unwise to call this before
\f(CWdwarf_transform_to_disk_form() \fP has been called.
.P

.H 3 "dwarf_pro_get_string_stats()"
.DS
\f(CWint dwarf_pro_get_string_stats(

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

On error it returns \f(CWDW_DLV_BADADDR\fP (if there are no
markers it returns \f(CWDW_DLV_BADADDR\fP).

.H 2 "Attribute Creation"
The functions in this section add attributes to a \f(CWDIE\fP.
These functions return a \f(CWDwarf_P_Attribute\fP descriptor 
that represents the attribute added to the given \f(CWDIE\fP.  
In most cases the return value is only useful to determine if 
an error occurred.

Some of the attributes have values that are relocatable.  
They
need a symbol with respect to which the linker will perform
relocation.  
This symbol is specified by means of an index into
the Elf symbol table for the object
(of course, the symbol index can be more general than an index).

.H 3 "dwarf_add_AT_location_expr_a()"
.DS
\f(CWint dwarf_add_AT_location_expr_a(
        Dwarf_P_Debug dbg,
        Dwarf_P_Die ownerdie,
        Dwarf_Half attr,

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

is represented by the
\f(CWDwarf_P_Expr\fP descriptor
\f(CWloc_expr\fP.

If the expression has a 
\f(CWDW_OP_addr\fP
the code simply assumes that
\f(CWDW_OP_addr\fP
is
the first operation and
bases the only relocation
that can be created
on that assumption.

On error it returns 
\f(CWDW_DLV_ERROR\fP.

.H 3 "dwarf_add_AT_name_a()"
.DS
\f(CWint dwarf_add_AT_name_a(
        Dwarf_P_Die ownerdie, 

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

is only usable with
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP.

On success the function returns
\f(CWDW_DLV_OK\fP
\f(CWDwarf_P_Attribute\fP
and
\f(CWpc_value\fP
is put into the section stream output and
the 
\f(CWsym_index\fP is applied to the relocation
information.

On failure it returns
\f(CWDW_DLV_ERROR\fP.

Do not use this function for attr 
\f(CWDW_AT_high_pc\fP
if the value to be recorded is an offset (not a pc)
[ use 
\f(CWdwarf_add_AT_unsigned_const_afP

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

        Dwarf_Unsigned pc_value,
        Dwarf_Unsigned sym_index,
        Dwarf_P_Attribute *attr_out,
        Dwarf_Error *error) \fP
.DE
This is very similar to 
\f(CWdwarf_add_AT_targ_address_b\fP
but results in a different FORM (results in DW_FORM_data4
or DW_FORM_data8).

Useful for adding relocatable addresses in location lists.

\f(CWsym_index\fP is guaranteed to
be large enough that it can contain a pointer to
arbitrary data (so the caller can pass in a real elf
symbol index, an arbitrary number, or a pointer
to arbitrary data).
The ability to pass in a pointer through 
\f(CWsym_index\fP
is only usable with
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP.

On success it returns 
\f(CWDW_DLV_OK\fP
and
the 
\f(CWpc_value\fP
is put into the section stream output and
the 
\f(CWsym_index\fP is applied to the relocation
information.

Do not use this function for 
\f(CWDW_AT_high_pc\fP, use
\f(CWdwarf_add_AT_unsigned_const\fP
or 
\f(CWdwarf_add_AT_any_value_uleb\fP
[ if the value to be recorded is
an offset of 
\f(CWDW_AT_low_pc\fP]

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

to arbitrary data).
The ability to pass in a pointer through \f(CWsym_index() \fP
is only usable with
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP.

On success the function returns
\f(CWDW_DLV_OK\fP and
\f(CWpc_value\fP
is put into the section stream output and
the 
\f(CWsym_index\fP is applied to the relocation
information.

On failure the function returns
\f(CWDW_DLV_ERROR\fP.

Do not use this function for 
\f(CWDW_AT_high_pc\fP.  

.H 3 "dwarf_add_AT_unsigned_const_a()"
.DS

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

\f(CWexpr\fP currently generated, i.e. after the addition of
\f(CWopcode\fP.

It returns
\f(CWDW_DLV_ERROR\fP on error.

The function 
\f(CWdwarf_add_expr_gen_a()\fP works for all opcodes except
those that have a target address as an operand.  This is because 
the function cannot
not set up a relocation record that is needed when target addresses are
involved.

.H 3 "dwarf_add_expr_addr_c()"
.DS
\f(CWint dwarf_add_expr_addr_c(
        Dwarf_P_Expr expr,
        Dwarf_Unsigned address,
        Dwarf_Unsigned sym_index,
        Dwarf_Unsigned *stream_length_out,
        Dwarf_Error *error)\fP

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

\f(CWexpr()\fP
to be empty.


.H 2 "Line Number Operations"
These are operations on the .debug_line section.  
They provide 
information about instructions in the program and the source 
lines the instruction come from.  
Typically, code is generated 
in contiguous blocks, which may then be relocated as contiguous 
blocks.  
To make the provision of relocation information more 
efficient, the information is recorded in such a manner that only
the address of the start of the block needs to be relocated.  
This is done by providing the address of the first instruction 
in a block using the function \f(CWdwarf_lne_set_address()\fP.  
Information about the instructions in the block are then added 
using the function \f(CWdwarf_add_line_entry_c()\fP, which specifies
offsets from the address of the first instruction.  
The end of 
a contiguous block is indicated by calling the function 
\f(CWdwarf_lne_end_sequence()\fP.
.P
Line number operations do not support

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

.DE

The function \f(CWdwarf_add_line_entry_c()\fP
adds an entry to the
section containing information about source lines.  
It specifies
in \f(CWcode_offset\fP, the address of this line.
The function subtracts \f(CWcode_offset\fP from the value given
as the address of a previous line call to compute an offset,
and the offset is what is recorded in the line instructions
so no relocation will be needed on the line instruction generated.
.P
The source file that gave rise
to the instruction is specified by \f(CWfile_index\fP, the source
line number is specified by \f(CWlineno\fP, and the source column 
number is specified by \f(CWcolumn_number\fP
(column numbers begin at 1)
(if the source column is unknown, specify 0).  
\f(CWfile_index\fP 
is the index of the source file in a list of source files which is 
built up using the function \f(CWdwarf_add_file_decl()\fP. 

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

.DE
The function 
\f(CWdwarf_lne_set_address_a()\fP sets the target address
at which a contiguous block of instructions begin.
Information about
the instructions in the block is added to .debug_line using calls to
\f(CWdwarfdwarf_add_line_entry_c()\fP
which specifies the offset of each
instruction in the block relative to the start of the block.  
This is
done so that a single relocation record can be used to obtain the final
target address of every instruction in the block.

The relocatable address of the start of the block of instructions is
specified by 
\f(CWoffs\fP.
The symbol used to relocate the address
is given by 
\f(CWsymidx\fP, which is normally the index of the symbol in the
Elf symbol table.

It returns 
\f(CWDW_DLV_OK\fP on success, and 
\f(CWDW_DLV_ERROR\fP on error.

.H 3 "dwarf_lne_end_sequence_a()"
.DS

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

.sp
.in +2
\f(CWbegin_address\fP
is the offset from the symbol specified by
\f(CWsymbol_index\fP .
\f(CWoffset_from_end_symbol\fP
is the offset from the symbol specified by
\f(CWend_symbol_index\fP.
\f(CWlength\fP is ignored.
This begin-end pair will be show up in the
relocation array returned by
\f(CWdwarf_get_relocation_info() \fP
as a
\f(CWdwarf_drt_first_of_length_pair\fP
and
\f(CWdwarf_drt_second_of_length_pair\fP
pair of relocation records.
The consuming application will turn that pair into
something conceptually identical to
.sp
.nf
.in +4
 .word end_symbol + offset_from_end - \\
   ( start_symbol + begin_address)
.in -4
.fi
.sp
The reason offsets are allowed on the begin and end symbols
is to allow the caller to re-use existing labels
when the labels are available
and the corresponding offset is known  
(economizing on the number of labels in use).
The  'offset_from_end - begin_address'
will actually be in the binary stream, not the relocation
record, so the app processing the relocation array
must read that stream value into (for example)
net_offset and actually emit something like
.sp
.nf
.in +4
 .word end_symbol - start_symbol + net_offset
.in -4
.fi
.sp
.in -2

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

If
\f(CWend_symbol_index\fP is zero
we must be given a length
(either
\f(CWDW_DLC_STREAM_RELOCATIONS\fP
or
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP
):
.sp
.in +2
The relocatable start address of the range is
specified by \f(CWbegin_address\fP, and the length of the address
range is specified by \f(CWlength\fP.  
The relocatable symbol to be
used to relocate the start of the address range is specified by
\f(CWsymbol_index\fP, which is normally
the index of the symbol in the Elf
symbol table.
The 
\f(CWoffset_from_end_symbol\fP
is ignored.
.in -2

The function returns
\f(CWDW_DLV_OK\fP

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

is specified by the given 
\f(CWfde\fP.  
If the MIPS/IRIX specific DW_AT_MIPS_fde attribute is not
needed  in .debug_info pass in 0 as the \f(CWdie\fP argument.

\f(CWcie\fP specifies the
index of the 
\f(CWCIE\fP that should be used to setup the initial
conditions for the given frame.  
\f(CWvirt_addr\fP represents the
relocatable address at which the code
for the given function begins,
and 
\f(CWsym_idx\fP gives the index of the relocatable symbol to
be used to relocate this address (\f(CWvirt_addr\fP that is).
\f(CWcode_len\fP specifies the 
size in bytes of the machine instructions
for the given function.

If \f(CWsym_idx_of_end\fP is zero 
(may  be 
\f(CWDW_DLC_STREAM_RELOCATIONS\fP 
or
\f(CWDW_DLC_SYMBOLIC_RELOCATIONS\fP 
):
.sp
.in +2
\f(CWvirt_addr\fP represents the
relocatable address at which the code for the given function begins,
and \f(CWsym_idx\fP gives the index of the relocatable symbol to
be used to relocate this address (\f(CWvirt_addr\fP that is).
\f(CWcode_len\fP 
specifies the size in bytes of the machine instructions
for the given function.
\f(CWsym_idx_of_end\fP
and
\f(CWoffset_from_end_sym\fP
are unused.
.in -2
.sp

libdwarf-code-0.11.1/doc/libdwarfp.mm  view on Meta::CPAN

.sp
.in +2
\f(CWvirt_addr\fP
is the offset from the symbol specified by
\f(CWsym_idx\fP .
\f(CWoffset_from_end_sym\fP
is the offset from the symbol specified by
\f(CWsym_idx_of_end\fP.
\f(CWcode_len\fP is ignored.
This begin-end pair will be show up in the
relocation array returned by
\f(CWdwarf_get_relocation_info() \fP
as a
\f(CWdwarf_drt_first_of_length_pair\fP
and
\f(CWdwarf_drt_second_of_length_pair\fP
pair of relocation records.
The consuming application will turn that pair into
something conceptually identical to
.sp
.nf
.in +4
 .word end_symbol + begin - \\
   ( start_symbol + offset_from_end)
.in -4
.fi
.sp
The reason offsets are allowed on the begin and end symbols
is to allow the caller to re-use existing labels
when the labels are available
and the corresponding offset is known
(economizing on the number of labels in use).
The  'offset_from_end - begin_address'
will actually be in the binary stream, not the relocation
record, so the app processing the relocation array
must read that stream value into (for example)
net_offset and actually emit something like
.sp
.nf
.in +4
 .word end_symbol - start_symbol + net_offset
.in -4
.fi
.sp
.in -2

libdwarf-code-0.11.1/doc/mips_extensions.mm  view on Meta::CPAN

comes first.
.H 1 "MIPS attributes"
.H 2 "DW_AT_MIPS_fde"
This extension to Dwarf appears only on subprogram TAGs and has as
its value the offset, in the .debug_frame section, of the fde which
describes the frame of this function.  It is an optimization of
sorts to have this present.

.H 2 "DW_CFA_MIPS_advance_loc8 0x1d"
This obvious extension to dwarf line tables enables encoding of 8 byte
advance_loc values (for cases when such must be relocatable, 
and thus must be full length).  Applicable only to 64-bit objects.

.H 2 "DW_TAG_MIPS_loop        0x4081"
For future use. Not currently emitted.
Places to be emitted and attributes that this might own
not finalized.

.H 2 "DW_AT_MIPS_loop_begin   0x2002"
For future use. Not currently emitted.
Attribute form and content not finalized.

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2008  view on Meta::CPAN

      * print_die.c: Add to dwarf_formstring failure message.
      * README: Correct email: the old sgi.com address is no
        longer correct.
2008-06-13 David Anderson <davea42@earthlink.net>
      * dwconf.c: Fix an off-by-one condition where
        we could index off the end of the cf_regs array in printing
        a register name.
2008-04-12 David Anderson <davea42@earthlink.net>
      * print_reloc.c:  Verify stringtab exists and is
        large enough before indexing into it to get a string
        in printing relocations.
        (Providing default name "<no name>" so it's evident from
        the output that we used a default name string).
2008-04-09 David Anderson <davea42@earthlink.net>
      * print_sections.c (get_fde_proc_name): Initialize some
        local variables at declaration.  The function is very slow
        and needs a replacement.
      * print_die.c:  Fixes a typo in a comment.
      * dwarfdump.c: Added -n option to suppress function name search
        when printing FDEs. Current dwarfdump is n-squared at least
        getting those names, this is a bandage-type-workaround when

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2011  view on Meta::CPAN

       the print_infos() prototype.
     * print_die.c: Refactor the debuginfo/types prints for
       better reporting of errors.  Remove an 'error' report
       about DW_DLE_REF_SIG8_NOT_HANDLED.  It's unclear
       what we might want to do here in future, but an error
       report is misleading.
2011-10-29  DavidAnderson <davea42@earthlink.net>
     * dwarfdump.c, common.c: Update version strings.
2011-10-29  DavidAnderson <davea42@earthlink.net>
     * dwarfdump.c: Reset the CU hints at each new section.
       Set up reloc flags so debug_types gets relocated if necessary.
     * globals.h: Add DEBUG_TYPES for the .debug_types section.
       Add a type-unit signature pretty-printer function.
       Add DW_SECTION_REL_DEBUG_TYPES so debug_types can be relocated.
     * print_reloc.c: Add entries so debug_types can get relocated.
     * print_die.c: Now we handle both debug_info and debug_types
       sections.  Moved some CU header print operations to little
       helper functions to clarify the code. Refactored print_infos()
       to deal with debug_types and debug_info.
       Using the new libdwarf functions that allow debug_types.
     * print_lines.c: Delete unused local variable and its setting code.
2011-10-26  DavidAnderson <davea42@earthlink.net>
     * Makefile.in, README: Added Make settings of PREINCS POSTINCS
       PRELIBS, POSTLIBS to simplify building when libdwarf or libelf
       are not in the normal locations.   Documented usable ways to

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2011  view on Meta::CPAN

       looking for bad references. Added a 'verbose' argument a few places
       so (at a critical point) show_form_itself won't add a form
       string when we really don't want it to.
     * print_static_funcs.c:  Fixed an error string so it says
       static funcs, not pubnames.
     * print_lines.c: Ensure we only check for errors when
       we request such checking.
     * print_reloc.c: Ensure we don't index off the end of scn_names.
       Deal with missing names and bad symbol indexes consistently.
       When working with a .rela, report name as the section name
       instead of calling it .rel in the relocations output.
2011-10-05  DavidAnderson <davea42@earthlink.net>
     * dwarfdump.c: Increased COMPILER_TABLE_MAX for better reporting.
       Provide a 'HARMLESS ERROR' title in output if there are any such.
       One issue is (for relocatable objects) libdwarf attempts to continue
       even if relocations fail, and a relocation failure is now
       counted as a harmless error (even if it turns out to be harmful!).
       When sorting compilers_detected, use the producer name to sort
       when error counts are identical.  If the compiler table fills up,
       print a note. With -ka, no longer explicitly turn check_frames_extended
       off, it is off already unless the user turned it on explicitly with
       -kxe.
     * print_die.c: The check for a file number (decl_file) was simply wrong.
       Made some detail changes to reporting.
     * print_frames.c: Added comments about the inefficiency for getting
       function names when printing frames (dwarfdump2 does not suffer

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2012  view on Meta::CPAN

     * print_frames.c: Consistent layout for if statements.
     * print_lines.c: Consistent layout for if statements.
       Implement the ability to print line information
       with no offset values (useful when comparisons are
       required, as the pc values can change
       but the basic line information remains the same).
       Minor layout changes.
     * print_locs.c: Consistent layout for if statements.
     * print_ranges.c: Consistent layout for if and for statements.
     * print_reloc.c: Consistent layout for if statements.
       Move names for relocation types to individual
       header files based on architecture (ARM, MIPS, PPC,
       PPC64, X86_64).
       Fix incorrect layout for 'set_relocation_table_names' function.
       Use condition compilation symbols (DWARF_RELOC_MIPS,
       DWARF_RELOC_PPC, DWARF_RELOC_PPC64, DWARF_RELOC_ARM,
       DWARF_RELOC_X86_64)in the function
       'set_relocation_table_names' to get relocation
       table information.
       Add support for X86_64 architecture.
     * print_reloc.h: Move definitions for relocation types
       to individual header files based on architecture
       (ARM, MIPS, PPC, PPC64, X86_64).
     * print_strings.c: Consistent layout for if statements.
     * strstrnocase.c: Consistent layout for if and for statements.
     * tag_attr.c: Consistent layout for if and for statements.
     * tag_attr.list: Add some missing attributes and
       the complete set for DW_TAG_rvalue_reference_type;
       remove a duplicated DW_AT_name.
     * tag_common.c: Consistent layout for if statements.
     * tag_tree.c: Consistent layout for if and for statements.

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2015  view on Meta::CPAN

     * dwarfdump.c, common.c: Update version string.
     * print_lines.c: Added local variables for clarity
       in a call, changed the dwarf_srclines_dealloc() location
       to fully clean up after a two-level line table srcfiles call.
2015-09-26  David Anderson
     * dwarfdump.c, common.c: Update version string.
2015-09-24  David Anderson
     * dwarfdump.c, common.c: Update version string.
     * print_lines.c: IA in line header hint is
       really spelled IS. Fixed now.
     * dwarf_elf_access.c: Added R_IA64* and R_390 relocation ifdefs
       for cases where they are not in a test machines elf.h or the like.
2015-09-23  David Anderson
     * print_lines.c: Removed accidental newline from output.
2015-09-22  David Anderson
     * print_die.c: Removed trailing whitespace and fixed indentation mistake.
     * print_lines.c: Fixed indentation and  inconsistencies
       in spelling line table field hints.
       Leaving IA as has been for a long time
       though it should be spelled IS.
2015-09-19  David Anderson

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2017  view on Meta::CPAN

    * common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
      version string.
2017-05-28 David Anderson
    * common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
      version string.
2017-05-28 David Anderson
    * macrocheck.c: Trivial revision of main() declaration
      to our standard format.
    * print_reloc.c: We were reading one-past the end
      of symtab entries(now fixed).
      Now relocation sections show the Elf section index
      and we print them in order as in the object file
      (earlier it printed in a fixed order not related to
      the object file).
      Deleted the rel/rela section name arrays,
      we already have the section name at hand.
2017-05-27 David Anderson
    * esb.c: For selftest now indents report lines
      to make it easier to see the overview pass/fail.
    * Makefile.in,macrocheck.c,print_reloc.c: Makes macrocheck
      self test results clearer (pass/fail) and adds a check
      on the array of relocation section data in print_reloc.c.
2017-05-26 David Anderson
    * section_bitmaps.h,section_bitmaps.c: Added comments.
2017-05-25 David Anderson
    * common.c,tag_attr.c,tag_tree.c: Update version string.
    * dwarfdump.c: Update version string.
      Instead of using bitmaps for printing sections and relocations
      use char arrays instead. Faster, easier to read, and much
      easier to expand to the longer lists of sections.
      By using fixed size arrays for this the compiler can check
      for simple errors.
    * print_reloc.c: Moved #defines over to section_bitmap.h
      Arrays are now fixed size to give compiler the ability to
      notice simple coding errors.  Added the new DWARF5 sections
      to lists of what is to print. We do not use zero as a section
      number so we add an unused zero element to each array.
    * print_reloc.h: Made idempotent with ifndef.

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2018  view on Meta::CPAN

    * New files: command_options.c,command_options.h
      Command line arguments processing; the original code moved
      from dwarfdump.c.
    * New files: producer_info.c,producer_info.h
      Record statistics about the producers (compilers). The original
      code moved from dwarfdump.c.
    * glflags.c,glflags.h,globals.h:
      Moved the remaining individual global flags and what they
      control into glflags.h.
    * section_bitmaps.c,section_bitmaps.h: process the header and
      relocation maps. Original code moved from dwarfdump.c
    * dwarfdump.c:
      Moved the code for command line arguments processing to
      command_options.c and producer_info.c.
    * print_reloc.c,sanitized.h,defined_types.h,dwconf.c,print_aranges.c
      Minor changes due to refactoring of the command line and
      producer refactoring.
2018-05-09 David Anderson
    * common.c,dwarfdump.c,glflags.c,glflags.h,print_aranges.c,
      print_die.c: Fixed indents to match dicheck requirements
      and removed some trailing whitespace.

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2019  view on Meta::CPAN

       builds.
     * globals.h: Adding a comment.
     * tag_attr.list, tag_attr_ext.list,tag_tree.list,
       tag_tree_ext.list: Adding blank lines judiciously
       makes the table easier for humans to read.
2019-05-14 David Anderson
     * command_options.c: Removed unneeded trailing ','
       in initializer as it caused a warning in compile.
2019-05-14 David Anderson
     * print_reloc_test.c: Without libelf (in which case
       dwarfdump is not interested in printing relocations)
       we now compile a main program returning 0 (success).
       With libelf we examine the relocation name tables
       as usual to exit with success or failure.
2019-05-07 David Anderson
     * CMakeLists.txt: Now the code from configure.cmake
       is here. Previously there were two includes of
       configure.cmake, which was a mistake.
     * Makefile.am: Added the *_test.c so tar distributions
       can run 'make check'.
     * scripts/buildandreleasetest.sh: Now adds in cmake
       build of dwarfgen and dwarfexample and test
       so those are tested.

libdwarf-code-0.11.1/src/bin/dwarfdump/ChangeLog2019  view on Meta::CPAN

       inttypes.h so we can avoid some conversion warnings
       from printf calls.
     * dwarf_alloc.c:  Add ifdef-d stdint.h and
       inttypes.h so we can avoid some conversion warnings
       from printf calls.
2019-04-19 David Anderson
     * Apology. This enhances pubnames-like printing
       and uses non-libelf elf access as much as possible
       (even if libelf present). With --disable-libelf
       it allows all but printing Elf section headers
       and relocation records.  It's excessively large
       for one commit(mainly in libdwarf). Sorry.
     * command_options.c: Conditionalize the help message
       so the Elf section printing is not shown if
       --disable-libelf chosen at configure time.
     * dwarfdump.1: Mention that --disable-libelf removes
       certain elf section header printing options.
     * dwarfdump.c: Implements the elf reading changes.
     * print_strings.c: Fixed a printf to use sanitized()
       so we don't print non-ascii (we use uri form instead).
2019-03-08 David Anderson

libdwarf-code-0.11.1/src/bin/dwarfdump/NEWS  view on Meta::CPAN

  for everyone.
January 08, 2015
  dwarfdump does new checking. See options -kD -kG -ku -kuf.
  In addition, dwarfdump output can be written to a file without
  using redirection by using the new  -O file=<path>
  option.
January 29, 2014
  Now using dwarf_tsearch() so tsearch is available on every platform.
November 17, 2012
  Added new checking options.
  To get good relocation-handling dwarfdump now expects to read
  headers from libdwarf with the relocation numbers. That means
  building dwarfdump separate from the libdwarf source is no
  longer as useful as it was.  It is best to build libdwarf
  and dwarfdump together for decent handling of relocatable
  objects.
December 13, 2011
  Now prints missing line table column number as 0 (now
  matching the DWARF spec), the previous
  practice of printing -1 was always wrong.
  And prints the DWARF3/4 new line table fields (when present).
October 29, 2011
  Added support for printing .debug_types (type unit) data.
October 26, 2011
  Added new features to Makefile.in and documented in README

libdwarf-code-0.11.1/src/bin/dwarfdump/NEWS  view on Meta::CPAN

  to print such an object.
  The line section print now prints a CU-DIE offset for each such DIEs
  line information.   This makes it much easier to correctly associate
  -l (or -v -l) output with -v -v -l when debugging a faulty
  linetable in an executable.
  With -v -v -l (two -v) the output of line info continues to be a
  completely different format than zero or one -v, the two-v
  form showing the detailed line table opcodes.
  With g++ 3.3.3 one sees bad line addresses at times as the
  DW_LNE_set_address address for header files do not always
  get their relocations applied.  I am told this is fixed in 3.4.x.


Mar 18, 2005
  In correcting printing of macro information the format
  of the macro (-m) output has changed substantially.
  Much more complete now.  Still could use enhancement.

Oct 28, 2004
  Updated contact address in copyright: SGI moved 1/4 mile
  to a new address: 1500 Crittenden Lane.

libdwarf-code-0.11.1/src/bin/dwarfdump/dd_command_options.c  view on Meta::CPAN

"-tv  --print-static-var  Print static var section",
"-s   --print-strings     Print raw .debug_str section",
"     --print-str-offsets Print raw .debug_str_offsets section",
"-y   --print-type        Print pubtypes section",
"-w   --print-weakname    Print weakname section",
" ",
"-------------------------------------------------------------------",
"Print Elf Relocation Data",
"-------------------------------------------------------------------",
"  libelf not present, use GNU readelf or readelfobj",
"  to see relocations",
" ",
"-------------------------------------------------------------------",
"Print Elf Section Headers",
"-------------------------------------------------------------------",
"  libelf not present, use GNU readelf or readelfobj",
"  to see elf file details",
" ",
"-------------------------------------------------------------------",
"Check DWARF Integrity",
"-------------------------------------------------------------------",

libdwarf-code-0.11.1/src/bin/dwarfdump/dd_glflags.h  view on Meta::CPAN

    Dwarf_Bool gf_line_flag;
    Dwarf_Bool gf_no_follow_debuglink;
    Dwarf_Bool gf_line_print_pc;
    Dwarf_Bool gf_line_skeleton_flag;
    Dwarf_Bool gf_loc_flag;
    Dwarf_Bool gf_macinfo_flag; /* DWARF2,3,4. Old macro section*/
    Dwarf_Bool gf_macro_flag; /* DWARF5 */
    Dwarf_Bool gf_pubnames_flag;
    Dwarf_Bool gf_debug_addr_flag;
    Dwarf_Bool gf_ranges_flag; /* .debug_ranges section. */
    Dwarf_Bool gf_reloc_flag;  /* Elf relocations, not DWARF. */
    Dwarf_Bool gf_static_func_flag;/* SGI only */
    Dwarf_Bool gf_static_var_flag; /* SGI only */
    Dwarf_Bool gf_string_flag;
    Dwarf_Bool gf_pubtypes_flag;   /* SGI only */
    Dwarf_Bool gf_types_flag; /* .debug_types, not all CU types */
    Dwarf_Bool gf_weakname_flag;   /* SGI only */

    Dwarf_Bool gf_print_utf8_flag;

    Dwarf_Bool gf_header_flag; /* Control printing of Elf header. */

libdwarf-code-0.11.1/src/bin/dwarfdump/dd_glflags.h  view on Meta::CPAN

#define dump_ranges_info    glflags.nTrace[KIND_RANGES_INFO]
#define dump_linkonce_info  glflags.nTrace[KIND_LINKONCE_INFO]
#define dump_visited_info   glflags.nTrace[KIND_VISITED_INFO]

/*  Section IDs. See also libdwarfp/pro_opaque.h DEBUG_INFO etc
    as we arbitrarily use the same numbering here.
    In pro_opaque the numbering matters.
    Here it helps us record where we are at any instant.
    It's not necessary they match but seems good to do.
    Here we have some extra sections not related to
    relocations so we just add those beginning with 22 */
#define         DEBUG_INFO      0
#define         DEBUG_LINE      1
#define         DEBUG_ABBREV    2
#define         DEBUG_FRAME     3
#define         DEBUG_ARANGES   4
#define         DEBUG_PUBNAMES  5
#define         DEBUG_FUNCNAMES 6
#define         DEBUG_TYPENAMES 7
#define         DEBUG_VARNAMES  8
#define         DEBUG_WEAKNAMES 9

libdwarf-code-0.11.1/src/bin/dwarfexample/jitreader.c  view on Meta::CPAN

}

const Dwarf_Obj_Access_Methods_a methods = {
    gsinfo,
    gborder,
    glensize,
    gptrsize,
    gfilesize,
    gseccount,
    gloadsec,
    0 /* no relocating anything */
    };
struct Dwarf_Obj_Access_Interface_a_s dw_interface =
{ &base_internals,&methods };

static const Dwarf_Sig8 zerosignature;
static int
isformstring(Dwarf_Half form)
{
    /*  Not handling every form string, just the
        ones used in simple cases. */

libdwarf-code-0.11.1/src/bin/dwarfgen/ChangeLog2016  view on Meta::CPAN

     * configure: Regenerated.
2016-09-21  David Anderson
     * Makefile.in: implement sanitize support.
     * configure.in: Add support for --enable-sanitize
     * configure: Regenerated.
2016-08-28  David Anderson
     * dwarfgen.cc: Now calls dwarf_pro_get_string_stats()
       and prints the string counts information.
2016-08-25  David Anderson
     * dwarfgen.cc: Clarified and expanded the debug output of dwarfgen
       about relocations (and added the -r option to expand
       the output further).
     * irepresentation.h: Added comments explaining the intent
       of two small classes.
2016-08-23  David Anderson
     * dwarfgen.cc: Added the -s option which has .debug_info strings
       generated into .debug_str.
2016-06-01  David Anderson
     * Makefile.in: Tweaked for debian build compatibility
2016-04-21  Carlos Alberto Enciso
     * Use the _WIN32 macro to identify a WINDOWS specific code.

libdwarf-code-0.11.1/src/bin/dwarfgen/ChangeLog2018  view on Meta::CPAN

    * irepdie.h, irepform.h: Mark arguments
      UNUSEDARG where appropriate.
    * ireptodbg.cc:Fixed reinterpret casts to be
      the correct type, fixing signed/unsigned
      comparison warnings.  Removed some unused
      local variables. Fixed a couple declarations
      to avoid signed/unsigned comparison warnings.
      #define UNUSEDARG appropriately
      Mark arguments UNUSEDARG where appropriate.
2018-07-22 David Anderson
    * dwarfgen.cc: The relocations processing was assuming
      alignment of 32bit and 64bit values. Now no longer
      makes that incorrect assumption.
2018-07-16 David Anderson
    * createirepformfrombinary.cc: Refines ifdef of HAVE_STDAFX_H
    * createirepfrombinary.cc: Refines ifdef of HAVE_STDAFX_H
      Delete unused local variable.
    * dwarfgen.cc: Refines ifdef of HAVE_STDAFX_H.
      Changes certain function_argument names to avoid
      shadowing a global. For example, elf -> elf_w
    * general.h: Remove pointless trailing ; ending IToHex()

libdwarf-code-0.11.1/src/bin/dwarfgen/README  view on Meta::CPAN

of how one uses libdwarf to generate DWARF.
In addition, it should be useful as a test vehicle for
evaluating future changes to the DWARF standard.

It is necessary as a test-vehicle so that the libdwarf
producer code can be updated to allow more recent features
of DWARF to be supported while trying to guarantee current
producer code users are correctly supported.

By default dwarfgen produces a fake a.out. By that we mean
that no relocation sections are written.  Instead, relocations
are processed directly by dwarfgen.
Perhaps at some point a more a.out-like output will be optionally
supported.

In its 2018 form the code calling producer functions
leaks memory as the return values usually need to be
dealloc'd, but only after the code is generated.
An example from -fsanitize=
is
Direct leak of 2688 byte(s) in 28 object(s) allocated from:



( run in 1.203 second using v1.01-cache-2.11-cpan-5511b514fd6 )