[LIB]: Rename type__find_tag_by_id to namespace__find_tag_by_id
Go down the rabbit hole baby, oops, the namespace hole that is. Now we find types inside namespaces. Off to implement namespace__fprintf so that we can see more brunnetes and blondes out of the DWARF encoding 8) Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
This commit is contained in:
parent
2b47267e23
commit
8562640b58
20
dwarves.c
20
dwarves.c
|
@ -569,23 +569,24 @@ static const char *tag__prefix(const struct cu *cu, const uint32_t tag)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct tag *type__find_tag_by_id(const struct type *self,
|
static struct tag *namespace__find_tag_by_id(const struct namespace *self,
|
||||||
const Dwarf_Off id)
|
const Dwarf_Off id)
|
||||||
{
|
{
|
||||||
struct tag *pos;
|
struct tag *pos;
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
type__for_each_tag(self, pos) {
|
namespace__for_each_tag(self, pos) {
|
||||||
if (pos->id == id)
|
if (pos->id == id)
|
||||||
return pos;
|
return pos;
|
||||||
|
|
||||||
/* Look if we have types within types */
|
/* Look for nested namespaces */
|
||||||
if (pos->tag == DW_TAG_structure_type ||
|
if (pos->tag == DW_TAG_structure_type ||
|
||||||
pos->tag == DW_TAG_union_type) {
|
pos->tag == DW_TAG_union_type ||
|
||||||
|
pos->tag == DW_TAG_namespace) {
|
||||||
struct tag *tag =
|
struct tag *tag =
|
||||||
type__find_tag_by_id(tag__type(pos), id);
|
namespace__find_tag_by_id(tag__namespace(pos), id);
|
||||||
if (tag != NULL)
|
if (tag != NULL)
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
@ -605,11 +606,12 @@ struct tag *cu__find_tag_by_id(const struct cu *self, const Dwarf_Off id)
|
||||||
if (pos->id == id)
|
if (pos->id == id)
|
||||||
return pos;
|
return pos;
|
||||||
|
|
||||||
/* Look if we have types within types */
|
/* Look for nested namespaces */
|
||||||
if (pos->tag == DW_TAG_structure_type ||
|
if (pos->tag == DW_TAG_structure_type ||
|
||||||
pos->tag == DW_TAG_union_type) {
|
pos->tag == DW_TAG_union_type ||
|
||||||
|
pos->tag == DW_TAG_namespace) {
|
||||||
struct tag *tag =
|
struct tag *tag =
|
||||||
type__find_tag_by_id(tag__type(pos), id);
|
namespace__find_tag_by_id(tag__namespace(pos), id);
|
||||||
if (tag != NULL)
|
if (tag != NULL)
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,14 @@ static inline struct namespace *tag__namespace(const struct tag *self)
|
||||||
return (struct namespace *)self;
|
return (struct namespace *)self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* namespace__for_each_tag - iterate thru all the tags
|
||||||
|
* @self: struct namespace instance to iterate
|
||||||
|
* @pos: struct tag iterator
|
||||||
|
*/
|
||||||
|
#define namespace__for_each_tag(self, pos) \
|
||||||
|
list_for_each_entry(pos, &(self)->tags, node)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct type - base type for enumerations, structs and unions
|
* struct type - base type for enumerations, structs and unions
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue