1.\"	$NetBSD: dwarf_get_fde_info_for_all_regs.3,v 1.2 2014/03/09 16:58:04 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_all_regs.3 2071 2011-10-27 03:20:00Z jkoshy
28.\"
29.Dd June 4, 2011
30.Os
31.Dt DWARF_GET_FDE_INFO_FOR_ALL_REGS 3
32.Sh NAME
33.Nm dwarf_get_fde_info_for_all_regs
34.Nd retrieve register rule row
35.Sh LIBRARY
36.Lb libdwarf
37.Sh SYNOPSIS
38.In libdwarf.h
39.Ft int
40.Fo dwarf_get_fde_info_for_all_regs
41.Fa "Dwarf_Fde fde"
42.Fa "Dwarf_Addr pc"
43.Fa "Dwarf_Regtable *reg_table"
44.Fa "Dwarf_Addr *row_pc"
45.Fa "Dwarf_Error *err"
46.Fc
47.Sh DESCRIPTION
48Function
49.Fn dwarf_get_fde_info_for_all_regs
50retrieves a row from the register rule table associated with the given
51FDE descriptor.
52.Pp
53Argument
54.Ar fde
55should reference a valid DWARF FDE descriptor.
56.Pp
57Argument
58.Ar pc
59should hold the program counter address to be used to locate the
60desired table row.
61.Pp
62Argument
63.Ar reg_table
64should point to a
65.Vt Dwarf_Regtable
66descriptor which will hold the returned table row of register rules.
67.Pp
68Argument
69.Ar row_pc
70should point to a location which will be set to the lowest program
71counter address associated with the table row.
72.Pp
73If argument
74.Ar err
75is not NULL, it will be used to store error information in case of an
76error.
77.Pp
78The
79.Vt Dwarf_Regtable
80descriptor is defined in the header file
81.In libdwarf.h :
82.Bd -literal -offset indent
83typedef struct {
84	struct {
85		Dwarf_Small	dw_offset_relevant;
86		Dwarf_Half	dw_regnum;
87		Dwarf_Addr	dw_offset;
88	} rules[DW_REG_TABLE_SIZE];
89} Dwarf_Regtable;
90.Ed
91.Pp
92For each of the register rules returned,
93the
94.Va dw_offset_relevant
95field is set to 1 if the register rule has a offset value. The
96.Va dw_regnum
97field is set to the register number associated with the regsiter rule.
98The
99.Va dw_offset
100field is set to the offset value associated with the register rule.
101.Pp
102The number of register columns returned is either the constant
103value
104.Dv DW_REG_TABLE_SIZE as defined
105in the header file
106.In libdwarf.h ,
107or the value set by function
108.Xr dwarf_set_frame_rule_table_size 3 ,
109whichever is smaller.
110.Ss COMPATIBILITY
111Function
112.Fn dwarf_get_fde_info_for_all_regs
113is deprecated since it only supports DWARF2 frame sections.
114Applications should instead use function
115.Xr dwarf_get_fde_info_for_all_regs3 3
116which supports both DWARF2 and DWARF3 frame sections.
117.Sh RETURN VALUES
118Function
119.Fn dwarf_get_fde_info_for_all_regs
120returns
121.Dv DW_DLV_OK
122when it succeeds.
123In case of an error, it returns
124.Dv DW_DLV_ERROR
125and sets the argument
126.Ar err .
127.Sh ERRORS
128Function
129.Fn dwarf_get_fde_info_for_all_regs
130can fail with:
131.Bl -tag -width ".Bq Er DW_DLE_PC_NOT_IN_FDE_RANGE"
132.It Bq Er DW_DLE_ARGUMENT
133One of the arguments
134.Ar fde ,
135.Ar reg_table
136or
137.Ar row_pc
138was NULL.
139.It Bq Er DW_DLE_PC_NOT_IN_FDE_RANGE
140The program counter value provided in argument
141.Ar pc
142did not fall in the range covered by argument
143.Ar fde .
144.El
145.Sh SEE ALSO
146.Xr dwarf 3 ,
147.Xr dwarf_get_fde_at_pc 3 ,
148.Xr dwarf_get_fde_info_for_all_regs3 3 ,
149.Xr dwarf_get_fde_info_for_cfa_reg3 3 ,
150.Xr dwarf_get_fde_info_for_reg 3 ,
151.Xr dwarf_get_fde_info_for_reg3 3 ,
152.Xr dwarf_get_fde_n 3 ,
153.Xr dwarf_set_frame_cfa_value 3 ,
154.Xr dwarf_set_frame_rule_table_size 3 ,
155.Xr dwarf_set_frame_rule_initial_value 3 ,
156.Xr dwarf_set_frame_same_value 3 ,
157.Xr dwarf_set_frame_undefined_value 3
158