<div dir="ltr">Thanks Evgenii -- can you provide reproduction steps (do you enable CFI checking in the build?) so that I can try and debug this myself too?<div><br><div class="gmail_quote"><div dir="ltr">On Wed, Apr 19, 2017 at 7:05 AM Evgenii Stepanov <<a href="mailto:eugeni.stepanov@gmail.com" target="_blank">eugeni.stepanov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">And __xray_FunctionEntry has the same alignment problem, too. Also,<br>
SAVE_REGISTERS reserves extra 16 bytes of stack at the bottom that<br>
seem to be left unused for some reason.<br>
<br>
On Tue, Apr 18, 2017 at 1:19 PM, Evgenii Stepanov<br>
<<a href="mailto:eugeni.stepanov@gmail.com" target="_blank">eugeni.stepanov@gmail.com</a>> wrote:<br>
>         .cfi_def_cfa_offset 16<br>
>         subq    $56, %rsp<br>
>         .cfi_def_cfa_offset 32<br>
><br>
> This is also wrong. CFA offset should change by the same amount as<br>
> %rsp, i.e. 72 instead of 32. This fixes stack unwinding for me.<br>
><br>
> On Tue, Apr 18, 2017 at 12:01 PM, Evgenii Stepanov<br>
> <<a href="mailto:eugeni.stepanov@gmail.com" target="_blank">eugeni.stepanov@gmail.com</a>> wrote:<br>
>> Hi,<br>
>><br>
>> this test is reliably failing on the bots and on my desktop (x86_64).<br>
>><br>
>> __xray_FunctionExit:<br>
>>         .cfi_startproc<br>
>>         pushq   %rbp<br>
>>         .cfi_def_cfa_offset 16<br>
>>         subq    $56, %rsp<br>
>>         .cfi_def_cfa_offset 32<br>
>>         movupd  %xmm0, 40(%rsp)<br>
>>         movupd  %xmm1, 24(%rsp)<br>
>>         movq    %rax, 16(%rsp)<br>
>>         movq    %rdx, 8(%rsp)<br>
>> movq    _ZN6__xray19XRayPatchedFunctionE(%rip), %rax<br>
>>         testq %rax,%rax<br>
>> je      .Ltmp2<br>
>><br>
>>         movl    %r10d, %edi<br>
>>         movl    $1, %esi<br>
>>         callq   *%rax<br>
>><br>
>> This moves the stack pointer by 8 (pushq %rbp) + 56 + 8 (call *%rax) =<br>
>> 72 bytes. The callee gets an unaligned stack pointer.<br>
>><br>
>> The actual crash:<br>
>> 0x000000000041dae3 in readValueFromFile () at<br>
>> /code/llvm/projects/compiler-rt/lib/xray/xray_x86_64.cc:43<br>
>> 43  char Line[BufSize] = {};<br>
>> (gdb) bt<br>
>> #0  0x000000000041dae3 in readValueFromFile () at<br>
>> /code/llvm/projects/compiler-rt/lib/xray/xray_x86_64.cc:43<br>
>> #1  0x000000000041da7b in __xray::getTSCFrequency() () at<br>
>> /code/llvm/projects/compiler-rt/lib/xray/xray_x86_64.cc:65<br>
>> #2  0x0000000000421789 in __xray::__xray_fdr_internal::thresholdTicks() ()<br>
>>     at /code/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging_impl.h:349<br>
>> #3  0x0000000000420f65 in processFunctionHook () at<br>
>> /code/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging_impl.h:618<br>
>> #4  fdrLoggingHandleArg0 () at<br>
>> /code/llvm/projects/compiler-rt/lib/xray/xray_fdr_logging.cc:213<br>
>> #5  0x000000000041de81 in __xray_FunctionExit () at<br>
>> /code/llvm/projects/compiler-rt/lib/xray/xray_trampoline_x86_64.S:113<br>
>> #6  0x0000000000000101 in ?? ()<br>
>> #7  0x0000000000000000 in ?? ()<br>
>><br>
>> Dump of assembler code for function readValueFromFile():<br>
>>    0x000000000041dab0 <+0>: push   %rbp<br>
>>    0x000000000041dab1 <+1>: push   %r15<br>
>>    0x000000000041dab3 <+3>: push   %r14<br>
>>    0x000000000041dab5 <+5>: push   %rbx<br>
>>    0x000000000041dab6 <+6>: sub    $0x118,%rsp<br>
>>    0x000000000041dabd <+13>: mov    %rsi,%r14<br>
>>    0x000000000041dac0 <+16>: xor    %ebx,%ebx<br>
>>    0x000000000041dac2 <+18>: mov    $0x80000,%esi<br>
>>    0x000000000041dac7 <+23>: xor    %eax,%eax<br>
>>    0x000000000041dac9 <+25>: callq  0x4026b0 <open@plt><br>
>>    0x000000000041dace <+30>: mov    %eax,%r15d<br>
>>    0x000000000041dad1 <+33>: cmp    $0xffffffff,%r15d<br>
>>    0x000000000041dad5 <+37>: je     0x41dbee <readValueFromFile()+318><br>
>>    0x000000000041dadb <+43>: lea    0x10(%rsp),%rbx<br>
>>    0x000000000041dae0 <+48>: xorps  %xmm0,%xmm0<br>
>> => 0x000000000041dae3 <+51>: movaps %xmm0,0x100(%rsp)<br>
>>    0x000000000041daeb <+59>: movaps %xmm0,0xf0(%rsp)<br>
>>    0x000000000041daf3 <+67>: movaps %xmm0,0xe0(%rsp)<br>
>>    0x000000000041dafb <+75>: movaps %xmm0,0xd0(%rsp)<br>
>><br>
>> Also, as can be seen above, there is a stack unwinding issue (frame<br>
>> #6). I'm not sure what's the problem there.<br>
>><br>
>><br>
>> On Tue, Mar 28, 2017 at 10:19 PM, Dean Michael Berris via llvm-commits<br>
>> <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
>>> Author: dberris<br>
>>> Date: Wed Mar 29 00:19:24 2017<br>
>>> New Revision: 298977<br>
>>><br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=298977&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=298977&view=rev</a><br>
>>> Log:<br>
>>> [XRay][compiler-rt] Add an end-to-end test for FDR Logging<br>
>>><br>
>>> Summary:<br>
>>> This change exercises the end-to-end functionality defined in the FDR<br>
>>> logging implementation. We also prepare for being able to run traces<br>
>>> generated by the FDR logging implementation from being analysed with the<br>
>>> llvm-xray command that comes with the LLVM distribution.<br>
>>><br>
>>> This also unblocks D31385, D31384, and D31345.<br>
>>><br>
>>> Reviewers: kpw, pelikan<br>
>>><br>
>>> Subscribers: llvm-commits, mgorny<br>
>>><br>
>>> Differential Revision: <a href="https://reviews.llvm.org/D31452" rel="noreferrer" target="_blank">https://reviews.llvm.org/D31452</a><br>
>>><br>
>>> Added:<br>
>>>     compiler-rt/trunk/test/xray/TestCases/Linux/fdr-mode.cc<br>
>>> Modified:<br>
>>>     compiler-rt/trunk/include/CMakeLists.txt<br>
>>>     compiler-rt/trunk/include/xray/xray_log_interface.h<br>
>>>     compiler-rt/trunk/lib/xray/xray_fdr_logging.cc<br>
>>>     compiler-rt/trunk/lib/xray/xray_fdr_logging.h<br>
>>>     compiler-rt/trunk/lib/xray/xray_log_interface.cc<br>
>>>     compiler-rt/trunk/lib/xray/xray_utils.cc<br>
>>>     compiler-rt/trunk/test/xray/lit.cfg<br>
>>><br>
>>> Modified: compiler-rt/trunk/include/CMakeLists.txt<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/CMakeLists.txt?rev=298977&r1=298976&r2=298977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/CMakeLists.txt?rev=298977&r1=298976&r2=298977&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/include/CMakeLists.txt (original)<br>
>>> +++ compiler-rt/trunk/include/CMakeLists.txt Wed Mar 29 00:19:24 2017<br>
>>> @@ -12,7 +12,8 @@ set(SANITIZER_HEADERS<br>
>>>    sanitizer/tsan_interface_atomic.h)<br>
>>><br>
>>>  set(XRAY_HEADERS<br>
>>> -  xray/xray_interface.h)<br>
>>> +  xray/xray_interface.h<br>
>>> +  xray/xray_log_interface.h)<br>
>>><br>
>>>  set(COMPILER_RT_HEADERS<br>
>>>    ${SANITIZER_HEADERS}<br>
>>><br>
>>> Modified: compiler-rt/trunk/include/xray/xray_log_interface.h<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/xray/xray_log_interface.h?rev=298977&r1=298976&r2=298977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/include/xray/xray_log_interface.h?rev=298977&r1=298976&r2=298977&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/include/xray/xray_log_interface.h (original)<br>
>>> +++ compiler-rt/trunk/include/xray/xray_log_interface.h Wed Mar 29 00:19:24 2017<br>
>>> @@ -48,4 +48,13 @@ XRayLogFlushStatus __xray_log_flushLog()<br>
>>><br>
>>>  } // extern "C"<br>
>>><br>
>>> +namespace __xray {<br>
>>> +// Options used by the LLVM XRay FDR implementation.<br>
>>> +struct FDRLoggingOptions {<br>
>>> +  bool ReportErrors = false;<br>
>>> +  int Fd = -1;<br>
>>> +};<br>
>>> +<br>
>>> +} // namespace __xray<br>
>>> +<br>
>>>  #endif // XRAY_XRAY_LOG_INTERFACE_H<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.cc<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.cc?rev=298977&r1=298976&r2=298977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.cc?rev=298977&r1=298976&r2=298977&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/xray/xray_fdr_logging.cc (original)<br>
>>> +++ compiler-rt/trunk/lib/xray/xray_fdr_logging.cc Wed Mar 29 00:19:24 2017<br>
>>> @@ -51,19 +51,18 @@ std::unique_ptr<FDRLoggingOptions> FDROp<br>
>>>  XRayLogInitStatus fdrLoggingInit(std::size_t BufferSize, std::size_t BufferMax,<br>
>>>                                   void *Options,<br>
>>>                                   size_t OptionsSize) XRAY_NEVER_INSTRUMENT {<br>
>>> -  assert(OptionsSize == sizeof(FDRLoggingOptions));<br>
>>> +  if (OptionsSize != sizeof(FDRLoggingOptions))<br>
>>> +    return static_cast<XRayLogInitStatus>(__sanitizer::atomic_load(<br>
>>> +        &LoggingStatus, __sanitizer::memory_order_acquire));<br>
>>>    s32 CurrentStatus = XRayLogInitStatus::XRAY_LOG_UNINITIALIZED;<br>
>>> -  if (__sanitizer::atomic_compare_exchange_strong(<br>
>>> +  if (!__sanitizer::atomic_compare_exchange_strong(<br>
>>>            &LoggingStatus, &CurrentStatus,<br>
>>>            XRayLogInitStatus::XRAY_LOG_INITIALIZING,<br>
>>>            __sanitizer::memory_order_release))<br>
>>>      return static_cast<XRayLogInitStatus>(CurrentStatus);<br>
>>><br>
>>>    FDROptions.reset(new FDRLoggingOptions());<br>
>>> -  *FDROptions = *reinterpret_cast<FDRLoggingOptions *>(Options);<br>
>>> -  if (FDROptions->ReportErrors)<br>
>>> -    SetPrintfAndReportCallback(printToStdErr);<br>
>>> -<br>
>>> +  memcpy(FDROptions.get(), Options, OptionsSize);<br>
>>>    bool Success = false;<br>
>>>    BQ = std::make_shared<BufferQueue>(BufferSize, BufferMax, Success);<br>
>>>    if (!Success) {<br>
>>> @@ -77,6 +76,7 @@ XRayLogInitStatus fdrLoggingInit(std::si<br>
>>>    __sanitizer::atomic_store(&LoggingStatus,<br>
>>>                              XRayLogInitStatus::XRAY_LOG_INITIALIZED,<br>
>>>                              __sanitizer::memory_order_release);<br>
>>> +  Report("XRay FDR init successful.\n");<br>
>>>    return XRayLogInitStatus::XRAY_LOG_INITIALIZED;<br>
>>>  }<br>
>>><br>
>>> @@ -88,7 +88,7 @@ XRayLogFlushStatus fdrLoggingFlush() XRA<br>
>>>      return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;<br>
>>><br>
>>>    s32 Result = XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;<br>
>>> -  if (__sanitizer::atomic_compare_exchange_strong(<br>
>>> +  if (!__sanitizer::atomic_compare_exchange_strong(<br>
>>>            &LogFlushStatus, &Result, XRayLogFlushStatus::XRAY_LOG_FLUSHING,<br>
>>>            __sanitizer::memory_order_release))<br>
>>>      return static_cast<XRayLogFlushStatus>(Result);<br>
>>> @@ -140,7 +140,7 @@ XRayLogFlushStatus fdrLoggingFlush() XRA<br>
>>><br>
>>>  XRayLogInitStatus fdrLoggingFinalize() XRAY_NEVER_INSTRUMENT {<br>
>>>    s32 CurrentStatus = XRayLogInitStatus::XRAY_LOG_INITIALIZED;<br>
>>> -  if (__sanitizer::atomic_compare_exchange_strong(<br>
>>> +  if (!__sanitizer::atomic_compare_exchange_strong(<br>
>>>            &LoggingStatus, &CurrentStatus,<br>
>>>            XRayLogInitStatus::XRAY_LOG_FINALIZING,<br>
>>>            __sanitizer::memory_order_release))<br>
>>> @@ -168,8 +168,7 @@ XRayLogInitStatus fdrLoggingReset() XRAY<br>
>>>    BQ.reset();<br>
>>><br>
>>>    // Spin until the flushing status is flushed.<br>
>>> -  s32 CurrentFlushingStatus =<br>
>>> -      XRayLogFlushStatus::XRAY_LOG_FLUSHED;<br>
>>> +  s32 CurrentFlushingStatus = XRayLogFlushStatus::XRAY_LOG_FLUSHED;<br>
>>>    while (__sanitizer::atomic_compare_exchange_weak(<br>
>>>        &LogFlushStatus, &CurrentFlushingStatus,<br>
>>>        XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING,<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/xray/xray_fdr_logging.h<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.h?rev=298977&r1=298976&r2=298977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_fdr_logging.h?rev=298977&r1=298976&r2=298977&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/xray/xray_fdr_logging.h (original)<br>
>>> +++ compiler-rt/trunk/lib/xray/xray_fdr_logging.h Wed Mar 29 00:19:24 2017<br>
>>> @@ -26,14 +26,6 @@<br>
>>>  // default mode of always writing fixed-size records.<br>
>>><br>
>>>  namespace __xray {<br>
>>> -<br>
>>> -// Options used by the FDR implementation.<br>
>>> -struct FDRLoggingOptions {<br>
>>> -  bool ReportErrors = false;<br>
>>> -  int Fd = -1;<br>
>>> -};<br>
>>> -<br>
>>> -// Flight Data Recorder mode implementation interfaces.<br>
>>>  XRayLogInitStatus fdrLoggingInit(size_t BufferSize, size_t BufferMax,<br>
>>>                                   void *Options, size_t OptionsSize);<br>
>>>  XRayLogInitStatus fdrLoggingFinalize();<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/xray/xray_log_interface.cc<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_log_interface.cc?rev=298977&r1=298976&r2=298977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_log_interface.cc?rev=298977&r1=298976&r2=298977&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/xray/xray_log_interface.cc (original)<br>
>>> +++ compiler-rt/trunk/lib/xray/xray_log_interface.cc Wed Mar 29 00:19:24 2017<br>
>>> @@ -35,8 +35,9 @@ void __xray_set_log_impl(XRayLogImpl Imp<br>
>>>    *GlobalXRayImpl = Impl;<br>
>>>  }<br>
>>><br>
>>> -XRayLogInitStatus __xray_init(size_t BufferSize, size_t MaxBuffers, void *Args,<br>
>>> -                              size_t ArgsSize) XRAY_NEVER_INSTRUMENT {<br>
>>> +XRayLogInitStatus __xray_log_init(size_t BufferSize, size_t MaxBuffers,<br>
>>> +                                  void *Args,<br>
>>> +                                  size_t ArgsSize) XRAY_NEVER_INSTRUMENT {<br>
>>>    __sanitizer::SpinMutexLock Guard(&XRayImplMutex);<br>
>>>    if (!GlobalXRayImpl)<br>
>>>      return XRayLogInitStatus::XRAY_LOG_UNINITIALIZED;<br>
>>><br>
>>> Modified: compiler-rt/trunk/lib/xray/xray_utils.cc<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_utils.cc?rev=298977&r1=298976&r2=298977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/xray_utils.cc?rev=298977&r1=298976&r2=298977&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/lib/xray/xray_utils.cc (original)<br>
>>> +++ compiler-rt/trunk/lib/xray/xray_utils.cc Wed Mar 29 00:19:24 2017<br>
>>> @@ -93,8 +93,6 @@ bool readValueFromFile(const char *Filen<br>
>>>  }<br>
>>><br>
>>>  int getLogFD() XRAY_NEVER_INSTRUMENT {<br>
>>> -  // FIXME: Figure out how to make this less stderr-dependent.<br>
>>> -  SetPrintfAndReportCallback(printToStdErr);<br>
>>>    // Open a temporary file once for the log.<br>
>>>    static char TmpFilename[256] = {};<br>
>>>    static char TmpWildcardPattern[] = "XXXXXX";<br>
>>> @@ -119,8 +117,7 @@ int getLogFD() XRAY_NEVER_INSTRUMENT {<br>
>>>             TmpFilename);<br>
>>>      return -1;<br>
>>>    }<br>
>>> -  if (Verbosity())<br>
>>> -    fprintf(stderr, "XRay: Log file in '%s'\n", TmpFilename);<br>
>>> +  Report("XRay: Log file in '%s'\n", TmpFilename);<br>
>>><br>
>>>    return Fd;<br>
>>>  }<br>
>>><br>
>>> Added: compiler-rt/trunk/test/xray/TestCases/Linux/fdr-mode.cc<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/TestCases/Linux/fdr-mode.cc?rev=298977&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/TestCases/Linux/fdr-mode.cc?rev=298977&view=auto</a><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/test/xray/TestCases/Linux/fdr-mode.cc (added)<br>
>>> +++ compiler-rt/trunk/test/xray/TestCases/Linux/fdr-mode.cc Wed Mar 29 00:19:24 2017<br>
>>> @@ -0,0 +1,62 @@<br>
>>> +// RUN: %clangxx_xray -std=c++11 %s -o %t<br>
>>> +// RUN: XRAY_OPTIONS="patch_premain=false xray_naive_log=false xray_logfile_base=fdr-logging-test- xray_fdr_log=true verbosity=1" %run %t 2>&1 | FileCheck %s<br>
>>> +// FIXME: %llvm_xray convert -instr_map=%t "`ls fdr-logging-test-* | head -1`" | FileCheck %s --check-prefix TRACE<br>
>>> +// RUN: rm fdr-logging-test-*<br>
>>> +<br>
>>> +#include "xray/xray_log_interface.h"<br>
>>> +#include <cassert><br>
>>> +#include <chrono><br>
>>> +#include <cstdio><br>
>>> +#include <iostream><br>
>>> +#include <stdlib.h><br>
>>> +#include <thread><br>
>>> +#include <time.h><br>
>>> +<br>
>>> +constexpr auto kBufferSize = 16384;<br>
>>> +constexpr auto kBufferMax = 10;<br>
>>> +<br>
>>> +thread_local uint64_t var = 0;<br>
>>> +[[clang::xray_always_instrument]] void __attribute__((noinline)) fC() { ++var; }<br>
>>> +<br>
>>> +[[clang::xray_always_instrument]] void __attribute__((noinline)) fB() { fC(); }<br>
>>> +<br>
>>> +[[clang::xray_always_instrument]] void __attribute__((noinline)) fA() { fB(); }<br>
>>> +<br>
>>> +int main(int argc, char *argv[]) {<br>
>>> +  using namespace __xray;<br>
>>> +  FDRLoggingOptions Options;<br>
>>> +  std::cout << "Logging before init." << std::endl;<br>
>>> +  // CHECK: Logging before init.<br>
>>> +  auto status = __xray_log_init(kBufferSize, kBufferMax, &Options,<br>
>>> +                                sizeof(FDRLoggingOptions));<br>
>>> +  assert(status == XRayLogInitStatus::XRAY_LOG_INITIALIZED);<br>
>>> +  std::cout << "Init status " << status << std::endl;<br>
>>> +  // CHECK: Init status {{.*}}<br>
>>> +  std::cout << "Patching..." << std::endl;<br>
>>> +  // CHECK: Patching...<br>
>>> +  __xray_patch();<br>
>>> +  fA();<br>
>>> +  fC();<br>
>>> +  fB();<br>
>>> +  fA();<br>
>>> +  fC();<br>
>>> +  std::thread other_thread([]() {<br>
>>> +    fC();<br>
>>> +    fB();<br>
>>> +    fA();<br>
>>> +  });<br>
>>> +  other_thread.join();<br>
>>> +  std::cout << "Joined" << std::endl;<br>
>>> +  // CHECK: Joined<br>
>>> +  std::cout << "Finalize status " << __xray_log_finalize() << std::endl;<br>
>>> +  // CHECK: Finalize status {{.*}}<br>
>>> +  fC();<br>
>>> +  std::cout << "Main execution var = " << var << std::endl;<br>
>>> +  // CHECK: Main execution var = 6<br>
>>> +  std::cout << "Flush status " << __xray_log_flushLog() << std::endl;<br>
>>> +  // CHECK: Flush status {{.*}}<br>
>>> +  __xray_unpatch();<br>
>>> +  return 0;<br>
>>> +}<br>
>>> +<br>
>>> +// TRACE: { function }<br>
>>><br>
>>> Modified: compiler-rt/trunk/test/xray/lit.cfg<br>
>>> URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/lit.cfg?rev=298977&r1=298976&r2=298977&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/xray/lit.cfg?rev=298977&r1=298976&r2=298977&view=diff</a><br>
>>> ==============================================================================<br>
>>> --- compiler-rt/trunk/test/xray/lit.cfg (original)<br>
>>> +++ compiler-rt/trunk/test/xray/lit.cfg Wed Mar 29 00:19:24 2017<br>
>>> @@ -16,6 +16,9 @@ clang_xray_cxxflags = config.cxx_mode_fl<br>
>>>  def build_invocation(compile_flags):<br>
>>>    return ' ' + ' '.join([config.clang] + compile_flags) + ' '<br>
>>><br>
>>> +# Assume that llvm-xray is in the config.llvm_tools_dir.<br>
>>> +llvm_xray = os.path.join(config.llvm_tools_dir, 'llvm-xray')<br>
>>> +<br>
>>>  # Setup substitutions.<br>
>>>  config.substitutions.append(<br>
>>>      ('%clang ', build_invocation([config.target_cflags])))<br>
>>> @@ -26,6 +29,8 @@ config.substitutions.append(<br>
>>>      ('%clang_xray ', build_invocation(clang_xray_cflags)))<br>
>>>  config.substitutions.append(<br>
>>>      ('%clangxx_xray', build_invocation(clang_xray_cxxflags)))<br>
>>> +config.substitutions.append(<br>
>>> +    ('%llvm_xray', llvm_xray))<br>
>>><br>
>>>  # Default test suffixes.<br>
>>>  config.suffixes = ['.c', '.cc', '.cpp']<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> llvm-commits mailing list<br>
>>> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div></div>