Lines Matching refs:result
74 check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp) in check_section() argument
90 return result; in check_section()
99 return result; in check_section()
104 const char *scnname = elf_strptr (result->elf, shstrndx, in check_section()
111 Dwarf_Sig8_Hash_free (&result->sig8_hash); in check_section()
113 free (result); in check_section()
148 return result; in check_section()
150 if (unlikely (result->sectiondata[cnt] != NULL)) in check_section()
152 return result; in check_section()
166 return result; in check_section()
177 return result; in check_section()
180 result->sectiondata[cnt] = data; in check_section()
182 return result; in check_section()
208 valid_p (Dwarf *result) in valid_p() argument
214 if (likely (result != NULL) in valid_p()
215 && unlikely (result->sectiondata[IDX_debug_info] == NULL in valid_p()
216 && result->sectiondata[IDX_debug_line] == NULL in valid_p()
217 && result->sectiondata[IDX_debug_frame] == NULL)) in valid_p()
219 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
221 free (result); in valid_p()
222 result = NULL; in valid_p()
228 if (result != NULL && result->sectiondata[IDX_debug_loc] != NULL) in valid_p()
230 result->fake_loc_cu = (Dwarf_CU *) malloc (sizeof (Dwarf_CU)); in valid_p()
231 if (unlikely (result->fake_loc_cu == NULL)) in valid_p()
233 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
235 free (result); in valid_p()
236 result = NULL; in valid_p()
240 result->fake_loc_cu->sec_idx = IDX_debug_loc; in valid_p()
241 result->fake_loc_cu->dbg = result; in valid_p()
242 result->fake_loc_cu->startp in valid_p()
243 = result->sectiondata[IDX_debug_loc]->d_buf; in valid_p()
244 result->fake_loc_cu->endp in valid_p()
245 = (result->sectiondata[IDX_debug_loc]->d_buf in valid_p()
246 + result->sectiondata[IDX_debug_loc]->d_size); in valid_p()
247 result->fake_loc_cu->locs = NULL; in valid_p()
248 result->fake_loc_cu->address_size = 0; in valid_p()
249 result->fake_loc_cu->version = 0; in valid_p()
250 result->fake_loc_cu->split = NULL; in valid_p()
254 if (result != NULL && result->sectiondata[IDX_debug_loclists] != NULL) in valid_p()
256 result->fake_loclists_cu = (Dwarf_CU *) malloc (sizeof (Dwarf_CU)); in valid_p()
257 if (unlikely (result->fake_loclists_cu == NULL)) in valid_p()
259 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
261 free (result->fake_loc_cu); in valid_p()
262 free (result); in valid_p()
263 result = NULL; in valid_p()
267 result->fake_loclists_cu->sec_idx = IDX_debug_loclists; in valid_p()
268 result->fake_loclists_cu->dbg = result; in valid_p()
269 result->fake_loclists_cu->startp in valid_p()
270 = result->sectiondata[IDX_debug_loclists]->d_buf; in valid_p()
271 result->fake_loclists_cu->endp in valid_p()
272 = (result->sectiondata[IDX_debug_loclists]->d_buf in valid_p()
273 + result->sectiondata[IDX_debug_loclists]->d_size); in valid_p()
274 result->fake_loclists_cu->locs = NULL; in valid_p()
275 result->fake_loclists_cu->address_size = 0; in valid_p()
276 result->fake_loclists_cu->version = 0; in valid_p()
277 result->fake_loclists_cu->split = NULL; in valid_p()
285 if (result != NULL && result->sectiondata[IDX_debug_addr] != NULL) in valid_p()
287 result->fake_addr_cu = (Dwarf_CU *) malloc (sizeof (Dwarf_CU)); in valid_p()
288 if (unlikely (result->fake_addr_cu == NULL)) in valid_p()
290 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
292 free (result->fake_loc_cu); in valid_p()
293 free (result->fake_loclists_cu); in valid_p()
294 free (result); in valid_p()
295 result = NULL; in valid_p()
299 result->fake_addr_cu->sec_idx = IDX_debug_addr; in valid_p()
300 result->fake_addr_cu->dbg = result; in valid_p()
301 result->fake_addr_cu->startp in valid_p()
302 = result->sectiondata[IDX_debug_addr]->d_buf; in valid_p()
303 result->fake_addr_cu->endp in valid_p()
304 = (result->sectiondata[IDX_debug_addr]->d_buf in valid_p()
305 + result->sectiondata[IDX_debug_addr]->d_size); in valid_p()
306 result->fake_addr_cu->locs = NULL; in valid_p()
307 result->fake_addr_cu->address_size = 0; in valid_p()
308 result->fake_addr_cu->version = 0; in valid_p()
309 result->fake_addr_cu->split = NULL; in valid_p()
313 if (result != NULL) in valid_p()
314 result->debugdir = __libdw_debugdir (result->elf->fildes); in valid_p()
316 return result; in valid_p()
321 global_read (Dwarf *result, Elf *elf, size_t shstrndx) in global_read() argument
325 while (result != NULL && (scn = elf_nextscn (elf, scn)) != NULL) in global_read()
326 result = check_section (result, shstrndx, scn, false); in global_read()
328 return valid_p (result); in global_read()
333 scngrp_read (Dwarf *result, Elf *elf, size_t shstrndx, Elf_Scn *scngrp) in scngrp_read() argument
339 Dwarf_Sig8_Hash_free (&result->sig8_hash); in scngrp_read()
341 free (result); in scngrp_read()
348 Dwarf_Sig8_Hash_free (&result->sig8_hash); in scngrp_read()
350 free (result); in scngrp_read()
360 Dwarf_Sig8_Hash_free (&result->sig8_hash); in scngrp_read()
361 free (result); in scngrp_read()
376 Dwarf_Sig8_Hash_free (&result->sig8_hash); in scngrp_read()
378 free (result); in scngrp_read()
382 result = check_section (result, shstrndx, scn, true); in scngrp_read()
383 if (result == NULL) in scngrp_read()
387 return valid_p (result); in scngrp_read()
416 Dwarf *result = (Dwarf *) calloc (1, sizeof (Dwarf)); in dwarf_begin_elf() local
417 if (unlikely (result == NULL) in dwarf_begin_elf()
418 || unlikely (Dwarf_Sig8_Hash_init (&result->sig8_hash, 11) < 0)) in dwarf_begin_elf()
420 free (result); in dwarf_begin_elf()
428 result->other_byte_order = true; in dwarf_begin_elf()
430 result->elf = elf; in dwarf_begin_elf()
431 result->alt_fd = -1; in dwarf_begin_elf()
435 result->mem_default_size = mem_default_size; in dwarf_begin_elf()
436 result->oom_handler = __libdw_oom; in dwarf_begin_elf()
437 if (pthread_rwlock_init(&result->mem_rwl, NULL) != 0) in dwarf_begin_elf()
439 free (result); in dwarf_begin_elf()
443 result->mem_stacks = 0; in dwarf_begin_elf()
444 result->mem_tails = NULL; in dwarf_begin_elf()
453 Dwarf_Sig8_Hash_free (&result->sig8_hash); in dwarf_begin_elf()
455 free (result); in dwarf_begin_elf()
465 return global_read (result, elf, shstrndx); in dwarf_begin_elf()
467 return scngrp_read (result, elf, shstrndx, scngrp); in dwarf_begin_elf()
471 Dwarf_Sig8_Hash_free (&result->sig8_hash); in dwarf_begin_elf()
473 free (result); in dwarf_begin_elf()
477 Dwarf_Sig8_Hash_free (&result->sig8_hash); in dwarf_begin_elf()
479 free (result); in dwarf_begin_elf()