1 .\" $NetBSD: dwarf_init.3,v 1.2 2014/03/09 16:58:04 christos Exp $
3 .\" Copyright (c) 2009 Joseph Koshy. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" This software is provided by Joseph Koshy ``as is'' and
15 .\" any express or implied warranties, including, but not limited to, the
16 .\" implied warranties of merchantability and fitness for a particular purpose
17 .\" are disclaimed. in no event shall Joseph Koshy be liable
18 .\" for any direct, indirect, incidental, special, exemplary, or consequential
19 .\" damages (including, but not limited to, procurement of substitute goods
20 .\" or services; loss of use, data, or profits; or business interruption)
21 .\" however caused and on any theory of liability, whether in contract, strict
22 .\" liability, or tort (including negligence or otherwise) arising in any way
23 .\" out of the use of this software, even if advised of the possibility of
26 .\" Id: dwarf_init.3 2122 2011-11-09 15:35:14Z jkoshy
34 .Nd allocate a DWARF debug descriptor
43 .Fa "Dwarf_Handler errhand"
44 .Fa "Dwarf_Ptr errarg"
45 .Fa "Dwarf_Debug *ret"
46 .Fa "Dwarf_Error *err"
52 .Fa "Dwarf_Handler errhand"
53 .Fa "Dwarf_Ptr errarg"
54 .Fa "Dwarf_Debug *ret"
55 .Fa "Dwarf_Error *err"
58 These functions allocate and return a
60 instance for the object denoted by argument
64 This instance would be used for subsequent access to debugging information in the object by other functions in the DWARF(3) library.
70 denotes an open file descriptor referencing a compilation object.
73 implicitly allocates an
75 descriptor for argument
82 denotes a descriptor returned by
89 specifies the access mode desired.
90 It should be at least as permissive as the mode with which
96 Legal values for argument
100 .Bl -tag -width "DW_DLC_WRITE" -compact
102 Permit reading and writing of DWARF information.
104 Operate in read-only mode.
106 Permit writing of DWARF information.
111 denotes a function to be called in case of an error.
114 then a default error handling scheme is used.
117 for a description of the error handling scheme used by the
122 is passed to the error handler function denoted by argument
128 points to the memory location that will hold a
130 reference on a successful call these functions.
134 references a memory location that would hold a
136 descriptor in case of an error.
137 .Ss Memory Management
140 instance returned by these functions should be freed using
143 These functions return the following values:
144 .Bl -tag -width ".Bq Er DW_DLV_NO_ENTRY"
146 This return value indicates a successful return.
147 .It Bq Er DW_DLV_ERROR
148 The operation failed.
149 .It Bq Er DW_DLV_NO_ENTRY
150 The object specified by arguments
154 did not contain debug information.
156 .Sh IMPLEMENTATION NOTES
157 The current implementation does not support access modes
164 instance from a open file descriptor referencing an ELF object, and
165 with the default error handler, use:
166 .Bd -literal -offset indent
170 if (dwarf_init(fd, DW_DLC_READ, NULL, NULL, &dbg, &err) !=
172 errx(EXIT_FAILURE, "dwarf_init: %s", dwarf_errmsg(err));
178 .Xr dwarf_get_elf 3 ,