summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-03-15 18:07:37 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-03-17 11:36:05 +0100
commitd96417111a51a1f28e1d0a10eb956169679d683e (patch)
tree7771f11d1ca9284228f8646545e61118ae53ba2e
parentrecord: Add base64 filter class (diff)
downloadrtems-tools-d96417111a51a1f28e1d0a10eb956169679d683e.tar.bz2
record: Add support for base64 encoded input
Update #3904.
-rw-r--r--trace/record/record-main-lttng.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/trace/record/record-main-lttng.cc b/trace/record/record-main-lttng.cc
index 15536f4..7d974af 100644
--- a/trace/record/record-main-lttng.cc
+++ b/trace/record/record-main-lttng.cc
@@ -2,7 +2,7 @@
/*
* Copyright (c) 2019 Ravindra Kumar Meena <rmeena840@gmail.com>
- * Copyright (C) 2018, 2019 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2018, 2020 embedded brains GmbH (http://www.embedded-brains.de)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -759,10 +759,11 @@ static void SignalHandler(int s) {
}
static const struct option kLongOpts[] = {
- {"elf", 1, NULL, 'e'}, {"help", 0, NULL, 'h'},
- {"host", 1, NULL, 'H'}, {"limit", 1, NULL, 'l'},
- {"port", 1, NULL, 'p'}, {"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'},
+ {"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
@@ -778,6 +779,8 @@ static void Usage(char** argv) {
<< std::endl
<< " -l, --limit=LIMIT limit in bytes to process"
<< std::endl
+ << " -b, --base64 input is base64 encoded"
+ << std::endl
<< " -e, --elf=ELF the ELF executable file"
<< std::endl
<< " -c, --config=CONFIG an INI-style configuration file"
@@ -801,6 +804,7 @@ static void PrintDefaults() {
int main(int argc, char** argv) {
const char* host = "127.0.0.1";
uint16_t port = 1234;
+ bool is_base64_encoded = false;
const char* elf_file = nullptr;
const char* input_file = nullptr;
const char* config_file = nullptr;
@@ -822,6 +826,9 @@ int main(int argc, char** argv) {
case 'l':
client.set_limit(strtoull(optarg, NULL, 0));
break;
+ case 'b':
+ is_base64_encoded = true;
+ break;
case 'e':
elf_file = optarg;
break;
@@ -851,6 +858,10 @@ int main(int argc, char** argv) {
}
try {
+ if (is_base64_encoded) {
+ client.AddFilter(new Base64Filter());
+ }
+
client.ParseConfigFile(config_file);
client.GenerateMetadata();