[LIB]: Separate emission of definitions in a type from the emission of the type itself
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
This commit is contained in:
parent
14863f943e
commit
1750958111
|
@ -218,8 +218,10 @@ static void emit_struct_defs(const char *name)
|
|||
{
|
||||
struct cu *cu;
|
||||
struct tag *c = cus__find_struct_by_name(kprobes_cus, &cu, name);
|
||||
if (c != NULL)
|
||||
cus__emit_type_definitions(kprobes_cus, cu, c, NULL, NULL);
|
||||
if (c != NULL) {
|
||||
cus__emit_type_definitions(kprobes_cus, cu, c);
|
||||
type__emit(c, cu, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void emit_class_fwd_decl(const char *name)
|
||||
|
|
34
dwarves.c
34
dwarves.c
|
@ -2642,11 +2642,13 @@ static int cus__emit_typedef_definitions(struct cus *self, struct cu *cu,
|
|||
const struct type *ctype = tag__type(type);
|
||||
|
||||
if (ctype->name == NULL) {
|
||||
cus__emit_type_definitions(self, cu, type,
|
||||
"typedef", def->name);
|
||||
if (cus__emit_type_definitions(self, cu, type))
|
||||
type__emit(type, cu, "typedef", def->name);
|
||||
goto out;
|
||||
} else
|
||||
cus__emit_type_definitions(self, cu, type, NULL, NULL);
|
||||
} else {
|
||||
if (cus__emit_type_definitions(self, cu, type))
|
||||
type__emit(type, cu, NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2715,7 +2717,9 @@ next_indirection:
|
|||
case DW_TAG_union_type:
|
||||
if (pointer)
|
||||
return cus__emit_fwd_decl(self, tag__type(type));
|
||||
return cus__emit_type_definitions(self, cu, type, NULL, NULL);
|
||||
if (cus__emit_type_definitions(self, cu, type))
|
||||
type__emit(type, cu, NULL, NULL);
|
||||
return 1;
|
||||
case DW_TAG_subroutine_type:
|
||||
return cus__emit_ftype_definitions(self, cu, tag__ftype(type));
|
||||
}
|
||||
|
@ -2741,8 +2745,7 @@ int cus__emit_ftype_definitions(struct cus *self, struct cu *cu,
|
|||
}
|
||||
|
||||
int cus__emit_type_definitions(struct cus *self, struct cu *cu,
|
||||
struct tag *tag,
|
||||
const char *prefix, const char *suffix)
|
||||
struct tag *tag)
|
||||
{
|
||||
struct type *ctype = tag__type(tag);
|
||||
struct class_member *pos;
|
||||
|
@ -2765,17 +2768,22 @@ int cus__emit_type_definitions(struct cus *self, struct cu *cu,
|
|||
|
||||
if (printed)
|
||||
putchar('\n');
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (tag->tag == DW_TAG_structure_type)
|
||||
class__find_holes(tag__class(tag), cu);
|
||||
void type__emit(struct tag *tag_self, struct cu *cu,
|
||||
const char *prefix, const char *suffix)
|
||||
{
|
||||
struct type *ctype = tag__type(tag_self);
|
||||
|
||||
if (tag_self->tag == DW_TAG_structure_type)
|
||||
class__find_holes(tag__class(tag_self), cu);
|
||||
|
||||
if (ctype->name != NULL || suffix != NULL || prefix != NULL) {
|
||||
tag__print(tag, cu, prefix, suffix);
|
||||
tag__print(tag_self, cu, prefix, suffix);
|
||||
|
||||
if (tag->tag != DW_TAG_structure_type)
|
||||
if (tag_self->tag != DW_TAG_structure_type)
|
||||
putchar(';');
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -260,9 +260,10 @@ extern struct tag *cus__find_function_by_name(const struct cus *self,
|
|||
extern int cus__emit_ftype_definitions(struct cus *self, struct cu *cu,
|
||||
struct ftype *ftype);
|
||||
extern int cus__emit_type_definitions(struct cus *self, struct cu *cu,
|
||||
struct tag *tag, const char *prefix,
|
||||
const char *suffix);
|
||||
struct tag *tag);
|
||||
extern int cus__emit_fwd_decl(struct cus *self, struct type *ctype);
|
||||
extern void type__emit(struct tag *tag_self, struct cu *cu,
|
||||
const char *prefix, const char *suffix);
|
||||
|
||||
extern struct tag *cu__find_tag_by_id(const struct cu *self,
|
||||
const Dwarf_Off id);
|
||||
|
|
Loading…
Reference in New Issue