aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2018-09-17 02:49:17 +0000
committerDean Michael Berris <dberris@google.com>2018-09-17 02:49:17 +0000
commit31c8a31facbcf213ff5e2c9f066c4577f8208d99 (patch)
tree6a9996dc50b7597c54844f71c86ebc9677660115
parent04d99b83fe3c5d4a32d8c3a1c53e70f25503c17c (diff)
[XRay] Fix FDR initialization
Follow-up to D51606. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@342355 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/xray/xray_fdr_logging.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/xray/xray_fdr_logging.cc b/lib/xray/xray_fdr_logging.cc
index be6b001db..4b308b27f 100644
--- a/lib/xray/xray_fdr_logging.cc
+++ b/lib/xray/xray_fdr_logging.cc
@@ -1203,11 +1203,22 @@ bool fdrLogDynamicInitializer() XRAY_NEVER_INSTRUMENT {
};
auto RegistrationResult = __xray_log_register_mode("xray-fdr", Impl);
if (RegistrationResult != XRayLogRegisterStatus::XRAY_REGISTRATION_OK &&
- Verbosity())
+ Verbosity()) {
Report("Cannot register XRay FDR mode to 'xray-fdr'; error = %d\n",
RegistrationResult);
- if (flags()->xray_fdr_log || !internal_strcmp(flags()->xray_mode, "xray-fdr"))
- __xray_set_log_impl(Impl);
+ return false;
+ }
+
+ if (flags()->xray_fdr_log ||
+ !internal_strcmp(flags()->xray_mode, "xray-fdr")) {
+ auto SelectResult = __xray_log_select_mode("xray-fdr");
+ if (SelectResult != XRayLogRegisterStatus::XRAY_REGISTRATION_OK &&
+ Verbosity()) {
+ Report("Cannot select XRay FDR mode as 'xray-fdr'; error = %d\n",
+ SelectResult);
+ return false;
+ }
+ }
return true;
}