[CLASSES]: Create cu__create_new_inline_expansion out of cu__process_function

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2007-01-02 16:26:11 -02:00
parent ce281d1341
commit 9618245851
1 changed files with 51 additions and 43 deletions

View File

@ -2053,6 +2053,53 @@ static void cu__create_new_lexblock(Dwarf *dwarf, Dwarf_Die *die,
lexblock__add_lexblock(father, lexblock);
}
static void cu__create_new_inline_expansion(Dwarf *dwarf, Dwarf_Die *die,
struct cu *cu,
struct lexblock *lexblock,
Dwarf_Off id, const char *decl_file,
int decl_line)
{
Dwarf_Addr high_pc, low_pc;
Dwarf_Attribute attr_call_file;
const Dwarf_Off type = attr_numeric(die, DW_AT_abstract_origin);
struct inline_expansion *exp;
size_t size;
if (dwarf_highpc(die, &high_pc))
high_pc = 0;
if (dwarf_lowpc(die, &low_pc))
low_pc = 0;
size = high_pc - low_pc;
if (size == 0) {
Dwarf_Addr base, start;
ptrdiff_t offset = 0;
while (1) {
offset = dwarf_ranges(die, offset, &base, &start,
&high_pc);
start = (unsigned long)start;
high_pc = (unsigned long)high_pc;
if (offset <= 0)
break;
size += high_pc - start;
if (low_pc == 0)
low_pc = start;
}
}
decl_file = attr_string(die, DW_AT_call_file, &attr_call_file);
decl_line = attr_numeric(die, DW_AT_call_line);
exp = inline_expansion__new(id, type, decl_file, decl_line, size,
low_pc, high_pc);
if (exp == NULL)
oom("inline_expansion__new");
exp->cu = cu;
lexblock__add_inline_expansion(lexblock, exp);
}
static void cu__process_function(Dwarf *dwarf, Dwarf_Die *die,
struct cu *cu, struct ftype *ftype,
struct lexblock *lexblock)
@ -2122,49 +2169,10 @@ static void cu__process_function(Dwarf *dwarf, Dwarf_Die *die,
lexblock__add_label(lexblock, label);
}
break;
case DW_TAG_inlined_subroutine: {
Dwarf_Addr high_pc, low_pc;
Dwarf_Attribute attr_call_file;
const Dwarf_Off type = attr_numeric(die,
DW_AT_abstract_origin);
struct inline_expansion *exp;
size_t size;
if (dwarf_highpc(die, &high_pc))
high_pc = 0;
if (dwarf_lowpc(die, &low_pc))
low_pc = 0;
size = high_pc - low_pc;
if (size == 0) {
Dwarf_Addr base, start;
ptrdiff_t offset = 0;
while (1) {
offset = dwarf_ranges(die, offset,
&base, &start, &high_pc);
start = (unsigned long)start;
high_pc = (unsigned long)high_pc;
if (offset <= 0)
break;
size += high_pc - start;
if (low_pc == 0)
low_pc = start;
}
}
decl_file = attr_string(die, DW_AT_call_file, &attr_call_file);
decl_line = attr_numeric(die, DW_AT_call_line);
exp = inline_expansion__new(id, type,
decl_file, decl_line, size,
low_pc, high_pc);
if (exp == NULL)
oom("inline_expansion__new");
lexblock__add_inline_expansion(lexblock, exp);
exp->cu = cu;
}
case DW_TAG_inlined_subroutine:
cu__create_new_inline_expansion(dwarf, die, cu,
lexblock, id,
decl_file, decl_line);
break;
case DW_TAG_lexical_block:
cu__create_new_lexblock(dwarf, die, cu, lexblock,