[rtems-tools commit] record: Add support for zlib compressed input
Sebastian Huber
sebh at rtems.org
Thu Mar 19 06:38:42 UTC 2020
Module: rtems-tools
Branch: master
Commit: 390522a4fa401b20c6767b045305d1e433d9b6c6
Changeset: http://git.rtems.org/rtems-tools/commit/?id=390522a4fa401b20c6767b045305d1e433d9b6c6
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Mon Mar 16 08:43:11 2020 +0100
record: Add support for zlib compressed input
Update #3904.
---
trace/record/record-main-lttng.cc | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/trace/record/record-main-lttng.cc b/trace/record/record-main-lttng.cc
index 7d974af..7cfa48c 100644
--- a/trace/record/record-main-lttng.cc
+++ b/trace/record/record-main-lttng.cc
@@ -759,11 +759,11 @@ static void SignalHandler(int s) {
}
static const struct option kLongOpts[] = {
- {"elf", 1, NULL, 'e'}, {"help", 0, NULL, 'h'},
- {"host", 1, NULL, 'H'}, {"port", 1, NULL, 'p'},
- {"limit", 1, NULL, 'l'}, {"base64", 0, NULL, 'b'},
- {"config", 1, NULL, 'c'}, {"defaults", 0, NULL, 'd'},
- {NULL, 0, NULL, 0}};
+ {"elf", 1, NULL, 'e'}, {"help", 0, NULL, 'h'},
+ {"host", 1, NULL, 'H'}, {"port", 1, NULL, 'p'},
+ {"limit", 1, NULL, 'l'}, {"base64", 0, NULL, 'b'},
+ {"zlib", 0, NULL, 'z'}, {"config", 1, NULL, 'c'},
+ {"defaults", 0, NULL, 'd'}, {NULL, 0, NULL, 0}};
static void Usage(char** argv) {
std::cout << argv[0] << " [OPTION]... [INPUT-FILE]" << std::endl
@@ -781,6 +781,8 @@ static void Usage(char** argv) {
<< std::endl
<< " -b, --base64 input is base64 encoded"
<< std::endl
+ << " -z, --zlib input is zlib compressed"
+ << std::endl
<< " -e, --elf=ELF the ELF executable file"
<< std::endl
<< " -c, --config=CONFIG an INI-style configuration file"
@@ -805,13 +807,14 @@ int main(int argc, char** argv) {
const char* host = "127.0.0.1";
uint16_t port = 1234;
bool is_base64_encoded = false;
+ bool is_zlib_compressed = false;
const char* elf_file = nullptr;
const char* input_file = nullptr;
const char* config_file = nullptr;
int opt;
int longindex;
- while ((opt = getopt_long(argc, argv, "hH:p:l:be:c:d", &kLongOpts[0],
+ while ((opt = getopt_long(argc, argv, "hH:p:l:bze:c:d", &kLongOpts[0],
&longindex)) != -1) {
switch (opt) {
case 'h':
@@ -829,6 +832,9 @@ int main(int argc, char** argv) {
case 'b':
is_base64_encoded = true;
break;
+ case 'z':
+ is_zlib_compressed = true;
+ break;
case 'e':
elf_file = optarg;
break;
@@ -862,6 +868,12 @@ int main(int argc, char** argv) {
client.AddFilter(new Base64Filter());
}
+ if (is_zlib_compressed) {
+#ifdef HAVE_ZLIB_H
+ client.AddFilter(new ZlibFilter());
+#endif
+ }
+
client.ParseConfigFile(config_file);
client.GenerateMetadata();
More information about the vc
mailing list