XS-libdwarf
view release on metacpan or search on metacpan
libdwarf-code-0.11.1/src/lib/libdwarf/dwarf_init_finish.c view on Meta::CPAN
DW_DLE_GROUP_INTERNAL_ERROR);
return DW_DLV_ERROR;
}
/* Ok. Yes, ugly. */
val = valr;
}
{
/* Ensure this group entry DWARF relevant before
adding to group map */
struct Dwarf_Obj_Access_Section_a_s doasx;
int resx = DW_DLV_ERROR;
int err = 0;
int is_rela = FALSE;
memset(&doasx,0,sizeof(doasx));
resx = obj->ai_methods->
om_get_section_info(obj->ai_object,
val,
&doasx, &err);
if (resx == DW_DLV_NO_ENTRY){
/* Should we really ignore this? */
continue;
}
if (resx == DW_DLV_ERROR){
if (secdata.dss_data_was_malloc) {
free(secdata.dss_data);
secdata.dss_data = 0;
}
_dwarf_error(dbg,error,err);
return resx;
}
if (!this_section_dwarf_relevant(doasx.as_name,
(int)doasx.as_type,&is_rela) ) {
continue;
}
data += DWARF_32BIT_SIZE;
*did_add_map = TRUE;
res = _dwarf_insert_in_group_map(dbg,
(unsigned)comdat_group_number,
(unsigned)val,
doasx.as_name,
error);
if (res != DW_DLV_OK) {
if (secdata.dss_data_was_malloc) {
free(secdata.dss_data);
secdata.dss_data = 0;
}
return res;
}
}
}
}
if (secdata.dss_data_was_malloc) {
free(secdata.dss_data);
secdata.dss_data = 0;
}
return DW_DLV_OK;
}
/* Split dwarf CUs can be in an object with non-split
or split may be in a separate object.
If all in one object the default is to deal with group_number
and ignore DW_GROUPNUMBER_DWO.
If only .dwo the default is DW_GROUPNUMBER_DWO(2).
Otherwise use DW_GROUP_NUMBER_BASE(1).
If there are COMDAT SHT_GROUP sections, these
are assigned group numbers 3-N as needed.
At present this makes the assumption that COMDAT group
(ie, SHT_GROUP) sections
have lower section numbers than the sections COMDAT refers to.
It is not clear whether this is guaranteed, COMDAT is not
an official Elf thing and documentation is scarce.
In the 1990's SGI folks and others formed a committee
and attempted to get COMDAT and a feature allowing section
numbers greater than 16 bits into Elf, but there was no
group that was able to approve such things.
This is called once at dbg init time.
*/
static int
determine_target_group(Dwarf_Unsigned section_count,
struct Dwarf_Obj_Access_Interface_a_s * obj,
unsigned *group_number_out,
Dwarf_Debug dbg,
Dwarf_Error *error)
{
unsigned obj_section_index = 0;
int found_group_one = 0;
int found_group_two = 0;
struct Dwarf_Group_Data_s *grp = 0;
unsigned comdat_group_next = 3;
unsigned lowest_comdat_groupnum = 0;
grp = &dbg->de_groupnumbers;
grp->gd_number_of_groups = 0;
grp->gd_number_of_sections = (unsigned int)section_count;
if (grp->gd_map) {
_dwarf_error(dbg,error,DW_DLE_GROUP_INTERNAL_ERROR);
return DW_DLV_OK;
}
for (obj_section_index = 0; obj_section_index < section_count;
++obj_section_index) {
struct Dwarf_Obj_Access_Section_a_s doas;
int res = DW_DLV_ERROR;
int err = 0;
const char *scn_name = 0;
unsigned groupnumber = 0;
unsigned mapgroupnumber = 0;
int is_rela = FALSE;
memset(&doas,0,sizeof(doas));
res = obj->ai_methods->om_get_section_info(obj->ai_object,
obj_section_index,
&doas, &err);
if (res == DW_DLV_NO_ENTRY){
return res;
}
( run in 1.846 second using v1.01-cache-2.11-cpan-71847e10f99 )