1 .\" Copyright (c) 2009 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" This software is provided by Joseph Koshy ``as is'' and
13 .\" any express or implied warranties, including, but not limited to, the
14 .\" implied warranties of merchantability and fitness for a particular purpose
15 .\" are disclaimed. in no event shall Joseph Koshy be liable
16 .\" for any direct, indirect, incidental, special, exemplary, or consequential
17 .\" damages (including, but not limited to, procurement of substitute goods
18 .\" or services; loss of use, data, or profits; or business interruption)
19 .\" however caused and on any theory of liability, whether in contract, strict
20 .\" liability, or tort (including negligence or otherwise) arising in any way
21 .\" out of the use of this software, even if advised of the possibility of
24 .\" $Id: dwarf_init.3 2122 2011-11-09 15:35:14Z jkoshy $
32 .Nd allocate a DWARF debug descriptor
41 .Fa "Dwarf_Handler errhand"
42 .Fa "Dwarf_Ptr errarg"
43 .Fa "Dwarf_Debug *ret"
44 .Fa "Dwarf_Error *err"
50 .Fa "Dwarf_Handler errhand"
51 .Fa "Dwarf_Ptr errarg"
52 .Fa "Dwarf_Debug *ret"
53 .Fa "Dwarf_Error *err"
56 These functions allocate and return a
58 instance for the object denoted by argument
62 This instance would be used for subsequent access to debugging information in the object by other functions in the DWARF(3) library.
68 denotes an open file descriptor referencing a compilation object.
71 implicitly allocates an
73 descriptor for argument
80 denotes a descriptor returned by
87 specifies the access mode desired.
88 It should be at least as permissive as the mode with which
94 Legal values for argument
98 .Bl -tag -width "DW_DLC_WRITE" -compact
100 Permit reading and writing of DWARF information.
102 Operate in read-only mode.
104 Permit writing of DWARF information.
109 denotes a function to be called in case of an error.
112 then a default error handling scheme is used.
115 for a description of the error handling scheme used by the
120 is passed to the error handler function denoted by argument
126 points to the memory location that will hold a
128 reference on a successful call these functions.
132 references a memory location that would hold a
134 descriptor in case of an error.
135 .Ss Memory Management
138 instance returned by these functions should be freed using
141 These functions return the following values:
142 .Bl -tag -width ".Bq Er DW_DLV_NO_ENTRY"
144 This return value indicates a successful return.
145 .It Bq Er DW_DLV_ERROR
146 The operation failed.
147 .It Bq Er DW_DLV_NO_ENTRY
148 The object specified by arguments
152 did not contain debug information.
154 .Sh IMPLEMENTATION NOTES
155 The current implementation does not support access modes
162 instance from a open file descriptor referencing an ELF object, and
163 with the default error handler, use:
164 .Bd -literal -offset indent
168 if (dwarf_init(fd, DW_DLC_READ, NULL, NULL, &dbg, &err) !=
170 errx(EXIT_FAILURE, "dwarf_init: %s", dwarf_errmsg(err));
176 .Xr dwarf_get_elf 3 ,