1*0a6a1f1dSLionel Sambuc /* $NetBSD: dwarf_frame.c,v 1.2 2014/03/09 16:58:03 christos Exp $ */
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel Sambuc /*-
4*0a6a1f1dSLionel Sambuc * Copyright (c) 2009,2011 Kai Wang
5*0a6a1f1dSLionel Sambuc * All rights reserved.
6*0a6a1f1dSLionel Sambuc *
7*0a6a1f1dSLionel Sambuc * Redistribution and use in source and binary forms, with or without
8*0a6a1f1dSLionel Sambuc * modification, are permitted provided that the following conditions
9*0a6a1f1dSLionel Sambuc * are met:
10*0a6a1f1dSLionel Sambuc * 1. Redistributions of source code must retain the above copyright
11*0a6a1f1dSLionel Sambuc * notice, this list of conditions and the following disclaimer.
12*0a6a1f1dSLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
13*0a6a1f1dSLionel Sambuc * notice, this list of conditions and the following disclaimer in the
14*0a6a1f1dSLionel Sambuc * documentation and/or other materials provided with the distribution.
15*0a6a1f1dSLionel Sambuc *
16*0a6a1f1dSLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17*0a6a1f1dSLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18*0a6a1f1dSLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19*0a6a1f1dSLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20*0a6a1f1dSLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21*0a6a1f1dSLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22*0a6a1f1dSLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23*0a6a1f1dSLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24*0a6a1f1dSLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*0a6a1f1dSLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*0a6a1f1dSLionel Sambuc * SUCH DAMAGE.
27*0a6a1f1dSLionel Sambuc */
28*0a6a1f1dSLionel Sambuc
29*0a6a1f1dSLionel Sambuc #include "_libdwarf.h"
30*0a6a1f1dSLionel Sambuc
31*0a6a1f1dSLionel Sambuc __RCSID("$NetBSD: dwarf_frame.c,v 1.2 2014/03/09 16:58:03 christos Exp $");
32*0a6a1f1dSLionel Sambuc ELFTC_VCSID("Id: dwarf_frame.c 2073 2011-10-27 03:30:47Z jkoshy ");
33*0a6a1f1dSLionel Sambuc
34*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_list(Dwarf_Debug dbg,Dwarf_Cie ** cie_list,Dwarf_Signed * cie_count,Dwarf_Fde ** fde_list,Dwarf_Signed * fde_count,Dwarf_Error * error)35*0a6a1f1dSLionel Sambuc dwarf_get_fde_list(Dwarf_Debug dbg, Dwarf_Cie **cie_list,
36*0a6a1f1dSLionel Sambuc Dwarf_Signed *cie_count, Dwarf_Fde **fde_list, Dwarf_Signed *fde_count,
37*0a6a1f1dSLionel Sambuc Dwarf_Error *error)
38*0a6a1f1dSLionel Sambuc {
39*0a6a1f1dSLionel Sambuc
40*0a6a1f1dSLionel Sambuc if (dbg == NULL || cie_list == NULL || cie_count == NULL ||
41*0a6a1f1dSLionel Sambuc fde_list == NULL || fde_count == NULL) {
42*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
43*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
44*0a6a1f1dSLionel Sambuc }
45*0a6a1f1dSLionel Sambuc
46*0a6a1f1dSLionel Sambuc if (dbg->dbg_internal_reg_table == NULL) {
47*0a6a1f1dSLionel Sambuc if (_dwarf_frame_interal_table_init(dbg, error) != DW_DLE_NONE)
48*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
49*0a6a1f1dSLionel Sambuc }
50*0a6a1f1dSLionel Sambuc
51*0a6a1f1dSLionel Sambuc if (dbg->dbg_frame == NULL) {
52*0a6a1f1dSLionel Sambuc if (_dwarf_frame_section_load(dbg, error) != DW_DLE_NONE)
53*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
54*0a6a1f1dSLionel Sambuc if (dbg->dbg_frame == NULL) {
55*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
56*0a6a1f1dSLionel Sambuc return (DW_DLV_NO_ENTRY);
57*0a6a1f1dSLionel Sambuc }
58*0a6a1f1dSLionel Sambuc }
59*0a6a1f1dSLionel Sambuc
60*0a6a1f1dSLionel Sambuc if (dbg->dbg_frame->fs_ciearray == NULL ||
61*0a6a1f1dSLionel Sambuc dbg->dbg_frame->fs_fdearray == NULL) {
62*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
63*0a6a1f1dSLionel Sambuc return (DW_DLV_NO_ENTRY);
64*0a6a1f1dSLionel Sambuc }
65*0a6a1f1dSLionel Sambuc
66*0a6a1f1dSLionel Sambuc *cie_list = dbg->dbg_frame->fs_ciearray;
67*0a6a1f1dSLionel Sambuc *cie_count = dbg->dbg_frame->fs_cielen;
68*0a6a1f1dSLionel Sambuc *fde_list = dbg->dbg_frame->fs_fdearray;
69*0a6a1f1dSLionel Sambuc *fde_count = dbg->dbg_frame->fs_fdelen;
70*0a6a1f1dSLionel Sambuc
71*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
72*0a6a1f1dSLionel Sambuc }
73*0a6a1f1dSLionel Sambuc
74*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_list_eh(Dwarf_Debug dbg,Dwarf_Cie ** cie_list,Dwarf_Signed * cie_count,Dwarf_Fde ** fde_list,Dwarf_Signed * fde_count,Dwarf_Error * error)75*0a6a1f1dSLionel Sambuc dwarf_get_fde_list_eh(Dwarf_Debug dbg, Dwarf_Cie **cie_list,
76*0a6a1f1dSLionel Sambuc Dwarf_Signed *cie_count, Dwarf_Fde **fde_list, Dwarf_Signed *fde_count,
77*0a6a1f1dSLionel Sambuc Dwarf_Error *error)
78*0a6a1f1dSLionel Sambuc {
79*0a6a1f1dSLionel Sambuc
80*0a6a1f1dSLionel Sambuc if (dbg == NULL || cie_list == NULL || cie_count == NULL ||
81*0a6a1f1dSLionel Sambuc fde_list == NULL || fde_count == NULL) {
82*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
83*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
84*0a6a1f1dSLionel Sambuc }
85*0a6a1f1dSLionel Sambuc
86*0a6a1f1dSLionel Sambuc if (dbg->dbg_internal_reg_table == NULL) {
87*0a6a1f1dSLionel Sambuc if (_dwarf_frame_interal_table_init(dbg, error) != DW_DLE_NONE)
88*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
89*0a6a1f1dSLionel Sambuc }
90*0a6a1f1dSLionel Sambuc
91*0a6a1f1dSLionel Sambuc if (dbg->dbg_eh_frame == NULL) {
92*0a6a1f1dSLionel Sambuc if (_dwarf_frame_section_load_eh(dbg, error) != DW_DLE_NONE)
93*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
94*0a6a1f1dSLionel Sambuc if (dbg->dbg_eh_frame == NULL) {
95*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
96*0a6a1f1dSLionel Sambuc return (DW_DLV_NO_ENTRY);
97*0a6a1f1dSLionel Sambuc }
98*0a6a1f1dSLionel Sambuc }
99*0a6a1f1dSLionel Sambuc
100*0a6a1f1dSLionel Sambuc if (dbg->dbg_eh_frame->fs_ciearray == NULL ||
101*0a6a1f1dSLionel Sambuc dbg->dbg_eh_frame->fs_fdearray == NULL) {
102*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
103*0a6a1f1dSLionel Sambuc return (DW_DLV_NO_ENTRY);
104*0a6a1f1dSLionel Sambuc }
105*0a6a1f1dSLionel Sambuc
106*0a6a1f1dSLionel Sambuc *cie_list = dbg->dbg_eh_frame->fs_ciearray;
107*0a6a1f1dSLionel Sambuc *cie_count = dbg->dbg_eh_frame->fs_cielen;
108*0a6a1f1dSLionel Sambuc *fde_list = dbg->dbg_eh_frame->fs_fdearray;
109*0a6a1f1dSLionel Sambuc *fde_count = dbg->dbg_eh_frame->fs_fdelen;
110*0a6a1f1dSLionel Sambuc
111*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
112*0a6a1f1dSLionel Sambuc }
113*0a6a1f1dSLionel Sambuc
114*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_n(Dwarf_Fde * fdelist,Dwarf_Unsigned fde_index,Dwarf_Fde * ret_fde,Dwarf_Error * error)115*0a6a1f1dSLionel Sambuc dwarf_get_fde_n(Dwarf_Fde *fdelist, Dwarf_Unsigned fde_index,
116*0a6a1f1dSLionel Sambuc Dwarf_Fde *ret_fde, Dwarf_Error *error)
117*0a6a1f1dSLionel Sambuc {
118*0a6a1f1dSLionel Sambuc Dwarf_FrameSec fs;
119*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
120*0a6a1f1dSLionel Sambuc
121*0a6a1f1dSLionel Sambuc dbg = fdelist != NULL ? (*fdelist)->fde_dbg : NULL;
122*0a6a1f1dSLionel Sambuc
123*0a6a1f1dSLionel Sambuc if (fdelist == NULL || ret_fde == NULL) {
124*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
125*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
126*0a6a1f1dSLionel Sambuc }
127*0a6a1f1dSLionel Sambuc
128*0a6a1f1dSLionel Sambuc fs = fdelist[0]->fde_fs;
129*0a6a1f1dSLionel Sambuc assert(fs != NULL);
130*0a6a1f1dSLionel Sambuc
131*0a6a1f1dSLionel Sambuc if (fde_index >= fs->fs_fdelen) {
132*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
133*0a6a1f1dSLionel Sambuc return (DW_DLV_NO_ENTRY);
134*0a6a1f1dSLionel Sambuc }
135*0a6a1f1dSLionel Sambuc
136*0a6a1f1dSLionel Sambuc *ret_fde = fdelist[fde_index];
137*0a6a1f1dSLionel Sambuc
138*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
139*0a6a1f1dSLionel Sambuc }
140*0a6a1f1dSLionel Sambuc
141*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_at_pc(Dwarf_Fde * fdelist,Dwarf_Addr pc,Dwarf_Fde * ret_fde,Dwarf_Addr * lopc,Dwarf_Addr * hipc,Dwarf_Error * error)142*0a6a1f1dSLionel Sambuc dwarf_get_fde_at_pc(Dwarf_Fde *fdelist, Dwarf_Addr pc, Dwarf_Fde *ret_fde,
143*0a6a1f1dSLionel Sambuc Dwarf_Addr *lopc, Dwarf_Addr *hipc, Dwarf_Error *error)
144*0a6a1f1dSLionel Sambuc {
145*0a6a1f1dSLionel Sambuc Dwarf_FrameSec fs;
146*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
147*0a6a1f1dSLionel Sambuc Dwarf_Fde fde;
148*0a6a1f1dSLionel Sambuc int i;
149*0a6a1f1dSLionel Sambuc
150*0a6a1f1dSLionel Sambuc dbg = fdelist != NULL ? (*fdelist)->fde_dbg : NULL;
151*0a6a1f1dSLionel Sambuc
152*0a6a1f1dSLionel Sambuc if (fdelist == NULL || ret_fde == NULL || lopc == NULL ||
153*0a6a1f1dSLionel Sambuc hipc == NULL) {
154*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
155*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
156*0a6a1f1dSLionel Sambuc }
157*0a6a1f1dSLionel Sambuc
158*0a6a1f1dSLionel Sambuc fs = fdelist[0]->fde_fs;
159*0a6a1f1dSLionel Sambuc assert(fs != NULL);
160*0a6a1f1dSLionel Sambuc
161*0a6a1f1dSLionel Sambuc for (i = 0; (Dwarf_Unsigned)i < fs->fs_fdelen; i++) {
162*0a6a1f1dSLionel Sambuc fde = fdelist[i];
163*0a6a1f1dSLionel Sambuc if (pc >= fde->fde_initloc && pc < fde->fde_initloc +
164*0a6a1f1dSLionel Sambuc fde->fde_adrange) {
165*0a6a1f1dSLionel Sambuc *ret_fde = fde;
166*0a6a1f1dSLionel Sambuc *lopc = fde->fde_initloc;
167*0a6a1f1dSLionel Sambuc *hipc = fde->fde_initloc + fde->fde_adrange - 1;
168*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
169*0a6a1f1dSLionel Sambuc }
170*0a6a1f1dSLionel Sambuc }
171*0a6a1f1dSLionel Sambuc
172*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
173*0a6a1f1dSLionel Sambuc return (DW_DLV_NO_ENTRY);
174*0a6a1f1dSLionel Sambuc }
175*0a6a1f1dSLionel Sambuc
176*0a6a1f1dSLionel Sambuc int
dwarf_get_cie_of_fde(Dwarf_Fde fde,Dwarf_Cie * ret_cie,Dwarf_Error * error)177*0a6a1f1dSLionel Sambuc dwarf_get_cie_of_fde(Dwarf_Fde fde, Dwarf_Cie *ret_cie, Dwarf_Error *error)
178*0a6a1f1dSLionel Sambuc {
179*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
180*0a6a1f1dSLionel Sambuc
181*0a6a1f1dSLionel Sambuc dbg = fde != NULL ? fde->fde_dbg : NULL;
182*0a6a1f1dSLionel Sambuc
183*0a6a1f1dSLionel Sambuc if (fde == NULL || ret_cie == NULL) {
184*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
185*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
186*0a6a1f1dSLionel Sambuc }
187*0a6a1f1dSLionel Sambuc
188*0a6a1f1dSLionel Sambuc *ret_cie = fde->fde_cie;
189*0a6a1f1dSLionel Sambuc
190*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
191*0a6a1f1dSLionel Sambuc }
192*0a6a1f1dSLionel Sambuc
193*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_range(Dwarf_Fde fde,Dwarf_Addr * low_pc,Dwarf_Unsigned * func_len,Dwarf_Ptr * fde_bytes,Dwarf_Unsigned * fde_byte_len,Dwarf_Off * cie_offset,Dwarf_Signed * cie_index,Dwarf_Off * fde_offset,Dwarf_Error * error)194*0a6a1f1dSLionel Sambuc dwarf_get_fde_range(Dwarf_Fde fde, Dwarf_Addr *low_pc, Dwarf_Unsigned *func_len,
195*0a6a1f1dSLionel Sambuc Dwarf_Ptr *fde_bytes, Dwarf_Unsigned *fde_byte_len, Dwarf_Off *cie_offset,
196*0a6a1f1dSLionel Sambuc Dwarf_Signed *cie_index, Dwarf_Off *fde_offset, Dwarf_Error *error)
197*0a6a1f1dSLionel Sambuc {
198*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
199*0a6a1f1dSLionel Sambuc
200*0a6a1f1dSLionel Sambuc dbg = fde != NULL ? fde->fde_dbg : NULL;
201*0a6a1f1dSLionel Sambuc
202*0a6a1f1dSLionel Sambuc if (fde == NULL || low_pc == NULL || func_len == NULL ||
203*0a6a1f1dSLionel Sambuc fde_bytes == NULL || fde_byte_len == NULL || cie_offset == NULL ||
204*0a6a1f1dSLionel Sambuc cie_index == NULL || fde_offset == NULL) {
205*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
206*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
207*0a6a1f1dSLionel Sambuc }
208*0a6a1f1dSLionel Sambuc
209*0a6a1f1dSLionel Sambuc *low_pc = fde->fde_initloc;
210*0a6a1f1dSLionel Sambuc *func_len = fde->fde_adrange;
211*0a6a1f1dSLionel Sambuc *fde_bytes = fde->fde_addr;
212*0a6a1f1dSLionel Sambuc *fde_byte_len = fde->fde_length;
213*0a6a1f1dSLionel Sambuc *cie_offset = fde->fde_cieoff;
214*0a6a1f1dSLionel Sambuc *cie_index = fde->fde_cie->cie_index;
215*0a6a1f1dSLionel Sambuc *fde_offset = fde->fde_offset;
216*0a6a1f1dSLionel Sambuc
217*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
218*0a6a1f1dSLionel Sambuc }
219*0a6a1f1dSLionel Sambuc
220*0a6a1f1dSLionel Sambuc int
dwarf_get_cie_info(Dwarf_Cie cie,Dwarf_Unsigned * bytes_in_cie,Dwarf_Small * version,char ** augmenter,Dwarf_Unsigned * caf,Dwarf_Unsigned * daf,Dwarf_Half * ra,Dwarf_Ptr * initinst,Dwarf_Unsigned * inst_len,Dwarf_Error * error)221*0a6a1f1dSLionel Sambuc dwarf_get_cie_info(Dwarf_Cie cie, Dwarf_Unsigned *bytes_in_cie,
222*0a6a1f1dSLionel Sambuc Dwarf_Small *version, char **augmenter, Dwarf_Unsigned *caf,
223*0a6a1f1dSLionel Sambuc Dwarf_Unsigned *daf, Dwarf_Half *ra, Dwarf_Ptr *initinst,
224*0a6a1f1dSLionel Sambuc Dwarf_Unsigned *inst_len, Dwarf_Error *error)
225*0a6a1f1dSLionel Sambuc {
226*0a6a1f1dSLionel Sambuc
227*0a6a1f1dSLionel Sambuc if (cie == NULL || bytes_in_cie == NULL || version == NULL ||
228*0a6a1f1dSLionel Sambuc augmenter == NULL || caf == NULL || daf == NULL || ra == NULL ||
229*0a6a1f1dSLionel Sambuc initinst == NULL || inst_len == NULL) {
230*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
231*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
232*0a6a1f1dSLionel Sambuc }
233*0a6a1f1dSLionel Sambuc
234*0a6a1f1dSLionel Sambuc *bytes_in_cie = cie->cie_length;
235*0a6a1f1dSLionel Sambuc *version = cie->cie_version;
236*0a6a1f1dSLionel Sambuc *augmenter = (char *) cie->cie_augment;
237*0a6a1f1dSLionel Sambuc *caf = cie->cie_caf;
238*0a6a1f1dSLionel Sambuc *daf = cie->cie_daf;
239*0a6a1f1dSLionel Sambuc *ra = cie->cie_ra;
240*0a6a1f1dSLionel Sambuc *initinst = cie->cie_initinst;
241*0a6a1f1dSLionel Sambuc *inst_len = cie->cie_instlen;
242*0a6a1f1dSLionel Sambuc
243*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
244*0a6a1f1dSLionel Sambuc }
245*0a6a1f1dSLionel Sambuc
246*0a6a1f1dSLionel Sambuc int
dwarf_get_cie_index(Dwarf_Cie cie,Dwarf_Signed * cie_index,Dwarf_Error * error)247*0a6a1f1dSLionel Sambuc dwarf_get_cie_index(Dwarf_Cie cie, Dwarf_Signed *cie_index, Dwarf_Error *error)
248*0a6a1f1dSLionel Sambuc {
249*0a6a1f1dSLionel Sambuc
250*0a6a1f1dSLionel Sambuc if (cie == NULL || cie_index == NULL) {
251*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(NULL, error, DW_DLE_ARGUMENT);
252*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
253*0a6a1f1dSLionel Sambuc }
254*0a6a1f1dSLionel Sambuc
255*0a6a1f1dSLionel Sambuc *cie_index = cie->cie_index;
256*0a6a1f1dSLionel Sambuc
257*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
258*0a6a1f1dSLionel Sambuc }
259*0a6a1f1dSLionel Sambuc
260*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_instr_bytes(Dwarf_Fde fde,Dwarf_Ptr * ret_inst,Dwarf_Unsigned * ret_len,Dwarf_Error * error)261*0a6a1f1dSLionel Sambuc dwarf_get_fde_instr_bytes(Dwarf_Fde fde, Dwarf_Ptr *ret_inst,
262*0a6a1f1dSLionel Sambuc Dwarf_Unsigned *ret_len, Dwarf_Error *error)
263*0a6a1f1dSLionel Sambuc {
264*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
265*0a6a1f1dSLionel Sambuc
266*0a6a1f1dSLionel Sambuc dbg = fde != NULL ? fde->fde_dbg : NULL;
267*0a6a1f1dSLionel Sambuc
268*0a6a1f1dSLionel Sambuc if (fde == NULL || ret_inst == NULL || ret_len == NULL) {
269*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
270*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
271*0a6a1f1dSLionel Sambuc }
272*0a6a1f1dSLionel Sambuc
273*0a6a1f1dSLionel Sambuc *ret_inst = fde->fde_inst;
274*0a6a1f1dSLionel Sambuc *ret_len = fde->fde_instlen;
275*0a6a1f1dSLionel Sambuc
276*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
277*0a6a1f1dSLionel Sambuc }
278*0a6a1f1dSLionel Sambuc
279*0a6a1f1dSLionel Sambuc #define RL rt->rt3_rules[table_column]
280*0a6a1f1dSLionel Sambuc #define CFA rt->rt3_cfa_rule
281*0a6a1f1dSLionel Sambuc
282*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_info_for_reg(Dwarf_Fde fde,Dwarf_Half table_column,Dwarf_Addr pc_requested,Dwarf_Signed * offset_relevant,Dwarf_Signed * register_num,Dwarf_Signed * offset,Dwarf_Addr * row_pc,Dwarf_Error * error)283*0a6a1f1dSLionel Sambuc dwarf_get_fde_info_for_reg(Dwarf_Fde fde, Dwarf_Half table_column,
284*0a6a1f1dSLionel Sambuc Dwarf_Addr pc_requested, Dwarf_Signed *offset_relevant,
285*0a6a1f1dSLionel Sambuc Dwarf_Signed *register_num, Dwarf_Signed *offset, Dwarf_Addr *row_pc,
286*0a6a1f1dSLionel Sambuc Dwarf_Error *error)
287*0a6a1f1dSLionel Sambuc {
288*0a6a1f1dSLionel Sambuc Dwarf_Regtable3 *rt;
289*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
290*0a6a1f1dSLionel Sambuc Dwarf_Addr pc;
291*0a6a1f1dSLionel Sambuc int ret;
292*0a6a1f1dSLionel Sambuc
293*0a6a1f1dSLionel Sambuc dbg = fde != NULL ? fde->fde_dbg : NULL;
294*0a6a1f1dSLionel Sambuc
295*0a6a1f1dSLionel Sambuc if (fde == NULL || offset_relevant == NULL || register_num == NULL ||
296*0a6a1f1dSLionel Sambuc offset == NULL || row_pc == NULL) {
297*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
298*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
299*0a6a1f1dSLionel Sambuc }
300*0a6a1f1dSLionel Sambuc
301*0a6a1f1dSLionel Sambuc if (pc_requested < fde->fde_initloc ||
302*0a6a1f1dSLionel Sambuc pc_requested >= fde->fde_initloc + fde->fde_adrange) {
303*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_PC_NOT_IN_FDE_RANGE);
304*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
305*0a6a1f1dSLionel Sambuc }
306*0a6a1f1dSLionel Sambuc
307*0a6a1f1dSLionel Sambuc ret = _dwarf_frame_get_internal_table(fde, pc_requested, &rt, &pc,
308*0a6a1f1dSLionel Sambuc error);
309*0a6a1f1dSLionel Sambuc if (ret != DW_DLE_NONE)
310*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
311*0a6a1f1dSLionel Sambuc
312*0a6a1f1dSLionel Sambuc if (table_column == dbg->dbg_frame_cfa_value) {
313*0a6a1f1dSLionel Sambuc /* Application ask for CFA. */
314*0a6a1f1dSLionel Sambuc *offset_relevant = CFA.dw_offset_relevant;
315*0a6a1f1dSLionel Sambuc *register_num = CFA.dw_regnum;
316*0a6a1f1dSLionel Sambuc *offset = CFA.dw_offset_or_block_len;
317*0a6a1f1dSLionel Sambuc } else {
318*0a6a1f1dSLionel Sambuc /* Application ask for normal registers. */
319*0a6a1f1dSLionel Sambuc if (table_column >= dbg->dbg_frame_rule_table_size ||
320*0a6a1f1dSLionel Sambuc table_column >= DW_REG_TABLE_SIZE) {
321*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_FRAME_TABLE_COL_BAD);
322*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
323*0a6a1f1dSLionel Sambuc }
324*0a6a1f1dSLionel Sambuc
325*0a6a1f1dSLionel Sambuc *offset_relevant = RL.dw_offset_relevant;
326*0a6a1f1dSLionel Sambuc *register_num = RL.dw_regnum;
327*0a6a1f1dSLionel Sambuc *offset = RL.dw_offset_or_block_len;
328*0a6a1f1dSLionel Sambuc }
329*0a6a1f1dSLionel Sambuc
330*0a6a1f1dSLionel Sambuc *row_pc = pc;
331*0a6a1f1dSLionel Sambuc
332*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
333*0a6a1f1dSLionel Sambuc }
334*0a6a1f1dSLionel Sambuc
335*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_info_for_all_regs(Dwarf_Fde fde,Dwarf_Addr pc_requested,Dwarf_Regtable * reg_table,Dwarf_Addr * row_pc,Dwarf_Error * error)336*0a6a1f1dSLionel Sambuc dwarf_get_fde_info_for_all_regs(Dwarf_Fde fde, Dwarf_Addr pc_requested,
337*0a6a1f1dSLionel Sambuc Dwarf_Regtable *reg_table, Dwarf_Addr *row_pc, Dwarf_Error *error)
338*0a6a1f1dSLionel Sambuc {
339*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
340*0a6a1f1dSLionel Sambuc Dwarf_Regtable3 *rt;
341*0a6a1f1dSLionel Sambuc Dwarf_Addr pc;
342*0a6a1f1dSLionel Sambuc Dwarf_Half cfa;
343*0a6a1f1dSLionel Sambuc int i, ret;
344*0a6a1f1dSLionel Sambuc
345*0a6a1f1dSLionel Sambuc dbg = fde != NULL ? fde->fde_dbg : NULL;
346*0a6a1f1dSLionel Sambuc
347*0a6a1f1dSLionel Sambuc if (fde == NULL || reg_table == NULL || row_pc == NULL) {
348*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
349*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
350*0a6a1f1dSLionel Sambuc }
351*0a6a1f1dSLionel Sambuc
352*0a6a1f1dSLionel Sambuc assert(dbg != NULL);
353*0a6a1f1dSLionel Sambuc
354*0a6a1f1dSLionel Sambuc if (pc_requested < fde->fde_initloc ||
355*0a6a1f1dSLionel Sambuc pc_requested >= fde->fde_initloc + fde->fde_adrange) {
356*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_PC_NOT_IN_FDE_RANGE);
357*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
358*0a6a1f1dSLionel Sambuc }
359*0a6a1f1dSLionel Sambuc
360*0a6a1f1dSLionel Sambuc ret = _dwarf_frame_get_internal_table(fde, pc_requested, &rt, &pc,
361*0a6a1f1dSLionel Sambuc error);
362*0a6a1f1dSLionel Sambuc if (ret != DW_DLE_NONE)
363*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
364*0a6a1f1dSLionel Sambuc
365*0a6a1f1dSLionel Sambuc /*
366*0a6a1f1dSLionel Sambuc * Copy the CFA rule to the column intended for holding the CFA,
367*0a6a1f1dSLionel Sambuc * if it's within the range of regtable.
368*0a6a1f1dSLionel Sambuc */
369*0a6a1f1dSLionel Sambuc cfa = dbg->dbg_frame_cfa_value;
370*0a6a1f1dSLionel Sambuc if (cfa < DW_REG_TABLE_SIZE) {
371*0a6a1f1dSLionel Sambuc reg_table->rules[cfa].dw_offset_relevant =
372*0a6a1f1dSLionel Sambuc CFA.dw_offset_relevant;
373*0a6a1f1dSLionel Sambuc reg_table->rules[cfa].dw_regnum = CFA.dw_regnum;
374*0a6a1f1dSLionel Sambuc reg_table->rules[cfa].dw_offset = CFA.dw_offset_or_block_len;
375*0a6a1f1dSLionel Sambuc }
376*0a6a1f1dSLionel Sambuc
377*0a6a1f1dSLionel Sambuc /*
378*0a6a1f1dSLionel Sambuc * Copy other columns.
379*0a6a1f1dSLionel Sambuc */
380*0a6a1f1dSLionel Sambuc for (i = 0; i < DW_REG_TABLE_SIZE && i < dbg->dbg_frame_rule_table_size;
381*0a6a1f1dSLionel Sambuc i++) {
382*0a6a1f1dSLionel Sambuc
383*0a6a1f1dSLionel Sambuc /* Do not overwrite CFA column */
384*0a6a1f1dSLionel Sambuc if (i == cfa)
385*0a6a1f1dSLionel Sambuc continue;
386*0a6a1f1dSLionel Sambuc
387*0a6a1f1dSLionel Sambuc reg_table->rules[i].dw_offset_relevant =
388*0a6a1f1dSLionel Sambuc rt->rt3_rules[i].dw_offset_relevant;
389*0a6a1f1dSLionel Sambuc reg_table->rules[i].dw_regnum = rt->rt3_rules[i].dw_regnum;
390*0a6a1f1dSLionel Sambuc reg_table->rules[i].dw_offset =
391*0a6a1f1dSLionel Sambuc rt->rt3_rules[i].dw_offset_or_block_len;
392*0a6a1f1dSLionel Sambuc }
393*0a6a1f1dSLionel Sambuc
394*0a6a1f1dSLionel Sambuc *row_pc = pc;
395*0a6a1f1dSLionel Sambuc
396*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
397*0a6a1f1dSLionel Sambuc }
398*0a6a1f1dSLionel Sambuc
399*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_info_for_reg3(Dwarf_Fde fde,Dwarf_Half table_column,Dwarf_Addr pc_requested,Dwarf_Small * value_type,Dwarf_Signed * offset_relevant,Dwarf_Signed * register_num,Dwarf_Signed * offset_or_block_len,Dwarf_Ptr * block_ptr,Dwarf_Addr * row_pc,Dwarf_Error * error)400*0a6a1f1dSLionel Sambuc dwarf_get_fde_info_for_reg3(Dwarf_Fde fde, Dwarf_Half table_column,
401*0a6a1f1dSLionel Sambuc Dwarf_Addr pc_requested, Dwarf_Small *value_type,
402*0a6a1f1dSLionel Sambuc Dwarf_Signed *offset_relevant, Dwarf_Signed *register_num,
403*0a6a1f1dSLionel Sambuc Dwarf_Signed *offset_or_block_len, Dwarf_Ptr *block_ptr,
404*0a6a1f1dSLionel Sambuc Dwarf_Addr *row_pc, Dwarf_Error *error)
405*0a6a1f1dSLionel Sambuc {
406*0a6a1f1dSLionel Sambuc Dwarf_Regtable3 *rt;
407*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
408*0a6a1f1dSLionel Sambuc Dwarf_Addr pc;
409*0a6a1f1dSLionel Sambuc int ret;
410*0a6a1f1dSLionel Sambuc
411*0a6a1f1dSLionel Sambuc dbg = fde != NULL ? fde->fde_dbg : NULL;
412*0a6a1f1dSLionel Sambuc
413*0a6a1f1dSLionel Sambuc if (fde == NULL || value_type == NULL || offset_relevant == NULL ||
414*0a6a1f1dSLionel Sambuc register_num == NULL || offset_or_block_len == NULL ||
415*0a6a1f1dSLionel Sambuc block_ptr == NULL || row_pc == NULL) {
416*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
417*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
418*0a6a1f1dSLionel Sambuc }
419*0a6a1f1dSLionel Sambuc
420*0a6a1f1dSLionel Sambuc if (pc_requested < fde->fde_initloc ||
421*0a6a1f1dSLionel Sambuc pc_requested >= fde->fde_initloc + fde->fde_adrange) {
422*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_PC_NOT_IN_FDE_RANGE);
423*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
424*0a6a1f1dSLionel Sambuc }
425*0a6a1f1dSLionel Sambuc
426*0a6a1f1dSLionel Sambuc ret = _dwarf_frame_get_internal_table(fde, pc_requested, &rt, &pc,
427*0a6a1f1dSLionel Sambuc error);
428*0a6a1f1dSLionel Sambuc if (ret != DW_DLE_NONE)
429*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
430*0a6a1f1dSLionel Sambuc
431*0a6a1f1dSLionel Sambuc if (table_column >= dbg->dbg_frame_rule_table_size) {
432*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_FRAME_TABLE_COL_BAD);
433*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
434*0a6a1f1dSLionel Sambuc }
435*0a6a1f1dSLionel Sambuc
436*0a6a1f1dSLionel Sambuc *value_type = RL.dw_value_type;
437*0a6a1f1dSLionel Sambuc *offset_relevant = RL.dw_offset_relevant;
438*0a6a1f1dSLionel Sambuc *register_num = RL.dw_regnum;
439*0a6a1f1dSLionel Sambuc *offset_or_block_len = RL.dw_offset_or_block_len;
440*0a6a1f1dSLionel Sambuc *block_ptr = RL.dw_block_ptr;
441*0a6a1f1dSLionel Sambuc *row_pc = pc;
442*0a6a1f1dSLionel Sambuc
443*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
444*0a6a1f1dSLionel Sambuc }
445*0a6a1f1dSLionel Sambuc
446*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_info_for_cfa_reg3(Dwarf_Fde fde,Dwarf_Addr pc_requested,Dwarf_Small * value_type,Dwarf_Signed * offset_relevant,Dwarf_Signed * register_num,Dwarf_Signed * offset_or_block_len,Dwarf_Ptr * block_ptr,Dwarf_Addr * row_pc,Dwarf_Error * error)447*0a6a1f1dSLionel Sambuc dwarf_get_fde_info_for_cfa_reg3(Dwarf_Fde fde, Dwarf_Addr pc_requested,
448*0a6a1f1dSLionel Sambuc Dwarf_Small *value_type, Dwarf_Signed *offset_relevant,
449*0a6a1f1dSLionel Sambuc Dwarf_Signed *register_num, Dwarf_Signed *offset_or_block_len,
450*0a6a1f1dSLionel Sambuc Dwarf_Ptr *block_ptr, Dwarf_Addr *row_pc, Dwarf_Error *error)
451*0a6a1f1dSLionel Sambuc {
452*0a6a1f1dSLionel Sambuc Dwarf_Regtable3 *rt;
453*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
454*0a6a1f1dSLionel Sambuc Dwarf_Addr pc;
455*0a6a1f1dSLionel Sambuc int ret;
456*0a6a1f1dSLionel Sambuc
457*0a6a1f1dSLionel Sambuc dbg = fde != NULL ? fde->fde_dbg : NULL;
458*0a6a1f1dSLionel Sambuc
459*0a6a1f1dSLionel Sambuc if (fde == NULL || value_type == NULL || offset_relevant == NULL ||
460*0a6a1f1dSLionel Sambuc register_num == NULL || offset_or_block_len == NULL ||
461*0a6a1f1dSLionel Sambuc block_ptr == NULL || row_pc == NULL) {
462*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
463*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
464*0a6a1f1dSLionel Sambuc }
465*0a6a1f1dSLionel Sambuc
466*0a6a1f1dSLionel Sambuc if (pc_requested < fde->fde_initloc ||
467*0a6a1f1dSLionel Sambuc pc_requested >= fde->fde_initloc + fde->fde_adrange) {
468*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_PC_NOT_IN_FDE_RANGE);
469*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
470*0a6a1f1dSLionel Sambuc }
471*0a6a1f1dSLionel Sambuc
472*0a6a1f1dSLionel Sambuc ret = _dwarf_frame_get_internal_table(fde, pc_requested, &rt, &pc,
473*0a6a1f1dSLionel Sambuc error);
474*0a6a1f1dSLionel Sambuc if (ret != DW_DLE_NONE)
475*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
476*0a6a1f1dSLionel Sambuc
477*0a6a1f1dSLionel Sambuc *value_type = CFA.dw_value_type;
478*0a6a1f1dSLionel Sambuc *offset_relevant = CFA.dw_offset_relevant;
479*0a6a1f1dSLionel Sambuc *register_num = CFA.dw_regnum;
480*0a6a1f1dSLionel Sambuc *offset_or_block_len = CFA.dw_offset_or_block_len;
481*0a6a1f1dSLionel Sambuc *block_ptr = CFA.dw_block_ptr;
482*0a6a1f1dSLionel Sambuc *row_pc = pc;
483*0a6a1f1dSLionel Sambuc
484*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
485*0a6a1f1dSLionel Sambuc }
486*0a6a1f1dSLionel Sambuc
487*0a6a1f1dSLionel Sambuc #undef RL
488*0a6a1f1dSLionel Sambuc #undef CFA
489*0a6a1f1dSLionel Sambuc
490*0a6a1f1dSLionel Sambuc int
dwarf_get_fde_info_for_all_regs3(Dwarf_Fde fde,Dwarf_Addr pc_requested,Dwarf_Regtable3 * reg_table,Dwarf_Addr * row_pc,Dwarf_Error * error)491*0a6a1f1dSLionel Sambuc dwarf_get_fde_info_for_all_regs3(Dwarf_Fde fde, Dwarf_Addr pc_requested,
492*0a6a1f1dSLionel Sambuc Dwarf_Regtable3 *reg_table, Dwarf_Addr *row_pc, Dwarf_Error *error)
493*0a6a1f1dSLionel Sambuc {
494*0a6a1f1dSLionel Sambuc Dwarf_Regtable3 *rt;
495*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
496*0a6a1f1dSLionel Sambuc Dwarf_Addr pc;
497*0a6a1f1dSLionel Sambuc int ret;
498*0a6a1f1dSLionel Sambuc
499*0a6a1f1dSLionel Sambuc dbg = fde != NULL ? fde->fde_dbg : NULL;
500*0a6a1f1dSLionel Sambuc
501*0a6a1f1dSLionel Sambuc if (fde == NULL || reg_table == NULL || reg_table->rt3_rules == NULL ||
502*0a6a1f1dSLionel Sambuc row_pc == NULL) {
503*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
504*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
505*0a6a1f1dSLionel Sambuc }
506*0a6a1f1dSLionel Sambuc
507*0a6a1f1dSLionel Sambuc assert(dbg != NULL);
508*0a6a1f1dSLionel Sambuc
509*0a6a1f1dSLionel Sambuc if (pc_requested < fde->fde_initloc ||
510*0a6a1f1dSLionel Sambuc pc_requested >= fde->fde_initloc + fde->fde_adrange) {
511*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_PC_NOT_IN_FDE_RANGE);
512*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
513*0a6a1f1dSLionel Sambuc }
514*0a6a1f1dSLionel Sambuc
515*0a6a1f1dSLionel Sambuc ret = _dwarf_frame_get_internal_table(fde, pc_requested, &rt, &pc,
516*0a6a1f1dSLionel Sambuc error);
517*0a6a1f1dSLionel Sambuc if (ret != DW_DLE_NONE)
518*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
519*0a6a1f1dSLionel Sambuc
520*0a6a1f1dSLionel Sambuc ret = _dwarf_frame_regtable_copy(dbg, ®_table, rt, error);
521*0a6a1f1dSLionel Sambuc if (ret != DW_DLE_NONE)
522*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
523*0a6a1f1dSLionel Sambuc
524*0a6a1f1dSLionel Sambuc *row_pc = pc;
525*0a6a1f1dSLionel Sambuc
526*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
527*0a6a1f1dSLionel Sambuc }
528*0a6a1f1dSLionel Sambuc
529*0a6a1f1dSLionel Sambuc int
dwarf_expand_frame_instructions(Dwarf_Cie cie,Dwarf_Ptr instruction,Dwarf_Unsigned len,Dwarf_Frame_Op ** ret_oplist,Dwarf_Signed * ret_opcnt,Dwarf_Error * error)530*0a6a1f1dSLionel Sambuc dwarf_expand_frame_instructions(Dwarf_Cie cie, Dwarf_Ptr instruction,
531*0a6a1f1dSLionel Sambuc Dwarf_Unsigned len, Dwarf_Frame_Op **ret_oplist, Dwarf_Signed *ret_opcnt,
532*0a6a1f1dSLionel Sambuc Dwarf_Error *error)
533*0a6a1f1dSLionel Sambuc {
534*0a6a1f1dSLionel Sambuc Dwarf_Debug dbg;
535*0a6a1f1dSLionel Sambuc int ret;
536*0a6a1f1dSLionel Sambuc
537*0a6a1f1dSLionel Sambuc dbg = cie != NULL ? cie->cie_dbg : NULL;
538*0a6a1f1dSLionel Sambuc
539*0a6a1f1dSLionel Sambuc if (cie == NULL || instruction == NULL || len == 0 ||
540*0a6a1f1dSLionel Sambuc ret_oplist == NULL || ret_opcnt == NULL) {
541*0a6a1f1dSLionel Sambuc DWARF_SET_ERROR(dbg, error, DW_DLE_ARGUMENT);
542*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
543*0a6a1f1dSLionel Sambuc }
544*0a6a1f1dSLionel Sambuc
545*0a6a1f1dSLionel Sambuc ret = _dwarf_frame_get_fop(dbg, instruction, len, ret_oplist, ret_opcnt,
546*0a6a1f1dSLionel Sambuc error);
547*0a6a1f1dSLionel Sambuc if (ret != DW_DLE_NONE)
548*0a6a1f1dSLionel Sambuc return (DW_DLV_ERROR);
549*0a6a1f1dSLionel Sambuc
550*0a6a1f1dSLionel Sambuc return (DW_DLV_OK);
551*0a6a1f1dSLionel Sambuc }
552*0a6a1f1dSLionel Sambuc
553*0a6a1f1dSLionel Sambuc Dwarf_Half
dwarf_set_frame_rule_table_size(Dwarf_Debug dbg,Dwarf_Half value)554*0a6a1f1dSLionel Sambuc dwarf_set_frame_rule_table_size(Dwarf_Debug dbg, Dwarf_Half value)
555*0a6a1f1dSLionel Sambuc {
556*0a6a1f1dSLionel Sambuc Dwarf_Half old_value;
557*0a6a1f1dSLionel Sambuc
558*0a6a1f1dSLionel Sambuc old_value = dbg->dbg_frame_rule_table_size;
559*0a6a1f1dSLionel Sambuc dbg->dbg_frame_rule_table_size = value;
560*0a6a1f1dSLionel Sambuc
561*0a6a1f1dSLionel Sambuc return (old_value);
562*0a6a1f1dSLionel Sambuc }
563*0a6a1f1dSLionel Sambuc
564*0a6a1f1dSLionel Sambuc Dwarf_Half
dwarf_set_frame_rule_initial_value(Dwarf_Debug dbg,Dwarf_Half value)565*0a6a1f1dSLionel Sambuc dwarf_set_frame_rule_initial_value(Dwarf_Debug dbg, Dwarf_Half value)
566*0a6a1f1dSLionel Sambuc {
567*0a6a1f1dSLionel Sambuc Dwarf_Half old_value;
568*0a6a1f1dSLionel Sambuc
569*0a6a1f1dSLionel Sambuc old_value = dbg->dbg_frame_rule_initial_value;
570*0a6a1f1dSLionel Sambuc dbg->dbg_frame_rule_initial_value = value;
571*0a6a1f1dSLionel Sambuc
572*0a6a1f1dSLionel Sambuc return (old_value);
573*0a6a1f1dSLionel Sambuc }
574*0a6a1f1dSLionel Sambuc
575*0a6a1f1dSLionel Sambuc Dwarf_Half
dwarf_set_frame_cfa_value(Dwarf_Debug dbg,Dwarf_Half value)576*0a6a1f1dSLionel Sambuc dwarf_set_frame_cfa_value(Dwarf_Debug dbg, Dwarf_Half value)
577*0a6a1f1dSLionel Sambuc {
578*0a6a1f1dSLionel Sambuc Dwarf_Half old_value;
579*0a6a1f1dSLionel Sambuc
580*0a6a1f1dSLionel Sambuc old_value = dbg->dbg_frame_cfa_value;
581*0a6a1f1dSLionel Sambuc dbg->dbg_frame_cfa_value = value;
582*0a6a1f1dSLionel Sambuc
583*0a6a1f1dSLionel Sambuc return (old_value);
584*0a6a1f1dSLionel Sambuc }
585*0a6a1f1dSLionel Sambuc
586*0a6a1f1dSLionel Sambuc Dwarf_Half
dwarf_set_frame_same_value(Dwarf_Debug dbg,Dwarf_Half value)587*0a6a1f1dSLionel Sambuc dwarf_set_frame_same_value(Dwarf_Debug dbg, Dwarf_Half value)
588*0a6a1f1dSLionel Sambuc {
589*0a6a1f1dSLionel Sambuc Dwarf_Half old_value;
590*0a6a1f1dSLionel Sambuc
591*0a6a1f1dSLionel Sambuc old_value = dbg->dbg_frame_same_value;
592*0a6a1f1dSLionel Sambuc dbg->dbg_frame_same_value = value;
593*0a6a1f1dSLionel Sambuc
594*0a6a1f1dSLionel Sambuc return (old_value);
595*0a6a1f1dSLionel Sambuc }
596*0a6a1f1dSLionel Sambuc
597*0a6a1f1dSLionel Sambuc Dwarf_Half
dwarf_set_frame_undefined_value(Dwarf_Debug dbg,Dwarf_Half value)598*0a6a1f1dSLionel Sambuc dwarf_set_frame_undefined_value(Dwarf_Debug dbg, Dwarf_Half value)
599*0a6a1f1dSLionel Sambuc {
600*0a6a1f1dSLionel Sambuc Dwarf_Half old_value;
601*0a6a1f1dSLionel Sambuc
602*0a6a1f1dSLionel Sambuc old_value = dbg->dbg_frame_undefined_value;
603*0a6a1f1dSLionel Sambuc dbg->dbg_frame_undefined_value = value;
604*0a6a1f1dSLionel Sambuc
605*0a6a1f1dSLionel Sambuc return (old_value);
606*0a6a1f1dSLionel Sambuc }
607