xref: /minix3/external/bsd/elftoolchain/dist/libdwarf/dwarf_get_elf.3 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\"	$NetBSD: dwarf_get_elf.3,v 1.2 2014/03/09 16:58:04 christos Exp $
2*0a6a1f1dSLionel Sambuc.\"
3*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2009 Joseph Koshy.  All rights reserved.
4*0a6a1f1dSLionel Sambuc.\"
5*0a6a1f1dSLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
6*0a6a1f1dSLionel Sambuc.\" modification, are permitted provided that the following conditions
7*0a6a1f1dSLionel Sambuc.\" are met:
8*0a6a1f1dSLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
9*0a6a1f1dSLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
10*0a6a1f1dSLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
11*0a6a1f1dSLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
12*0a6a1f1dSLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
13*0a6a1f1dSLionel Sambuc.\"
14*0a6a1f1dSLionel Sambuc.\" This software is provided by Joseph Koshy ``as is'' and
15*0a6a1f1dSLionel Sambuc.\" any express or implied warranties, including, but not limited to, the
16*0a6a1f1dSLionel Sambuc.\" implied warranties of merchantability and fitness for a particular purpose
17*0a6a1f1dSLionel Sambuc.\" are disclaimed.  in no event shall Joseph Koshy be liable
18*0a6a1f1dSLionel Sambuc.\" for any direct, indirect, incidental, special, exemplary, or consequential
19*0a6a1f1dSLionel Sambuc.\" damages (including, but not limited to, procurement of substitute goods
20*0a6a1f1dSLionel Sambuc.\" or services; loss of use, data, or profits; or business interruption)
21*0a6a1f1dSLionel Sambuc.\" however caused and on any theory of liability, whether in contract, strict
22*0a6a1f1dSLionel Sambuc.\" liability, or tort (including negligence or otherwise) arising in any way
23*0a6a1f1dSLionel Sambuc.\" out of the use of this software, even if advised of the possibility of
24*0a6a1f1dSLionel Sambuc.\" such damage.
25*0a6a1f1dSLionel Sambuc.\"
26*0a6a1f1dSLionel Sambuc.\" Id: dwarf_get_elf.3 2122 2011-11-09 15:35:14Z jkoshy
27*0a6a1f1dSLionel Sambuc.\"
28*0a6a1f1dSLionel Sambuc.Dd November 9, 2011
29*0a6a1f1dSLionel Sambuc.Os
30*0a6a1f1dSLionel Sambuc.Dt DWARF_GET_ELF 3
31*0a6a1f1dSLionel Sambuc.Sh NAME
32*0a6a1f1dSLionel Sambuc.Nm dwarf_get_elf
33*0a6a1f1dSLionel Sambuc.Nd retrieve the
34*0a6a1f1dSLionel Sambuc.Vt Elf
35*0a6a1f1dSLionel Sambucdescriptor associated with a
36*0a6a1f1dSLionel Sambuc.Vt Dwarf_Debug
37*0a6a1f1dSLionel Sambucinstance
38*0a6a1f1dSLionel Sambuc.Sh LIBRARY
39*0a6a1f1dSLionel Sambuc.Lb libdwarf
40*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS
41*0a6a1f1dSLionel Sambuc.In libdwarf.h
42*0a6a1f1dSLionel Sambuc.Ft int
43*0a6a1f1dSLionel Sambuc.Fo dwarf_get_elf
44*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Debug dbg"
45*0a6a1f1dSLionel Sambuc.Fa "Elf **elf"
46*0a6a1f1dSLionel Sambuc.Fa "Dwarf_Error *err"
47*0a6a1f1dSLionel Sambuc.Fc
48*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION
49*0a6a1f1dSLionel SambucFunction
50*0a6a1f1dSLionel Sambuc.Fn dwarf_get_elf
51*0a6a1f1dSLionel Sambucreturns the
52*0a6a1f1dSLionel Sambuc.Vt Elf
53*0a6a1f1dSLionel Sambucdescriptor associated with a
54*0a6a1f1dSLionel Sambuc.Vt Dwarf_Debug
55*0a6a1f1dSLionel Sambucinstance.
56*0a6a1f1dSLionel Sambuc.Pp
57*0a6a1f1dSLionel SambucArgument
58*0a6a1f1dSLionel Sambuc.Ar dbg
59*0a6a1f1dSLionel Sambucshould be a handle to a valid
60*0a6a1f1dSLionel Sambuc.Vt Dwarf_Debug
61*0a6a1f1dSLionel Sambucinstance returned by a prior call to
62*0a6a1f1dSLionel Sambuc.Xr dwarf_init 3
63*0a6a1f1dSLionel Sambucor
64*0a6a1f1dSLionel Sambuc.Xr dwarf_elf_init 3 .
65*0a6a1f1dSLionel Sambuc.Pp
66*0a6a1f1dSLionel SambucArgument
67*0a6a1f1dSLionel Sambuc.Ar elf
68*0a6a1f1dSLionel Sambucpoints a location into which a handle to an
69*0a6a1f1dSLionel Sambuc.Vt Elf
70*0a6a1f1dSLionel Sambucdescriptor will be written.
71*0a6a1f1dSLionel Sambuc.Pp
72*0a6a1f1dSLionel SambucArgument
73*0a6a1f1dSLionel Sambuc.Ar err
74*0a6a1f1dSLionel Sambucis used to record error information in case of failure.
75*0a6a1f1dSLionel Sambuc.Sh RETURN VALUES
76*0a6a1f1dSLionel SambucOn success, function
77*0a6a1f1dSLionel Sambuc.Fn dwarf_get_elf
78*0a6a1f1dSLionel Sambucreturns
79*0a6a1f1dSLionel Sambuc.Dv DW_DLV_OK .
80*0a6a1f1dSLionel SambucIn case of an error, it returns
81*0a6a1f1dSLionel Sambuc.Dv DW_DLV_ERROR
82*0a6a1f1dSLionel Sambucand sets argument
83*0a6a1f1dSLionel Sambuc.Ar err .
84*0a6a1f1dSLionel Sambuc.Sh EXAMPLES
85*0a6a1f1dSLionel SambucTo retrieve the
86*0a6a1f1dSLionel Sambuc.Vt Elf
87*0a6a1f1dSLionel Sambucinstance associated with a
88*0a6a1f1dSLionel Sambuc.Vt Dwarf_Debug
89*0a6a1f1dSLionel Sambucinstance use:
90*0a6a1f1dSLionel Sambuc.Bd -literal -offset indent
91*0a6a1f1dSLionel SambucDwarf_Debug dbg;
92*0a6a1f1dSLionel SambucDwarf_Error de;
93*0a6a1f1dSLionel SambucElf *elf;
94*0a6a1f1dSLionel Sambuc
95*0a6a1f1dSLionel Sambuc\&... allocate dbg using dwarf_init() etc ...
96*0a6a1f1dSLionel Sambuc
97*0a6a1f1dSLionel Sambucif (dwarf_get_elf(dbg, &elf, &de) != DW_DLV_OK)
98*0a6a1f1dSLionel Sambuc	errx(EXIT_FAILURE, "dwarf_get_elf: %s", dwarf_errmsg(de));
99*0a6a1f1dSLionel Sambuc.Ed
100*0a6a1f1dSLionel Sambuc.Sh SEE ALSO
101*0a6a1f1dSLionel Sambuc.Xr dwarf 3 ,
102*0a6a1f1dSLionel Sambuc.Xr dwarf_errmsg 3 ,
103*0a6a1f1dSLionel Sambuc.Xr dwarf_init 3 ,
104*0a6a1f1dSLionel Sambuc.Xr dwarf_finish 3 ,
105*0a6a1f1dSLionel Sambuc.Xr elf 3
106