So I have something like this (I copied this from my other plugin functionality which simply creates a copy paste structure from the frame containing stack variables, while deleting them and then recreating the stack frame as a single variable with the new struct type):
ea_t currea;
for (auto i : ranges::iota_view{ (size_t)0, get_segm_qty() })
if (auto segment = getnseg(i); segment->type & SEG_DATA) {
currea = segment->start_ea;
auto newstructid = add_struc(BADADDR, nullptr);
auto newstruct = get_struc(newstructid);
struc_error_t strucerr;
do {
strucerr = add_struc_member(newstruct, /*name*/, currea, /*flags*/, /*member info*/, /*size*/);
} while ((currea = next_head(currea, segment->end_ea)) != BADADDR);
}
Anyone can help me fill the blanks. I need to get information about the current head such as type and name.