From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH v2 08/10] trace-cmd dump: Dump sections content
Date: Tue, 14 Sep 2021 16:21:46 +0300 [thread overview]
Message-ID: <20210914132148.3968401-9-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20210914132148.3968401-1-tz.stoyanov@gmail.com>
In trace file version 7, dump the content of the headers content, that
are stored as sections. Added logic to dump these headers:
HEADER_INFO
FTRACE_EVENTS
EVENT_FORMATS
KALLSYM
PRINTK
CMDLINES
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
tracecmd/trace-dump.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/tracecmd/trace-dump.c b/tracecmd/trace-dump.c
index 44f103d8..c222cd66 100644
--- a/tracecmd/trace-dump.c
+++ b/tracecmd/trace-dump.c
@@ -686,6 +686,46 @@ static void dump_option_section(int fd, unsigned int size,
do_print(OPTIONS, "%lld\n", sec->offset);
}
+static void dump_sections(int fd)
+{
+ struct file_section *sec = sections;
+ unsigned short flags;
+
+ while (sec) {
+ if (lseek64(fd, sec->offset, SEEK_SET) == (off_t)-1)
+ die("cannot goto option offset %lld", sec->offset);
+
+ dump_section_header(fd, sec->verbosity, &flags);
+
+ if ((flags & TRACECMD_SEC_FL_COMPRESS) && uncompress_block())
+ die("cannot uncompress section block");
+
+ switch (sec->id) {
+ case TRACECMD_OPTION_HEADER_INFO:
+ dump_header_page(fd);
+ dump_header_event(fd);
+ break;
+ case TRACECMD_OPTION_FTRACE_EVENTS:
+ dump_ftrace_events_format(fd);
+ break;
+ case TRACECMD_OPTION_EVENT_FORMATS:
+ dump_events_format(fd);
+ break;
+ case TRACECMD_OPTION_KALLSYMS:
+ dump_kallsyms(fd);
+ break;
+ case TRACECMD_OPTION_PRINTK:
+ dump_printk(fd);
+ break;
+ case TRACECMD_OPTION_CMDLINES:
+ dump_cmdlines(fd);
+ break;
+ }
+ uncompress_reset();
+ sec = sec->next;
+ }
+}
+
static int dump_options_read(int fd);
static int dump_option_done(int fd, int size)
@@ -907,6 +947,7 @@ static void dump_v7_file(int fd)
if (lseek64(fd, offset, SEEK_SET) == (off64_t)-1)
die("cannot goto options offset %lld", offset);
dump_options(fd);
+ dump_sections(fd);
}
static void free_sections(void)
--
2.31.1
next prev parent reply other threads:[~2021-09-14 13:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-14 13:21 [PATCH v2 00/10] trace-cmd dump - v7 update Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` [PATCH v2 01/10] trace-cmd dump: Add helpers for processing trace file version 7 Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` [PATCH v2 02/10] trace-cmd dump: Print compression header Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` [PATCH v2 03/10] trace-cmd dump: Add helpers for processing trace file sections Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` [PATCH v2 04/10] trace-cmd dump: Read recursively all options sections Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` [PATCH v2 05/10] trace-cmd dump: Read extended BUFFER option Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` [PATCH v2 06/10] trace-cmd dump: Dump sections Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` [PATCH v2 07/10] trace-cmd dump: Dump trace file version 7 Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` Tzvetomir Stoyanov (VMware) [this message]
2021-09-14 13:21 ` [PATCH v2 09/10] trace-cmd dump: Add new argument --sections Tzvetomir Stoyanov (VMware)
2021-09-14 13:21 ` [PATCH v2 10/10] trace-cmd dump: Align better the output of flyrecord dump Tzvetomir Stoyanov (VMware)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210914132148.3968401-9-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.