Hoernchen has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-trx/+/32958 )
Change subject: ms: xray
......................................................................
ms: xray
Only used for development, will be removed later.
Change-Id: I2039204860f1d6c4a7f4fe78200f560d75a8b90e
---
M Transceiver52M/ms/ms_upper.cpp
1 file changed, 55 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/58/32958/1
diff --git a/Transceiver52M/ms/ms_upper.cpp b/Transceiver52M/ms/ms_upper.cpp
index 4b2f919..4944269 100644
--- a/Transceiver52M/ms/ms_upper.cpp
+++ b/Transceiver52M/ms/ms_upper.cpp
@@ -386,8 +386,51 @@
}
}
+#ifdef XRAY
+#include <fstream>
+#include <string>
+// #include <iostream>
+#include <sstream>
+#include "xray/xray_interface.h"
+// patch_premain=false !
+[[clang::xray_never_instrument]] void init_xray_patches()
+{
+ std::vector<int> result;
+ std::ifstream f("trace.txt");
+ std::stringstream ss;
+ if (f) {
+ ss << f.rdbuf();
+ f.close();
+ } else
+ return;
+
+ while (ss.good()) {
+ std::string substr;
+ if (getline(ss, substr, ','))
+ result.push_back(std::stoi(substr));
+ }
+
+ for (const auto id : result) {
+ std::cout << id << std::endl;
+ assert(__xray_patch_function(id) == XRayPatchingStatus::SUCCESS);
+ }
+ if (result.empty())
+ assert(__xray_patch() == XRayPatchingStatus::SUCCESS);
+}
+#define XRAY_INIT
\
+ {
\
+ assert(__xray_unpatch() == XRayPatchingStatus::SUCCESS);
\
+ init_xray_patches();
\
+ }
+#define XRAY_DEINIT assert(__xray_unpatch() == XRayPatchingStatus::SUCCESS);
+#else
+#define XRAY_INIT
+#define XRAY_DEINIT
+#endif
+
int main(int argc, char *argv[])
{
+ XRAY_INIT
auto tall_trxcon_ctx = talloc_init("trxcon context");
signal(SIGPIPE, sighandler);
signal(SIGINT, sighandler);
@@ -427,5 +470,6 @@
trx->stop_threads();
trx->stop_upper_threads();
+ XRAY_DEINIT
return status;
}
--
To view, visit
https://gerrit.osmocom.org/c/osmo-trx/+/32958
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I2039204860f1d6c4a7f4fe78200f560d75a8b90e
Gerrit-Change-Number: 32958
Gerrit-PatchSet: 1
Gerrit-Owner: Hoernchen <ewild(a)sysmocom.de>
Gerrit-MessageType: newchange