@@ -929,6 +929,31 @@ static void dump_therest(int fd)
}
}
+static void dump_v6_file(int fd)
+{
+ dump_header_page(fd);
+ dump_header_event(fd);
+ dump_ftrace_events_format(fd);
+ dump_events_format(fd);
+ dump_kallsyms(fd);
+ dump_printk(fd);
+ dump_cmdlines(fd);
+ dump_cpus_count(fd);
+ dump_therest(fd);
+}
+
+static void dump_v7_file(int fd)
+{
+ long long offset;
+
+ if (read_file_number(fd, &offset, 8))
+ die("cannot read offset of the first option section");
+
+ if (lseek64(fd, offset, SEEK_SET) == (off64_t)-1)
+ die("cannot goto options offset %lld", offset);
+ dump_options(fd);
+}
+
static void free_sections(void)
{
struct file_section *del;
@@ -956,15 +981,10 @@ static void dump_file(const char *file)
dump_initial_format(fd);
dump_compress(fd);
- dump_header_page(fd);
- dump_header_event(fd);
- dump_ftrace_events_format(fd);
- dump_events_format(fd);
- dump_kallsyms(fd);
- dump_printk(fd);
- dump_cmdlines(fd);
- dump_cpus_count(fd);
- dump_therest(fd);
+ if (file_version < FILE_VERSION_SECTIONS)
+ dump_v6_file(fd);
+ else
+ dump_v7_file(fd);
free_sections();
tep_free(tep);
tep = NULL;
Trace file version 7 has different structure than version 6. Separates parsing both versions in different flows. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- tracecmd/trace-dump.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-)