xref: /minix3/external/bsd/elftoolchain/dist/libdwarf/dwarf_add_AT_signed_const.3 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1.\"	$NetBSD: dwarf_add_AT_signed_const.3,v 1.2 2014/03/09 16:58:03 christos Exp $
2.\"
3.\" Copyright (c) 2011 Kai Wang
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" Id: dwarf_add_AT_signed_const.3 2072 2011-10-27 03:26:49Z jkoshy
28.\"
29.Dd September 4, 2011
30.Os
31.Dt DWARF_ADD_AT_SIGNED_CONST 3
32.Sh NAME
33.Nm dwarf_add_AT_signed_const ,
34.Nm dwarf_add_AT_unsigned_const
35.Nd create and attach constant class attributes
36.Sh LIBRARY
37.Lb libdwarf
38.Sh SYNOPSIS
39.In libdwarf.h
40.Ft Dwarf_P_Attribute
41.Fo dwarf_add_AT_signed_const
42.Fa "Dwarf_P_Debug dbg"
43.Fa "Dwarf_P_Die die"
44.Fa "Dwarf_Half attr"
45.Fa "Dwarf_Signed value"
46.Fa "Dwarf_Error *err"
47.Fc
48.Ft Dwarf_P_Attribute
49.Fo dwarf_add_AT_unsigned_const
50.Fa "Dwarf_P_Debug dbg"
51.Fa "Dwarf_P_Die die"
52.Fa "Dwarf_Half attr"
53.Fa "Dwarf_Unsigned value"
54.Fa "Dwarf_Error *err"
55.Fc
56.Sh DESCRIPTION
57These functions create attribute descriptors belonging to the
58.Sq constant
59class
60and attach them to the debugging information entry referenced by
61argument
62.Ar die .
63.Pp
64Argument
65.Ar dbg
66should reference a DWARF producer instance allocated using
67.Xr dwarf_producer_init 3
68or
69.Xr dwarf_producer_init_b 3 .
70.Pp
71Argument
72.Ar die
73should reference a debugging information entry allocated using
74.Xr dwarf_new_die 3 .
75.Pp
76Argument
77.Ar attr
78specifies the attribute code of the created attribute descriptor.
79.Pp
80Function
81.Fn dwarf_add_AT_signed_const
82creates an attribute descriptor with the signed value specified in
83argument
84.Ar value .
85.Pp
86Function
87.Fn dwarf_add_AT_unsigned_const
88creates an attribute descriptor with the unsigned value specified in
89argument
90.Ar value .
91.Pp
92The attribute created by these function will have one of the
93DWARF forms
94.Dv DW_FORM_data1 ,
95.Dv DW_FORM_data2 ,
96.Dv DW_FORM_data4
97or
98.Dv DW_FORM_data8 ,
99depending on the size of the value specified in argument
100.Ar value .
101.Pp
102If argument
103.Ar err
104is not NULL, it will be used by these functions to store error
105information in case of an error.
106.Sh RETURN VALUES
107On success, these functions return the created attribute descriptor.
108In case of an error, these functions return
109.Dv DW_DLV_BADADDR
110and set the argument
111.Ar err .
112.Sh ERRORS
113These functions can fail with:
114.Bl -tag -width ".Bq Er DW_DLE_ARGUMENT"
115.It Bq Er DW_DLE_ARGUMENT
116Either of the arguments
117.Ar dbg
118or
119.Ar die
120was NULL.
121.It Bq Er DW_DLE_MEMORY
122An out of memory condition was encountered during execution.
123.El
124.Sh SEE ALSO
125.Xr dwarf 3 ,
126.Xr dwarf_add_AT_const_value_signedint 3 ,
127.Xr dwarf_add_AT_const_value_unsignedint 3 ,
128.Xr dwarf_add_AT_dataref 3 ,
129.Xr dwarf_add_AT_ref_address 3 ,
130.Xr dwarf_add_AT_targ_address_b 3 ,
131.Xr dwarf_new_die 3 ,
132.Xr dwarf_producer_init 3 ,
133.Xr dwarf_producer_init_b 3
134