Lines Matching refs:result
74 scn_dwarf_type (Dwarf *result, size_t shstrndx, Elf_Scn *scn) in scn_dwarf_type() argument
81 const char *scnname = elf_strptr (result->elf, shstrndx, in scn_dwarf_type()
99 check_section (Dwarf *result, size_t shstrndx, Elf_Scn *scn, bool inscngrp) in check_section() argument
115 return result; in check_section()
124 return result; in check_section()
129 const char *scnname = elf_strptr (result->elf, shstrndx, in check_section()
136 Dwarf_Sig8_Hash_free (&result->sig8_hash); in check_section()
138 free (result); in check_section()
160 if (result->type == TYPE_PLAIN) in check_section()
163 else if (result->type == TYPE_DWO) in check_section()
176 if (result->type == TYPE_PLAIN) in check_section()
182 else if (result->type <= TYPE_DWO) in check_section()
192 if (result->type == TYPE_GNU_LTO) in check_section()
199 return result; in check_section()
201 if (unlikely (result->sectiondata[cnt] != NULL)) in check_section()
203 return result; in check_section()
217 return result; in check_section()
228 return result; in check_section()
231 result->sectiondata[cnt] = data; in check_section()
233 return result; in check_section()
259 valid_p (Dwarf *result) in valid_p() argument
265 if (likely (result != NULL) in valid_p()
266 && unlikely (result->sectiondata[IDX_debug_info] == NULL in valid_p()
267 && result->sectiondata[IDX_debug_line] == NULL in valid_p()
268 && result->sectiondata[IDX_debug_frame] == NULL)) in valid_p()
270 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
272 free (result); in valid_p()
273 result = NULL; in valid_p()
279 if (result != NULL) in valid_p()
282 if (gelf_getehdr (result->elf, &ehdr) == NULL) in valid_p()
284 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
286 free (result); in valid_p()
287 result = NULL; in valid_p()
296 if (result != NULL && result->sectiondata[IDX_debug_loc] != NULL) in valid_p()
298 result->fake_loc_cu = malloc (sizeof (Dwarf_CU)); in valid_p()
299 if (unlikely (result->fake_loc_cu == NULL)) in valid_p()
301 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
303 free (result); in valid_p()
304 result = NULL; in valid_p()
308 result->fake_loc_cu->sec_idx = IDX_debug_loc; in valid_p()
309 result->fake_loc_cu->dbg = result; in valid_p()
310 result->fake_loc_cu->startp in valid_p()
311 = result->sectiondata[IDX_debug_loc]->d_buf; in valid_p()
312 result->fake_loc_cu->endp in valid_p()
313 = (result->sectiondata[IDX_debug_loc]->d_buf in valid_p()
314 + result->sectiondata[IDX_debug_loc]->d_size); in valid_p()
315 result->fake_loc_cu->locs = NULL; in valid_p()
316 result->fake_loc_cu->address_size = elf_addr_size; in valid_p()
317 result->fake_loc_cu->offset_size = 4; in valid_p()
318 result->fake_loc_cu->version = 4; in valid_p()
319 result->fake_loc_cu->split = NULL; in valid_p()
323 if (result != NULL && result->sectiondata[IDX_debug_loclists] != NULL) in valid_p()
325 result->fake_loclists_cu = malloc (sizeof (Dwarf_CU)); in valid_p()
326 if (unlikely (result->fake_loclists_cu == NULL)) in valid_p()
328 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
330 free (result->fake_loc_cu); in valid_p()
331 free (result); in valid_p()
332 result = NULL; in valid_p()
336 result->fake_loclists_cu->sec_idx = IDX_debug_loclists; in valid_p()
337 result->fake_loclists_cu->dbg = result; in valid_p()
338 result->fake_loclists_cu->startp in valid_p()
339 = result->sectiondata[IDX_debug_loclists]->d_buf; in valid_p()
340 result->fake_loclists_cu->endp in valid_p()
341 = (result->sectiondata[IDX_debug_loclists]->d_buf in valid_p()
342 + result->sectiondata[IDX_debug_loclists]->d_size); in valid_p()
343 result->fake_loclists_cu->locs = NULL; in valid_p()
344 result->fake_loclists_cu->address_size = elf_addr_size; in valid_p()
345 result->fake_loclists_cu->offset_size = 4; in valid_p()
346 result->fake_loclists_cu->version = 5; in valid_p()
347 result->fake_loclists_cu->split = NULL; in valid_p()
355 if (result != NULL && result->sectiondata[IDX_debug_addr] != NULL) in valid_p()
357 result->fake_addr_cu = malloc (sizeof (Dwarf_CU)); in valid_p()
358 if (unlikely (result->fake_addr_cu == NULL)) in valid_p()
360 Dwarf_Sig8_Hash_free (&result->sig8_hash); in valid_p()
362 free (result->fake_loc_cu); in valid_p()
363 free (result->fake_loclists_cu); in valid_p()
364 free (result); in valid_p()
365 result = NULL; in valid_p()
369 result->fake_addr_cu->sec_idx = IDX_debug_addr; in valid_p()
370 result->fake_addr_cu->dbg = result; in valid_p()
371 result->fake_addr_cu->startp in valid_p()
372 = result->sectiondata[IDX_debug_addr]->d_buf; in valid_p()
373 result->fake_addr_cu->endp in valid_p()
374 = (result->sectiondata[IDX_debug_addr]->d_buf in valid_p()
375 + result->sectiondata[IDX_debug_addr]->d_size); in valid_p()
376 result->fake_addr_cu->locs = NULL; in valid_p()
377 result->fake_addr_cu->address_size = elf_addr_size; in valid_p()
378 result->fake_addr_cu->offset_size = 4; in valid_p()
379 result->fake_addr_cu->version = 5; in valid_p()
380 result->fake_addr_cu->split = NULL; in valid_p()
384 if (result != NULL) in valid_p()
385 result->debugdir = __libdw_debugdir (result->elf->fildes); in valid_p()
387 return result; in valid_p()
392 global_read (Dwarf *result, Elf *elf, size_t shstrndx) in global_read() argument
398 while ((scn = elf_nextscn (elf, scn)) != NULL && result->type != TYPE_PLAIN) in global_read()
400 enum dwarf_type type = scn_dwarf_type (result, shstrndx, scn); in global_read()
401 if (type > result->type) in global_read()
402 result->type = type; in global_read()
406 while (result != NULL && (scn = elf_nextscn (elf, scn)) != NULL) in global_read()
407 result = check_section (result, shstrndx, scn, false); in global_read()
409 return valid_p (result); in global_read()
414 scngrp_read (Dwarf *result, Elf *elf, size_t shstrndx, Elf_Scn *scngrp) in scngrp_read() argument
420 Dwarf_Sig8_Hash_free (&result->sig8_hash); in scngrp_read()
422 free (result); in scngrp_read()
429 Dwarf_Sig8_Hash_free (&result->sig8_hash); in scngrp_read()
431 free (result); in scngrp_read()
441 Dwarf_Sig8_Hash_free (&result->sig8_hash); in scngrp_read()
442 free (result); in scngrp_read()
460 Dwarf_Sig8_Hash_free (&result->sig8_hash); in scngrp_read()
462 free (result); in scngrp_read()
466 enum dwarf_type type = scn_dwarf_type (result, shstrndx, scn); in scngrp_read()
467 if (type > result->type) in scngrp_read()
468 result->type = type; in scngrp_read()
471 for (cnt = 1; cnt * sizeof (Elf32_Word) <= data->d_size && result != NULL; ++cnt) in scngrp_read()
475 result = check_section (result, shstrndx, scn, true); in scngrp_read()
476 if (result == NULL) in scngrp_read()
480 return valid_p (result); in scngrp_read()
509 Dwarf *result = calloc (1, sizeof (Dwarf)); in dwarf_begin_elf() local
510 if (unlikely (result == NULL) in dwarf_begin_elf()
511 || unlikely (Dwarf_Sig8_Hash_init (&result->sig8_hash, 11) < 0)) in dwarf_begin_elf()
513 free (result); in dwarf_begin_elf()
521 result->other_byte_order = true; in dwarf_begin_elf()
523 result->elf = elf; in dwarf_begin_elf()
524 result->alt_fd = -1; in dwarf_begin_elf()
528 result->mem_default_size = mem_default_size; in dwarf_begin_elf()
529 result->oom_handler = __libdw_oom; in dwarf_begin_elf()
530 if (pthread_rwlock_init(&result->mem_rwl, NULL) != 0) in dwarf_begin_elf()
532 free (result); in dwarf_begin_elf()
536 result->mem_stacks = 0; in dwarf_begin_elf()
537 result->mem_tails = NULL; in dwarf_begin_elf()
546 Dwarf_Sig8_Hash_free (&result->sig8_hash); in dwarf_begin_elf()
548 free (result); in dwarf_begin_elf()
558 return global_read (result, elf, shstrndx); in dwarf_begin_elf()
560 return scngrp_read (result, elf, shstrndx, scngrp); in dwarf_begin_elf()
564 Dwarf_Sig8_Hash_free (&result->sig8_hash); in dwarf_begin_elf()
566 free (result); in dwarf_begin_elf()
570 Dwarf_Sig8_Hash_free (&result->sig8_hash); in dwarf_begin_elf()
572 free (result); in dwarf_begin_elf()