| 3566 | VEC. Returns 1 on success, 0 on error. */ |
| 3567 | |
| 3568 | static int |
| 3569 | read_function_entry (struct backtrace_state *state, struct dwarf_data *ddata, |
| 3570 | struct unit *u, uintptr_t base, struct dwarf_buf *unit_buf, |
| 3571 | const struct line_header *lhdr, |
| 3572 | backtrace_error_callback error_callback, void *data, |
| 3573 | struct function_vector *vec_function, |
| 3574 | struct function_vector *vec_inlined) |
| 3575 | { |
| 3576 | while (unit_buf->left > 0) |
| 3577 | { |
| 3578 | uint64_t code; |
| 3579 | const struct abbrev *abbrev; |
| 3580 | int is_function; |
| 3581 | struct function *function; |
| 3582 | struct function_vector *vec; |
| 3583 | size_t i; |
| 3584 | struct pcrange pcrange; |
| 3585 | int have_linkage_name; |
| 3586 | |
| 3587 | code = read_uleb128 (unit_buf); |
| 3588 | if (code == 0) |
| 3589 | return 1; |
| 3590 | |
| 3591 | abbrev = lookup_abbrev (&u->abbrevs, code, error_callback, data); |
| 3592 | if (abbrev == NULL) |
| 3593 | return 0; |
| 3594 | |
| 3595 | is_function = (abbrev->tag == DW_TAG_subprogram |
| 3596 | || abbrev->tag == DW_TAG_entry_point |
| 3597 | || abbrev->tag == DW_TAG_inlined_subroutine); |
| 3598 | |
| 3599 | if (abbrev->tag == DW_TAG_inlined_subroutine) |
| 3600 | vec = vec_inlined; |
| 3601 | else |
| 3602 | vec = vec_function; |
| 3603 | |
| 3604 | function = NULL; |
| 3605 | if (is_function) |
| 3606 | { |
| 3607 | function = ((struct function *) |
| 3608 | backtrace_alloc (state, sizeof *function, |
| 3609 | error_callback, data)); |
| 3610 | if (function == NULL) |
| 3611 | return 0; |
| 3612 | memset (function, 0, sizeof *function); |
| 3613 | } |
| 3614 | |
| 3615 | memset (&pcrange, 0, sizeof pcrange); |
| 3616 | have_linkage_name = 0; |
| 3617 | for (i = 0; i < abbrev->num_attrs; ++i) |
| 3618 | { |
| 3619 | struct attr_val val; |
| 3620 | |
| 3621 | if (!read_attribute (abbrev->attrs[i].form, abbrev->attrs[i].val, |
| 3622 | unit_buf, u->is_dwarf64, u->version, |
| 3623 | u->addrsize, &ddata->dwarf_sections, |
| 3624 | ddata->altlink, &val)) |
| 3625 | return 0; |
no test coverage detected