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