xref: /netbsd-src/external/bsd/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_reg.3 (revision 5ac3bc719ce6e70593039505b491894133237d12)
1.\"	$NetBSD: dwarf_get_fde_info_for_reg.3,v 1.6 2024/03/03 17:37:31 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_get_fde_info_for_reg.3 3962 2022-03-12 15:56:10Z jkoshy
28.\"
29.Dd June 4, 2011
30.Dt DWARF_GET_FDE_INFO_FOR_REG 3
31.Os
32.Sh NAME
33.Nm dwarf_get_fde_info_for_reg
34.Nd retrieve register rule
35.Sh LIBRARY
36.Lb libdwarf
37.Sh SYNOPSIS
38.In libdwarf.h
39.Ft int
40.Fo dwarf_get_fde_info_for_reg
41.Fa "Dwarf_Fde fde"
42.Fa "Dwarf_Half table_column"
43.Fa "Dwarf_Addr pc"
44.Fa "Dwarf_Signed *offset_relevant"
45.Fa "Dwarf_Signed *register_num"
46.Fa "Dwarf_Signed *offset"
47.Fa "Dwarf_Addr *row_pc"
48.Fa "Dwarf_Error *error"
49.Fc
50.Sh DESCRIPTION
51Function
52.Fn dwarf_get_fde_info_for_reg
53retrieves a register rule from the register rule table associated with
54a given FDE descriptor, given a program counter address and rule
55column number.
56.Pp
57Argument
58.Fa fde
59should reference a valid DWARF FDE descriptor.
60.Pp
61Arugment
62.Fa table_column
63should hold the column number of the register rule desired.
64.Pp
65Argument
66.Fa pc
67should hold the program counter address to be used to locate the
68desired register rule row.
69.Pp
70On successful execution,
71.Fn dwarf_get_fde_info_for_reg
72stores information about the register rule found into the locations
73pointed to by the arguments
74.Fa offset_relevant ,
75.Fa register_num ,
76.Fa offset
77and
78.Fa row_pc .
79.Pp
80If there is an offset value associated with the register rule,
81the location pointed to by argument
82.Fa offset_relevant
83will be set to 1.
84.Pp
85Argument
86.Fa register_num
87should point to a location which will hold the register number associated
88with the register rule.
89.Pp
90Argument
91.Fa offset
92should point to a location which will be set to the offset value
93associated with the register rule, or to 0 if the register rule
94does not have an offset value.
95.Pp
96Argument
97.Fa row_pc
98should point to a location which will be set to the lowest program
99counter address associated with the register rule found.
100.Pp
101If argument
102.Fa err
103is not
104.Dv NULL ,
105it will be used to return an error descriptor in case of an error.
106.Ss COMPATIBILITY
107Function
108.Fn dwarf_get_fde_info_for_reg
109is deprecated since it only supports DWARF2 frame sections.
110Applications should instead use function
111.Xr dwarf_get_fde_info_for_reg3 3
112which supports both DWARF2 and DWARF3 frame sections.
113.Sh RETURN VALUES
114Function
115.Fn dwarf_get_fde_info_for_reg
116returns
117.Dv DW_DLV_OK
118when it succeeds.
119In case of an error, it returns
120.Dv DW_DLV_ERROR
121and sets the argument
122.Fa err .
123.Sh ERRORS
124Function
125.Fn dwarf_get_fde_info_for_reg
126can fail with:
127.Bl -tag -width ".Bq Er DW_DLE_FRAME_TABLE_COL_BAD"
128.It Bq Er DW_DLE_ARGUMENT
129One of the arguments
130.Fa fde ,
131.Fa offset_relevant ,
132.Fa register_num ,
133.Fa offset
134or
135.Fa row_pc
136was
137.Dv NULL .
138.It Bq Er DW_DLE_FRAME_TABLE_COL_BAD
139The column number provided in argument
140.Fa table_column
141was too large.
142.It Bq Er DW_DLE_PC_NOT_IN_FDE_RANGE
143The program counter value provided in argument
144.Fa pc
145did not fall in the range covered by argument
146.Fa fde .
147.El
148.Sh SEE ALSO
149.Xr dwarf 3 ,
150.Xr dwarf_get_fde_at_pc 3 ,
151.Xr dwarf_get_fde_info_for_all_regs 3 ,
152.Xr dwarf_get_fde_info_for_all_regs3 3 ,
153.Xr dwarf_get_fde_info_for_cfa_reg3 3 ,
154.Xr dwarf_get_fde_info_for_reg3 3 ,
155.Xr dwarf_get_fde_n 3 ,
156.Xr dwarf_set_frame_cfa_value 3 ,
157.Xr dwarf_set_frame_rule_initial_value 3 ,
158.Xr dwarf_set_frame_rule_table_size 3 ,
159.Xr dwarf_set_frame_same_value 3 ,
160.Xr dwarf_set_frame_undefined_value 3
161