libdwarf_sections.c (6cec9cad762b6476313fb1f8e931a1647822db6b) libdwarf_sections.c (cf781b2e16c26535788abe648f5917f4db09c123)
1/*-
2 * Copyright (c) 2010 Kai Wang
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include "_libdwarf.h"
28
1/*-
2 * Copyright (c) 2010 Kai Wang
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include "_libdwarf.h"
28
29ELFTC_VCSID("$Id: libdwarf_sections.c 2379 2012-01-05 02:08:20Z jkoshy $");
29ELFTC_VCSID("$Id: libdwarf_sections.c 3041 2014-05-18 15:11:03Z kaiwang27 $");
30
31#define _SECTION_INIT_SIZE 128
32
33int
34_dwarf_section_init(Dwarf_P_Debug dbg, Dwarf_P_Section *dsp, const char *name,
35 int pseudo, Dwarf_Error *error)
36{
37 Dwarf_P_Section ds;

--- 169 unchanged lines hidden (view full) ---

207}
208
209Dwarf_Section *
210_dwarf_find_section(Dwarf_Debug dbg, const char *name)
211{
212 Dwarf_Section *ds;
213 Dwarf_Half i;
214
30
31#define _SECTION_INIT_SIZE 128
32
33int
34_dwarf_section_init(Dwarf_P_Debug dbg, Dwarf_P_Section *dsp, const char *name,
35 int pseudo, Dwarf_Error *error)
36{
37 Dwarf_P_Section ds;

--- 169 unchanged lines hidden (view full) ---

207}
208
209Dwarf_Section *
210_dwarf_find_section(Dwarf_Debug dbg, const char *name)
211{
212 Dwarf_Section *ds;
213 Dwarf_Half i;
214
215 assert(name != NULL);
215 assert(dbg != NULL && name != NULL);
216
217 for (i = 0; i < dbg->dbg_seccnt; i++) {
218 ds = &dbg->dbg_section[i];
219 if (ds->ds_name != NULL && !strcmp(ds->ds_name, name))
220 return (ds);
221 }
222
223 return (NULL);
224}
225
216
217 for (i = 0; i < dbg->dbg_seccnt; i++) {
218 ds = &dbg->dbg_section[i];
219 if (ds->ds_name != NULL && !strcmp(ds->ds_name, name))
220 return (ds);
221 }
222
223 return (NULL);
224}
225
226Dwarf_Section *
227_dwarf_find_next_types_section(Dwarf_Debug dbg, Dwarf_Section *ds)
228{
229
230 assert(dbg != NULL);
231
232 if (ds == NULL)
233 return (_dwarf_find_section(dbg, ".debug_types"));
234
235 assert(ds->ds_name != NULL);
236
237 do {
238 ds++;
239 if (ds->ds_name != NULL &&
240 !strcmp(ds->ds_name, ".debug_types"))
241 return (ds);
242 } while (ds->ds_name != NULL);
243
244 return (NULL);
245}
246
226Dwarf_P_Section
227_dwarf_pro_find_section(Dwarf_P_Debug dbg, const char *name)
228{
229 Dwarf_P_Section ds;
230
231 assert(dbg != NULL && name != NULL);
232
233 STAILQ_FOREACH(ds, &dbg->dbgp_seclist, ds_next) {

--- 26 unchanged lines hidden ---
247Dwarf_P_Section
248_dwarf_pro_find_section(Dwarf_P_Debug dbg, const char *name)
249{
250 Dwarf_P_Section ds;
251
252 assert(dbg != NULL && name != NULL);
253
254 STAILQ_FOREACH(ds, &dbg->dbgp_seclist, ds_next) {

--- 26 unchanged lines hidden ---