X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=genevent-new%2Fparser.c;h=28ebaeea9dba2e5a99eac16c404be0f62d81d000;hb=4a6829e2f886c2b3aa8d9ec4e0142ef5edb390d6;hp=48f3bdcf6cd75965b28c4e78cdc158dcf5a62d27;hpb=30d72138904f5f318a5ba8767381620573eb1f3b;p=lttv.git diff --git a/genevent-new/parser.c b/genevent-new/parser.c index 48f3bdcf..28ebaeea 100644 --- a/genevent-new/parser.c +++ b/genevent-new/parser.c @@ -97,11 +97,26 @@ int getSizeindex(unsigned int value) unsigned long long int getSize(parse_file_t *in) { char *token; + int has_quotes = 0; + unsigned long long int ret; token = getToken(in); + if(token[0] == '"') { + has_quotes = 1; + token = getToken(in); + } if(in->type == NUMBER) { - return strtoull(token, NULL, 0); - } + ret = strtoull(token, NULL, 0); + } else { + goto error; + } + if(has_quotes) { + token = getToken(in); + if(token[0] != '"') goto error; + } + + return ret; +error: in->error(in,"incorrect size specification"); return -1; } @@ -182,7 +197,8 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t, t->fmt = NULL; t->size = 0; - t->alignment = 0; + t->custom_write = 0; + t->network = 0; while(1) { token = getToken(in); @@ -203,10 +219,11 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t, } else if(!strcmp("size",token)) { getEqual(in); t->size = getSize(in); - } else if(!strcmp("align",token)) { - getEqual(in); - t->alignment = getNumber(in); - } + } else if(!strcmp("custom_write", token)) { + t->custom_write = 1; + } else if(!strcmp("network", token)) { + t->network = 1; + } } } @@ -230,6 +247,8 @@ void getEventAttributes(parse_file_t *in, event_t *ev) ev->name = NULL; ev->per_trace = 0; ev->per_tracefile = 0; + ev->param_buffer = 0; + ev->no_instrument_function = 0; while(1) { token = getToken(in); @@ -248,7 +267,11 @@ void getEventAttributes(parse_file_t *in, event_t *ev) ev->per_trace = 1; } else if(!strcmp("per_tracefile", token)) { ev->per_tracefile = 1; - } + } else if(!strcmp("param_buffer", token)) { + ev->param_buffer = 1; + } else if(!strcmp("no_instrument_function", token)) { + ev->no_instrument_function = 1; + } } } @@ -271,6 +294,8 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac) char car; fac->name = NULL; + fac->arch = NULL; + fac->user = 0; while(1) { token = getToken(in); @@ -285,7 +310,14 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac) if(car == EOF) in->error(in,"name was expected"); else if(car == '\"') fac->name = allocAndCopy(getQuotedString(in)); else fac->name = allocAndCopy(getName(in)); - } + if(!strncmp(fac->name, "user_", sizeof("user_")) == 0) + fac->user = 1; + } else if(!strcmp("arch", token)) { + getEqual(in); + car = seekNextChar(in); + if(car == '\"') fac->name = allocAndCopy(getQuotedString(in)); + else fac->arch = allocAndCopy(getName(in)); + } } } @@ -322,7 +354,7 @@ void getFieldAttributes(parse_file_t *in, field_t *f) else if(car == '\"') f->name = allocAndCopy(getQuotedString(in)); else f->name = allocAndCopy(getName(in)); } - } + } } char *getNameAttribute(parse_file_t *in) @@ -333,42 +365,59 @@ char *getNameAttribute(parse_file_t *in) while(1) { token = getToken(in); - if(strcmp("/",token) == 0 || strcmp(">",token) == 0){ - ungetToken(in); - break; - } - if(!strcmp("name",token)) { getEqual(in); car = seekNextChar(in); if(car == EOF) in->error(in,"name was expected"); else if(car == '\"') name = allocAndCopy(getQuotedString(in)); else name = allocAndCopy(getName(in)); + } else { + ungetToken(in); + break; } + } if(name == NULL) in->error(in, "Name was expected"); return name; - } //for