Lines Matching refs:sheaders
166 struct xc_core_section_headers *sheaders; in xc_core_shdr_init() local
167 sheaders = malloc(sizeof(*sheaders)); in xc_core_shdr_init()
168 if ( sheaders == NULL ) in xc_core_shdr_init()
171 sheaders->num = 0; in xc_core_shdr_init()
172 sheaders->num_max = SHDR_INIT; in xc_core_shdr_init()
173 sheaders->shdrs = malloc(sizeof(sheaders->shdrs[0]) * sheaders->num_max); in xc_core_shdr_init()
174 if ( sheaders->shdrs == NULL ) in xc_core_shdr_init()
176 free(sheaders); in xc_core_shdr_init()
179 return sheaders; in xc_core_shdr_init()
183 xc_core_shdr_free(struct xc_core_section_headers *sheaders) in xc_core_shdr_free() argument
185 free(sheaders->shdrs); in xc_core_shdr_free()
186 free(sheaders); in xc_core_shdr_free()
191 struct xc_core_section_headers *sheaders) in xc_core_shdr_get() argument
195 if ( sheaders->num == sheaders->num_max ) in xc_core_shdr_get()
198 if ( sheaders->num_max > UINT16_MAX - SHDR_INC ) in xc_core_shdr_get()
203 sheaders->num_max += SHDR_INC; in xc_core_shdr_get()
204 shdrs = realloc(sheaders->shdrs, in xc_core_shdr_get()
205 sizeof(sheaders->shdrs[0]) * sheaders->num_max); in xc_core_shdr_get()
208 sheaders->shdrs = shdrs; in xc_core_shdr_get()
211 shdr = &sheaders->shdrs[sheaders->num]; in xc_core_shdr_get()
212 sheaders->num++; in xc_core_shdr_get()
459 struct xc_core_section_headers *sheaders = NULL; in xc_domain_dumpcore_via_callback() local
572 sheaders = xc_core_shdr_init(xch); in xc_domain_dumpcore_via_callback()
573 if ( sheaders == NULL ) in xc_domain_dumpcore_via_callback()
579 shdr = xc_core_shdr_get(xch,sheaders); in xc_domain_dumpcore_via_callback()
587 shdr = xc_core_shdr_get(xch,sheaders); in xc_domain_dumpcore_via_callback()
593 strtab_idx = shdr - sheaders->shdrs; in xc_domain_dumpcore_via_callback()
609 shdr = xc_core_shdr_get(xch,sheaders); in xc_domain_dumpcore_via_callback()
622 shdr = xc_core_shdr_get(xch,sheaders); in xc_domain_dumpcore_via_callback()
637 sts = xc_core_arch_context_get_shdr(xch, &arch_ctxt, sheaders, strtab, in xc_domain_dumpcore_via_callback()
646 shdr = xc_core_shdr_get(xch,sheaders); in xc_domain_dumpcore_via_callback()
666 fixup = (sheaders->num + 2) * sizeof(*shdr); in xc_domain_dumpcore_via_callback()
668 for ( i = 1; i < sheaders->num; i++ ) in xc_domain_dumpcore_via_callback()
669 sheaders->shdrs[i].sh_offset += fixup; in xc_domain_dumpcore_via_callback()
675 shdr = xc_core_shdr_get(xch,sheaders); in xc_domain_dumpcore_via_callback()
689 shdr = xc_core_shdr_get(xch,sheaders); in xc_domain_dumpcore_via_callback()
717 sheaders->shdrs[strtab_idx].sh_offset = offset; in xc_domain_dumpcore_via_callback()
718 sheaders->shdrs[strtab_idx].sh_size = filesz; in xc_domain_dumpcore_via_callback()
721 ehdr.e_shnum = sheaders->num; in xc_domain_dumpcore_via_callback()
729 sts = dump_rtn(xch, args, (char*)sheaders->shdrs, in xc_domain_dumpcore_via_callback()
730 sheaders->num * sizeof(sheaders->shdrs[0])); in xc_domain_dumpcore_via_callback()
904 if ( sheaders != NULL ) in xc_domain_dumpcore_via_callback()
905 xc_core_shdr_free(sheaders); in xc_domain_dumpcore_via_callback()