dwarves: Adopt tag__is_base_type() from ctrace.c
We'll need it in pahole when pretty printing raw data as structs, etc. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
d8079c6d37
commit
cc65946e30
17
ctracer.c
17
ctracer.c
|
@ -346,23 +346,6 @@ static void class__emit_class_state_collector(struct class *class,
|
|||
fputs("}\n\n", fp_collector);
|
||||
}
|
||||
|
||||
static int tag__is_base_type(const struct tag *tag, const struct cu *cu)
|
||||
{
|
||||
switch (tag->tag) {
|
||||
case DW_TAG_base_type:
|
||||
return 1;
|
||||
|
||||
case DW_TAG_typedef: {
|
||||
const struct tag *type = cu__type(cu, tag->type);
|
||||
|
||||
if (type == NULL)
|
||||
return 0;
|
||||
return tag__is_base_type(type, cu);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct class *class__clone_base_types(const struct tag *tag,
|
||||
struct cu *cu,
|
||||
const char *new_class_name)
|
||||
|
|
17
dwarves.c
17
dwarves.c
|
@ -35,6 +35,23 @@
|
|||
|
||||
#define min(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
int tag__is_base_type(const struct tag *tag, const struct cu *cu)
|
||||
{
|
||||
switch (tag->tag) {
|
||||
case DW_TAG_base_type:
|
||||
return 1;
|
||||
|
||||
case DW_TAG_typedef: {
|
||||
const struct tag *type = cu__type(cu, tag->type);
|
||||
|
||||
if (type == NULL)
|
||||
return 0;
|
||||
return tag__is_base_type(type, cu);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *cu__string(const struct cu *cu, strings_t s)
|
||||
{
|
||||
if (cu->dfops && cu->dfops->strings__ptr)
|
||||
|
|
Loading…
Reference in New Issue