xref: /netbsd-src/external/bsd/elftoolchain/dist/libdwarf/dwarf_formexprloc.3 (revision 5ac3bc719ce6e70593039505b491894133237d12)
1*5ac3bc71Schristos.\"	$NetBSD: dwarf_formexprloc.3,v 1.6 2024/03/03 17:37:31 christos Exp $
2e81373b4Schristos.\"
39dd9d0cfSchristos.\" Copyright (c) 2010 Joseph Koshy
49dd9d0cfSchristos.\" All rights reserved.
59dd9d0cfSchristos.\"
69dd9d0cfSchristos.\" Redistribution and use in source and binary forms, with or without
79dd9d0cfSchristos.\" modification, are permitted provided that the following conditions
89dd9d0cfSchristos.\" are met:
99dd9d0cfSchristos.\" 1. Redistributions of source code must retain the above copyright
109dd9d0cfSchristos.\"    notice, this list of conditions and the following disclaimer.
119dd9d0cfSchristos.\" 2. Redistributions in binary form must reproduce the above copyright
129dd9d0cfSchristos.\"    notice, this list of conditions and the following disclaimer in the
139dd9d0cfSchristos.\"    documentation and/or other materials provided with the distribution.
149dd9d0cfSchristos.\"
159dd9d0cfSchristos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
169dd9d0cfSchristos.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
179dd9d0cfSchristos.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
189dd9d0cfSchristos.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
199dd9d0cfSchristos.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
209dd9d0cfSchristos.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
219dd9d0cfSchristos.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
229dd9d0cfSchristos.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
239dd9d0cfSchristos.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
249dd9d0cfSchristos.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
259dd9d0cfSchristos.\" SUCH DAMAGE.
269dd9d0cfSchristos.\"
27cdbf1fe1Sjkoshy.\" Id: dwarf_formexprloc.3 3962 2022-03-12 15:56:10Z jkoshy
289dd9d0cfSchristos.\"
299dd9d0cfSchristos.Dd July 25, 2010
309dd9d0cfSchristos.Dt DWARF_FORMEXPRLOC 3
31604b0842Sjkoshy.Os
329dd9d0cfSchristos.Sh NAME
339dd9d0cfSchristos.Nm dwarf_formexprloc
349dd9d0cfSchristos.Nd return information about a location expression
359dd9d0cfSchristos.Sh LIBRARY
369dd9d0cfSchristos.Lb libdwarf
379dd9d0cfSchristos.Sh SYNOPSIS
389dd9d0cfSchristos.In libdwarf.h
399dd9d0cfSchristos.Ft int
409dd9d0cfSchristos.Fo dwarf_formexprloc
419dd9d0cfSchristos.Fa "Dwarf_Attribute attr"
429dd9d0cfSchristos.Fa "Dwarf_Unsigned *retlen"
439dd9d0cfSchristos.Fa "Dwarf_Ptr *retexpr"
449dd9d0cfSchristos.Fa "Dwarf_Error *err"
459dd9d0cfSchristos.Fc
469dd9d0cfSchristos.Sh DESCRIPTION
479dd9d0cfSchristosFunction
489dd9d0cfSchristos.Fn dwarf_formexprloc
499dd9d0cfSchristosallows an application to retrieve the length and the bytes of a
509dd9d0cfSchristosDWARF location expression.
519dd9d0cfSchristos.Pp
529dd9d0cfSchristosArgument
53cdbf1fe1Sjkoshy.Fa attr
549dd9d0cfSchristosshould reference a DWARF attribute of the form
559dd9d0cfSchristos.Dv DW_FORM_exprloc .
569dd9d0cfSchristosArgument
57cdbf1fe1Sjkoshy.Fa retlen
589dd9d0cfSchristosshould point to a location that will be set to the length of the
599dd9d0cfSchristoslocation expression.
609dd9d0cfSchristosArgument
61cdbf1fe1Sjkoshy.Fa retexpr
629dd9d0cfSchristosshould point to a location that will be set to a pointer to the
639dd9d0cfSchristoscontent of the location expression itself.
649dd9d0cfSchristos.Pp
659dd9d0cfSchristosIf argument
66cdbf1fe1Sjkoshy.Fa err
67cdbf1fe1Sjkoshyis not
68cdbf1fe1Sjkoshy.Dv NULL ,
69cdbf1fe1Sjkoshyit will be used to return an error descriptor in case of an error.
709dd9d0cfSchristos.Ss Memory Management
719dd9d0cfSchristosThe application should not attempt to free the memory
729dd9d0cfSchristosarea referenced by the pointer returned in argument
73cdbf1fe1Sjkoshy.Fa retexpr .
749dd9d0cfSchristos.Sh RETURN VALUES
759dd9d0cfSchristosFunction
769dd9d0cfSchristos.Fn dwarf_formexprloc
779dd9d0cfSchristosreturns
789dd9d0cfSchristos.Dv DW_DLV_OK
799dd9d0cfSchristoson success.
809dd9d0cfSchristosIn case of an error, it returns
819dd9d0cfSchristos.Dv DW_DLV_ERROR
829dd9d0cfSchristosand sets argument
83cdbf1fe1Sjkoshy.Fa err .
849dd9d0cfSchristos.Sh ERRORS
859dd9d0cfSchristosFunction
869dd9d0cfSchristos.Fn dwarf_formexprloc
879dd9d0cfSchristosmay fail with the following errors:
889dd9d0cfSchristos.Bl -tag -width ".Bq Er DW_DLE_ATTR_FORM_BAD"
899dd9d0cfSchristos.It Bq Er DW_DLE_ARGUMENT
909dd9d0cfSchristosOne of arguments
91cdbf1fe1Sjkoshy.Fa attr ,
92cdbf1fe1Sjkoshy.Fa retlen
939dd9d0cfSchristosor
94cdbf1fe1Sjkoshy.Fa retexpr
95cdbf1fe1Sjkoshywas
96cdbf1fe1Sjkoshy.Dv NULL .
979dd9d0cfSchristos.It Bq Er DW_DLE_ATTR_FORM_BAD
989dd9d0cfSchristosThe attribute referenced by argument
99cdbf1fe1Sjkoshy.Fa attr
1009dd9d0cfSchristoswas not of form
1019dd9d0cfSchristos.Dv DW_FORM_exprloc .
1029dd9d0cfSchristos.El
1039dd9d0cfSchristos.Sh SEE ALSO
1049dd9d0cfSchristos.Xr dwarf 3 ,
1059dd9d0cfSchristos.Xr dwarf_attr 3 ,
1069dd9d0cfSchristos.Xr dwarf_formblock 3 ,
1079dd9d0cfSchristos.Xr dwarf_formflag 3 ,
1089dd9d0cfSchristos.Xr dwarf_formref 3 ,
1099dd9d0cfSchristos.Xr dwarf_formsdata 3 ,
1109dd9d0cfSchristos.Xr dwarf_formsig8 3 ,
1119dd9d0cfSchristos.Xr dwarf_formstring 3 ,
1129dd9d0cfSchristos.Xr dwarf_formudata 3 ,
1139dd9d0cfSchristos.Xr dwarf_hasattr 3
114