X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fmetadata%2Fctf-visitor-xml.c;h=c47bd27d8ed61ae0c64bf3f7939f443b239fdfd2;hp=d1c0751c51e3c8c548144c087cd1834c05d6fa52;hb=01c76b246be85b5d9c8e99813950fb194c9f714f;hpb=3e11b713fa76482be45bff5b067cfab5ab6e9be1 diff --git a/formats/ctf/metadata/ctf-visitor-xml.c b/formats/ctf/metadata/ctf-visitor-xml.c index d1c0751c..c47bd27d 100644 --- a/formats/ctf/metadata/ctf-visitor-xml.c +++ b/formats/ctf/metadata/ctf-visitor-xml.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "ctf-scanner.h" #include "ctf-parser.h" @@ -75,15 +76,15 @@ int ctf_visitor_print_unary_expression(FILE *fd, int depth, struct ctf_node *nod break; case UNARY_SIGNED_CONSTANT: print_tabs(fd, depth); - fprintf(fd, "u.unary_expression.u.signed_constant); - fprintf(fd, " />\n"); + fprintf(fd, "\" />\n"); break; case UNARY_UNSIGNED_CONSTANT: print_tabs(fd, depth); - fprintf(fd, "u.unary_expression.u.signed_constant); - fprintf(fd, " />\n"); + fprintf(fd, "\" />\n"); break; case UNARY_SBRAC: print_tabs(fd, depth); @@ -136,6 +137,7 @@ int ctf_visitor_print_type_specifier_list(FILE *fd, int depth, struct ctf_node * static int ctf_visitor_print_type_specifier(FILE *fd, int depth, struct ctf_node *node) { + int ret; print_tabs(fd, depth); switch (node->u.type_specifier.type) { @@ -153,7 +155,7 @@ int ctf_visitor_print_type_specifier(FILE *fd, int depth, struct ctf_node *node) case TYPESPEC_IMAGINARY: case TYPESPEC_CONST: case TYPESPEC_ID_TYPE: - fprintf(fd, "u.type_specifier.node); + ret = ctf_visitor_print_xml(fd, depth, node->u.type_specifier.node); + if (ret) + return ret; + break; case TYPESPEC_UNKNOWN: default: fprintf(stderr, "[error] %s: unknown type specifier %d\n", __func__, @@ -251,9 +256,9 @@ int ctf_visitor_print_type_specifier(FILE *fd, int depth, struct ctf_node *node) case TYPESPEC_STRUCT: case TYPESPEC_VARIANT: case TYPESPEC_ENUM: + depth--; print_tabs(fd, depth); fprintf(fd, "\n"); - depth--; break; case TYPESPEC_UNKNOWN: default: @@ -292,7 +297,7 @@ int ctf_visitor_print_type_declarator(FILE *fd, int depth, struct ctf_node *node case TYPEDEC_ID: if (node->u.type_declarator.u.id) { print_tabs(fd, depth); - fprintf(fd, "u.type_declarator.u.id); fprintf(fd, "\" />\n"); } @@ -308,18 +313,20 @@ int ctf_visitor_print_type_declarator(FILE *fd, int depth, struct ctf_node *node print_tabs(fd, depth); fprintf(fd, "\n"); } - if (node->u.type_declarator.u.nested.length) { + if (node->u.type_declarator.u.nested.abstract_array) { print_tabs(fd, depth); fprintf(fd, "\n"); - ret = ctf_visitor_print_xml(fd, depth + 1, node->u.type_declarator.u.nested.length); - if (ret) - return ret; print_tabs(fd, depth); fprintf(fd, "\n"); - } - if (node->u.type_declarator.u.nested.abstract_array) { + } else if (!cds_list_empty(&node->u.type_declarator.u.nested.length)) { print_tabs(fd, depth); fprintf(fd, "\n"); + cds_list_for_each_entry(iter, &node->u.type_declarator.u.nested.length, + siblings) { + ret = ctf_visitor_print_xml(fd, depth + 1, iter); + if (ret) + return ret; + } print_tabs(fd, depth); fprintf(fd, "\n"); } @@ -609,12 +616,9 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) if (node->u._enum.container_type) { print_tabs(fd, depth); fprintf(fd, "\n"); - } - - ret = ctf_visitor_print_xml(fd, depth + 1, node->u._enum.container_type); - if (ret) - return ret; - if (node->u._enum.container_type) { + ret = ctf_visitor_print_xml(fd, depth + 1, node->u._enum.container_type); + if (ret) + return ret; print_tabs(fd, depth); fprintf(fd, "\n"); } @@ -679,6 +683,17 @@ int ctf_visitor_print_xml(FILE *fd, int depth, struct ctf_node *node) } print_tabs(fd, depth); fprintf(fd, "\n"); + if (!cds_list_empty(&node->u._struct.min_align)) { + print_tabs(fd, depth); + fprintf(fd, "\n"); + cds_list_for_each_entry(iter, &node->u._struct.min_align, siblings) { + ret = ctf_visitor_print_xml(fd, depth + 1, iter); + if (ret) + return ret; + } + print_tabs(fd, depth); + fprintf(fd, "\n"); + } break; case NODE_UNKNOWN: