Skip to content

Commit

Permalink
dwarf_loader: Don't stop processing after finding unsupported tag
Browse files Browse the repository at this point in the history
After emitting a warning that a tag is not supported __die__process_tag
was returning NULL, making die__process_unit think that the problem
was insufficient memory.

Introduce a global variable 'unsupported_tag' and return it instead,
that way die__process_unit can distinguish ENOMEM from unsupported tags.

Reported-by: Thiago Macieira <[email protected]>
Tested-by: Thiago Macieira <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Aug 16, 2012
1 parent e887636 commit be7b691
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dwarf_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,8 @@ static struct tag *die__create_new_function(Dwarf_Die *die, struct cu *cu)
return function ? &function->proto.tag : NULL;
}

static struct tag unsupported_tag;

static struct tag *__die__process_tag(Dwarf_Die *die, struct cu *cu,
int top_level, const char *fn)
{
Expand Down Expand Up @@ -1578,7 +1580,7 @@ static struct tag *__die__process_tag(Dwarf_Die *die, struct cu *cu,
tag = die__create_new_variable(die, cu); break;
default:
__cu__tag_not_handled(die, fn);
tag = NULL;
tag = &unsupported_tag;
break;
}

Expand All @@ -1595,6 +1597,9 @@ static int die__process_unit(Dwarf_Die *die, struct cu *cu)
if (tag == NULL)
return -ENOMEM;

if (tag == &unsupported_tag)
continue;

long id = -1;
cu__add_tag(cu, tag, &id);
cu__hash(cu, tag);
Expand Down

0 comments on commit be7b691

Please sign in to comment.