From: compudj Date: Wed, 22 Feb 2006 21:12:29 +0000 (+0000) Subject: network byte order + state multitraces fix X-Git-Tag: v0.12.20~1936 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f0b795e0b579719a95fee5f84d4dcb893044d926;p=lttv.git network byte order + state multitraces fix git-svn-id: http://ltt.polymtl.ca/svn@1553 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/ChangeLog b/ltt/branches/poly/ChangeLog index 4487761a..e65da2f3 100644 --- a/ltt/branches/poly/ChangeLog +++ b/ltt/branches/poly/ChangeLog @@ -1,5 +1,7 @@ LinuxTraceToolkit ChangeLog +15/02/2006 LTTV 0.8.21 + Add support for data with network byte order. 15/02/2006 LTTV 0.8.20 Fix end of trace NULL pointer problem in debug output of lttvwindow. diff --git a/ltt/branches/poly/configure.in b/ltt/branches/poly/configure.in index 9d0ca793..c226b39a 100644 --- a/ltt/branches/poly/configure.in +++ b/ltt/branches/poly/configure.in @@ -23,7 +23,7 @@ AC_PREREQ(2.57) AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) #AC_WITH_LTDL # not needed ? -AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.20-15022006) +AM_INIT_AUTOMAKE(LinuxTraceToolkitViewer,0.8.21-22022006) AM_CONFIG_HEADER(config.h) AM_PROG_LIBTOOL diff --git a/ltt/branches/poly/facilities/network.xml b/ltt/branches/poly/facilities/network.xml index 41a4ba91..a7dd7286 100644 --- a/ltt/branches/poly/facilities/network.xml +++ b/ltt/branches/poly/facilities/network.xml @@ -3,7 +3,8 @@ A packet is arriving - Socket buffer pointer : identify the socket buffer + Socket buffer pointer : identify the + socket buffer Protocol of the packet diff --git a/ltt/branches/poly/ltt/event.c b/ltt/branches/poly/ltt/event.c index 8011782a..67c689b6 100644 --- a/ltt/branches/poly/ltt/event.c +++ b/ltt/branches/poly/ltt/event.c @@ -373,8 +373,13 @@ off_t ltt_event_field_offset(LttEvent *e, LttField *f) ****************************************************************************/ guint32 ltt_event_get_unsigned(LttEvent *e, LttField *f) { - gboolean reverse_byte_order = LTT_GET_BO(e->tracefile); - + gboolean reverse_byte_order; + if(unlikely(f->field_type.network)) { + reverse_byte_order = (g_ntohs(0x1) != 0x1); + } else { + reverse_byte_order = LTT_GET_BO(e->tracefile); + } + switch(f->field_size) { case 1: { @@ -398,8 +403,13 @@ guint32 ltt_event_get_unsigned(LttEvent *e, LttField *f) gint32 ltt_event_get_int(LttEvent *e, LttField *f) { - gboolean reverse_byte_order = LTT_GET_BO(e->tracefile); - + gboolean reverse_byte_order; + if(unlikely(f->field_type.network)) { + reverse_byte_order = (g_ntohs(0x1) != 0x1); + } else { + reverse_byte_order = LTT_GET_BO(e->tracefile); + } + switch(f->field_size) { case 1: { @@ -423,7 +433,12 @@ gint32 ltt_event_get_int(LttEvent *e, LttField *f) guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f) { - gboolean reverse_byte_order = LTT_GET_BO(e->tracefile); + gboolean reverse_byte_order; + if(unlikely(f->field_type.network)) { + reverse_byte_order = (g_ntohs(0x1) != 0x1); + } else { + reverse_byte_order = LTT_GET_BO(e->tracefile); + } switch(f->field_size) { case 1: @@ -450,7 +465,12 @@ guint64 ltt_event_get_long_unsigned(LttEvent *e, LttField *f) gint64 ltt_event_get_long_int(LttEvent *e, LttField *f) { - gboolean reverse_byte_order = LTT_GET_BO(e->tracefile); + gboolean reverse_byte_order; + if(unlikely(f->field_type.network)) { + reverse_byte_order = (g_ntohs(0x1) != 0x1); + } else { + reverse_byte_order = LTT_GET_BO(e->tracefile); + } switch(f->field_size) { case 1: @@ -477,8 +497,13 @@ gint64 ltt_event_get_long_int(LttEvent *e, LttField *f) float ltt_event_get_float(LttEvent *e, LttField *f) { - g_assert(LTT_HAS_FLOAT(e->tracefile)); - gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile); + gboolean reverse_byte_order; + if(unlikely(f->field_type.network)) { + reverse_byte_order = (g_ntohs(0x1) != 0x1); + } else { + g_assert(LTT_HAS_FLOAT(e->tracefile)); + reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile); + } g_assert(f->field_type.type_class == LTT_FLOAT && f->field_size == 4); @@ -492,8 +517,13 @@ float ltt_event_get_float(LttEvent *e, LttField *f) double ltt_event_get_double(LttEvent *e, LttField *f) { - g_assert(LTT_HAS_FLOAT(e->tracefile)); - gboolean reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile); + gboolean reverse_byte_order; + if(unlikely(f->field_type.network)) { + reverse_byte_order = (g_ntohs(0x1) != 0x1); + } else { + g_assert(LTT_HAS_FLOAT(e->tracefile)); + reverse_byte_order = LTT_GET_FLOAT_BO(e->tracefile); + } if(f->field_size == 4) return ltt_event_get_float(e, f); diff --git a/ltt/branches/poly/ltt/facility.c b/ltt/branches/poly/ltt/facility.c index e3ed40ee..9a302d2a 100644 --- a/ltt/branches/poly/ltt/facility.c +++ b/ltt/branches/poly/ltt/facility.c @@ -294,6 +294,7 @@ void construct_fields(LttFacility *fac, type->enum_map = NULL; type->fields = NULL; type->fields_by_name = NULL; + type->network = td->network; switch(td->type) { case INT_FIXED: diff --git a/ltt/branches/poly/ltt/ltt-private.h b/ltt/branches/poly/ltt/ltt-private.h index 6d51afbb..c7c4deef 100644 --- a/ltt/branches/poly/ltt/ltt-private.h +++ b/ltt/branches/poly/ltt/ltt-private.h @@ -226,6 +226,7 @@ struct _LttType{ GHashTable *enum_map; //maps enum labels to numbers. GArray *fields; // Array of LttFields, for array, sequence, union, struct. GData *fields_by_name; + guint network; // Is the type in network byte order ? }; struct _LttEventType{ diff --git a/ltt/branches/poly/ltt/parser.c b/ltt/branches/poly/ltt/parser.c index 55d7c96c..2d8c9c4a 100644 --- a/ltt/branches/poly/ltt/parser.c +++ b/ltt/branches/poly/ltt/parser.c @@ -183,6 +183,7 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t, t->fmt = NULL; t->size = 0; t->custom_write = 0; + t->network = 0; while(1) { token = getToken(in); @@ -205,7 +206,9 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t, t->size = getSize(in); } else if(!strcmp("custom_write", token)) { t->custom_write = 1; - } + } else if(!strcmp("network", token)) { + t->network = 1; + } } } @@ -327,7 +330,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) diff --git a/ltt/branches/poly/ltt/parser.h b/ltt/branches/poly/ltt/parser.h index 5a4c5b02..c3a0c5ee 100644 --- a/ltt/branches/poly/ltt/parser.h +++ b/ltt/branches/poly/ltt/parser.h @@ -111,7 +111,8 @@ typedef struct _type_descriptor { sequence_t labels_description; int already_printed; sequence_t fields; // for structure, array and sequence (field_t type) - int custom_write; /* Should we use a custom write function ? */ + int custom_write; /* Should we use a custom write function ? */ + int network; /* Is the type a in network byte order ? */ } type_descriptor_t; diff --git a/ltt/branches/poly/ltt/tracefile.c b/ltt/branches/poly/ltt/tracefile.c index c1001c25..3fbf3b2e 100644 --- a/ltt/branches/poly/ltt/tracefile.c +++ b/ltt/branches/poly/ltt/tracefile.c @@ -2658,6 +2658,10 @@ gint check_fields_compatibility(LttEventType *event_type1, different = 1; goto end; } + if(type1->network != type2->network) { + different = 1; + goto end; + } switch(type1->type_class) { case LTT_INT_FIXED: diff --git a/ltt/branches/poly/lttv/lttv/state.c b/ltt/branches/poly/lttv/lttv/state.c index 3602c677..05a6aa53 100644 --- a/ltt/branches/poly/lttv/lttv/state.c +++ b/ltt/branches/poly/lttv/lttv/state.c @@ -1685,7 +1685,7 @@ void lttv_state_add_event_hooks(LttvTracesetState *self) } } } - lttv_attribute_find(self->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val); + lttv_attribute_find(ts->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val); *(val.v_pointer) = hooks; } } @@ -1720,7 +1720,7 @@ void lttv_state_remove_event_hooks(LttvTracesetState *self) nb_trace = lttv_traceset_number(traceset); for(i = 0 ; i < nb_trace ; i++) { ts = LTTV_TRACE_STATE(self->parent.traces[i]); - lttv_attribute_find(self->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val); + lttv_attribute_find(ts->parent.a, LTTV_STATE_HOOKS, LTTV_POINTER, &val); hooks = *(val.v_pointer); /* Remove these hooks from each event_by_id hooks list */