From c6bc9cb9f0b1432775ddc7cbbd2f2c2cfdb28474 Mon Sep 17 00:00:00 2001 From: yangxx Date: Mon, 18 Aug 2003 16:10:35 +0000 Subject: [PATCH] git-svn-id: http://ltt.polymtl.ca/svn@179 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/attribute.c | 6 ++++-- ltt/branches/poly/lttv/batchAnalysis.c | 2 ++ ltt/branches/poly/lttv/processTrace.c | 4 ++-- ltt/branches/poly/lttv/state.c | 12 ++++++------ ltt/branches/poly/lttv/textDump.c | 10 ++++++++-- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ltt/branches/poly/lttv/attribute.c b/ltt/branches/poly/lttv/attribute.c index d0695897..176772de 100644 --- a/ltt/branches/poly/lttv/attribute.c +++ b/ltt/branches/poly/lttv/attribute.c @@ -151,8 +151,10 @@ lttv_attribute_remove(LttvAttribute *self, unsigned i) /* The element used to replace the removed element has its index entry all wrong now. Reinsert it with its new position. */ - g_hash_table_remove(self->names, GUINT_TO_POINTER(a->name)); - g_hash_table_insert(self->names, GUINT_TO_POINTER(a->name), GUINT_TO_POINTER(i + 1)); + if(self->attributes->len != i){ + g_hash_table_remove(self->names, GUINT_TO_POINTER(a->name)); + g_hash_table_insert(self->names, GUINT_TO_POINTER(a->name), GUINT_TO_POINTER(i + 1)); + } } void diff --git a/ltt/branches/poly/lttv/batchAnalysis.c b/ltt/branches/poly/lttv/batchAnalysis.c index 0a7d9dd1..6f499ce1 100644 --- a/ltt/branches/poly/lttv/batchAnalysis.c +++ b/ltt/branches/poly/lttv/batchAnalysis.c @@ -141,5 +141,7 @@ G_MODULE_EXPORT void destroy() for(i = 0 ; i < nb ; i++) { ltt_trace_close(lttv_traceset_get(traceset, i)); } + + lttv_traceset_destroy(traceset); } diff --git a/ltt/branches/poly/lttv/processTrace.c b/ltt/branches/poly/lttv/processTrace.c index 94b5e2d9..550b9c42 100644 --- a/ltt/branches/poly/lttv/processTrace.c +++ b/ltt/branches/poly/lttv/processTrace.c @@ -33,7 +33,7 @@ lttv_context_new_trace_context(LttvTracesetContext *self) LttvTracefileContext * lttv_context_new_tracefile_context(LttvTracesetContext *self) { - LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self); + return LTTV_TRACESET_CONTEXT_GET_CLASS(self)->new_tracefile_context(self); } @@ -365,7 +365,7 @@ lttv_trace_context_get_type(void) (GClassInitFunc) trace_context_class_init, /* class_init */ NULL, /* class_finalize */ NULL, /* class_data */ - sizeof (LttvTracesetContext), + sizeof (LttvTraceContext), 0, /* n_preallocs */ (GInstanceInitFunc) trace_context_instance_init /* instance_init */ }; diff --git a/ltt/branches/poly/lttv/state.c b/ltt/branches/poly/lttv/state.c index 6f6dc9ad..bb221a77 100644 --- a/ltt/branches/poly/lttv/state.c +++ b/ltt/branches/poly/lttv/state.c @@ -106,9 +106,9 @@ traceset_state_instance_init (GTypeInstance *instance, gpointer g_class) static void -traceset_state_finalize (LttvTracesetContext *self) +traceset_state_finalize (LttvTracesetState *self) { - G_OBJECT_CLASS(g_type_class_peek_parent(LTTV_TRACESET_STATE_GET_CLASS(self)))->finalize(G_OBJECT(self)); + G_OBJECT_CLASS(g_type_class_peek_parent(g_type_class_peek_parent(LTTV_TRACESET_STATE_GET_CLASS(self))))->finalize(G_OBJECT(self)); } @@ -157,9 +157,9 @@ trace_state_instance_init (GTypeInstance *instance, gpointer g_class) static void -trace_state_finalize (LttvTraceContext *self) +trace_state_finalize (LttvTraceState *self) { - G_OBJECT_CLASS(g_type_class_peek_parent(LTTV_TRACE_STATE_GET_CLASS(self)))->finalize(G_OBJECT(self)); + G_OBJECT_CLASS(g_type_class_peek_parent(g_type_class_peek_parent(LTTV_TRACE_STATE_GET_CLASS(self))))->finalize(G_OBJECT(self)); } @@ -184,7 +184,7 @@ lttv_trace_state_get_type(void) (GClassInitFunc) trace_state_class_init, /* class_init */ NULL, /* class_finalize */ NULL, /* class_data */ - sizeof (LttvTracesetState), + sizeof (LttvTraceState), 0, /* n_preallocs */ (GInstanceInitFunc) trace_state_instance_init /* instance_init */ }; @@ -205,7 +205,7 @@ tracefile_state_instance_init (GTypeInstance *instance, gpointer g_class) static void tracefile_state_finalize (LttvTracefileState *self) { - G_OBJECT_CLASS(g_type_class_peek_parent(LTTV_TRACEFILE_STATE_GET_CLASS(self)))->finalize(G_OBJECT(self)); + G_OBJECT_CLASS(g_type_class_peek_parent(g_type_class_peek_parent(LTTV_TRACEFILE_STATE_GET_CLASS(self))))->finalize(G_OBJECT(self)); } diff --git a/ltt/branches/poly/lttv/textDump.c b/ltt/branches/poly/lttv/textDump.c index acf06e4e..2734e3be 100644 --- a/ltt/branches/poly/lttv/textDump.c +++ b/ltt/branches/poly/lttv/textDump.c @@ -59,7 +59,7 @@ void print_field(LttEvent *e, LttField *f, GString *s, gboolean field_names) { case LTT_ENUM: g_string_append_printf(s, " %s", ltt_enum_string_get(type, - ltt_event_get_unsigned(e,f))); + ltt_event_get_unsigned(e,f)-1)); break; case LTT_ARRAY: @@ -118,7 +118,8 @@ void lttv_event_to_string(LttEvent *e, LttTracefile *tf, GString *s, /* Print the process id and the state/interrupt type of the process */ } - print_field(e, field, s, field_names); + if(field) + print_field(e, field, s, field_names); } @@ -181,6 +182,7 @@ static int write_event_content(void *hook_data, void *call_data) e = tfc->e; lttv_event_to_string(e, tfc->tf, a_string, TRUE, a_field_names); + g_string_append_printf(a_string,"\n"); if(a_state) { g_string_append_printf(a_string, " %s", @@ -199,6 +201,8 @@ G_MODULE_EXPORT void init(LttvModule *self, int argc, char **argv) LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes()); + a_string = g_string_new(""); + a_file_name = NULL; lttv_option_add("output", 'o', "output file where the text is written", @@ -247,6 +251,8 @@ G_MODULE_EXPORT void destroy() lttv_option_remove("process_state"); + g_string_free(a_string, TRUE); + lttv_hooks_remove_data(before_event, write_event_content, NULL); lttv_hooks_remove_data(before_trace, write_trace_header, NULL); -- 2.34.1