1.\" $NetBSD: dwarf_get_elf.3,v 1.2 2014/03/09 16:58:04 christos Exp $ 2.\" 3.\" Copyright (c) 2009 Joseph Koshy. All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 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. 13.\" 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 24.\" such damage. 25.\" 26.\" Id: dwarf_get_elf.3 2122 2011-11-09 15:35:14Z jkoshy 27.\" 28.Dd November 9, 2011 29.Os 30.Dt DWARF_GET_ELF 3 31.Sh NAME 32.Nm dwarf_get_elf 33.Nd retrieve the 34.Vt Elf 35descriptor associated with a 36.Vt Dwarf_Debug 37instance 38.Sh LIBRARY 39.Lb libdwarf 40.Sh SYNOPSIS 41.In libdwarf.h 42.Ft int 43.Fo dwarf_get_elf 44.Fa "Dwarf_Debug dbg" 45.Fa "Elf **elf" 46.Fa "Dwarf_Error *err" 47.Fc 48.Sh DESCRIPTION 49Function 50.Fn dwarf_get_elf 51returns the 52.Vt Elf 53descriptor associated with a 54.Vt Dwarf_Debug 55instance. 56.Pp 57Argument 58.Ar dbg 59should be a handle to a valid 60.Vt Dwarf_Debug 61instance returned by a prior call to 62.Xr dwarf_init 3 63or 64.Xr dwarf_elf_init 3 . 65.Pp 66Argument 67.Ar elf 68points a location into which a handle to an 69.Vt Elf 70descriptor will be written. 71.Pp 72Argument 73.Ar err 74is used to record error information in case of failure. 75.Sh RETURN VALUES 76On success, function 77.Fn dwarf_get_elf 78returns 79.Dv DW_DLV_OK . 80In case of an error, it returns 81.Dv DW_DLV_ERROR 82and sets argument 83.Ar err . 84.Sh EXAMPLES 85To retrieve the 86.Vt Elf 87instance associated with a 88.Vt Dwarf_Debug 89instance use: 90.Bd -literal -offset indent 91Dwarf_Debug dbg; 92Dwarf_Error de; 93Elf *elf; 94 95\&... allocate dbg using dwarf_init() etc ... 96 97if (dwarf_get_elf(dbg, &elf, &de) != DW_DLV_OK) 98 errx(EXIT_FAILURE, "dwarf_get_elf: %s", dwarf_errmsg(de)); 99.Ed 100.Sh SEE ALSO 101.Xr dwarf 3 , 102.Xr dwarf_errmsg 3 , 103.Xr dwarf_init 3 , 104.Xr dwarf_finish 3 , 105.Xr elf 3 106