X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Fconvert%2Fconvert.c;h=5f2de35fb5dc9902143700e98ccffc1841e199e8;hb=f628823c5712cc8b8bfe10ade63b6c7c2862f5e5;hp=722bf5ecc9411608ddfafdee57658bad80c2336c;hpb=0ff39ce47cf1061ba5880560dd9192336dc1ac64;p=lttv.git diff --git a/ltt/branches/poly/ltt/convert/convert.c b/ltt/branches/poly/ltt/convert/convert.c index 722bf5ec..5f2de35f 100644 --- a/ltt/branches/poly/ltt/convert/convert.c +++ b/ltt/branches/poly/ltt/convert/convert.c @@ -1,3 +1,7 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -111,7 +115,7 @@ int main(int argc, char ** argv){ int ltt_major_version=0; int ltt_minor_version=0; int ltt_log_cpu; - guint ltt_trace_start_size; + guint ltt_trace_start_size = 0; char buf[BUFFER_SIZE]; int i, k; @@ -298,7 +302,7 @@ int main(int argc, char ** argv){ cur_pos += sizeof(uint32_t); //skip time delta tStart = (trace_start_any*)cur_pos; if(tStart->MagicNumber != TRACER_MAGIC_NUMBER) - g_error("Trace magic number does not match : %lx, should be %lx", + g_error("Trace magic number does not match : %x, should be %x", tStart->MagicNumber, TRACER_MAGIC_NUMBER); if(tStart->MajorVersion != TRACER_SUP_VERSION_MAJOR) g_error("Trace Major number does match : %hu, should be %u", @@ -324,7 +328,20 @@ int main(int argc, char ** argv){ ltt_block_size = tStart_2_2->BufferSize; ltt_log_cpu = tStart_2_2->LogCPUID; ltt_trace_start_size = sizeof(trace_start_2_2); - } else if(tStart->MinorVersion == 3) { + /* Verify if it's a broken 2.2 format */ + if(*(uint8_t*)(cur_pos + sizeof(trace_start_2_2)) == 0) { + /* Cannot have two trace start events. We cannot detect the problem + * if the flight recording flag is set to 1, as it conflicts + * with TRACE_SYSCALL_ENTRY. + */ + g_warning("This is a 2.3 trace format that has a 2.2 tag. Please upgrade your kernel"); + g_printf("Processing the trace as a 2.3 format\n"); + + tStart->MinorVersion = 3; + } + } + + if(tStart->MinorVersion == 3) { trace_start_2_3* tStart_2_3 = (trace_start_2_3*)tStart; ltt_major_version = tStart_2_3->MajorVersion; ltt_minor_version = tStart_2_3->MinorVersion; @@ -333,11 +350,11 @@ int main(int argc, char ** argv){ ltt_trace_start_size = sizeof(trace_start_2_3); /* We do not use the flight recorder information for now, because we * never use the .proc file anyway */ - } else { - ltt_trace_start_size = 0; + } + + if(ltt_trace_start_size == 0) g_error("Minor version unknown : %hu. Supported minors : 2, 3", tStart->MinorVersion); - } block_size = ltt_block_size;//FIXME block_number = file_size/ltt_block_size; @@ -740,6 +757,8 @@ int main(int argc, char ** argv){ close(fdProc); fclose(fp); + g_printf("Conversion completed. Don't forget to copy core.xml to eventdefs directory\n"); + return 0; }