1 .\" Copyright (c) 2011 Kai Wang
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $Id: dwarf_new_die.3 3644 2018-10-15 19:55:01Z jkoshy $
32 .Nd allocate a new debugging information entry
39 .Fa "Dwarf_P_Debug dbg"
41 .Fa "Dwarf_P_Die parent"
42 .Fa "Dwarf_P_Die child"
43 .Fa "Dwarf_P_Die left"
44 .Fa "Dwarf_P_Die right"
45 .Fa "Dwarf_Error *err"
50 allocates a new DWARF debugging information entry and links it
51 to another debugging information entry.
55 should reference a DWARF producer instance allocated using
56 .Xr dwarf_producer_init 3
58 .Xr dwarf_producer_init_b 3 .
62 should specify the tag of the newly created debugging information entry.
63 Valid values for this argument are those for the
70 specifies the parent link of the debugging information entry.
74 specifies the first child link of the debugging information entry.
78 specifies the left sibling link of the debugging information entry.
82 specifies the right sibling link of the debugging information entry.
90 is allowed to be non-NULL.
91 Application code can subsequently call the function
93 to change the links for the created debugging information entry.
97 is not NULL, it will be used to store error information in case
102 returns the newly created debugging information entry.
103 In case of an error, function
107 and sets the argument
110 To create debugging information entries and add them to the producer
112 .Bd -literal -offset indent
114 Dwarf_P_Die die1, die2;
117 /* ... assume dbg refers to a DWARF producer instance ... */
119 die1 = dwarf_new_die(dbg, DW_TAG_compilation_unit, NULL, NULL, NULL,
122 warnx("dwarf_new_die failed: %s", dwarf_errmsg(-1));
126 die2 = dwarf_new_die(dbg, DW_TAG_base_type, die1, NULL, NULL,
129 warnx("dwarf_new_die failed: %s", dwarf_errmsg(-1));
133 if (dwarf_add_die_to_debug(dbg, die1, &de) != DW_DLV_OK) {
134 warnx("dwarf_add_die_to_debug failed: %s", dwarf_errmsg(-1));
142 .Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
143 .It Bq Er DW_DLE_ARGUMENT
147 .It Bq Er DW_DLE_ARGUMENT
148 More than one of the arguments
155 .It Bq Er DW_DLE_MEMORY
156 An out of memory condition was encountered during the execution of the
161 .Xr dwarf_add_die_to_debug 3 ,
162 .Xr dwarf_die_link 3 ,
163 .Xr dwarf_producer_init 3 ,
164 .Xr dwarf_producer_init_b 3