[PATCH] D115103: Leak Sanitizer port to Windows

Clemens Wasser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 23 04:41:49 PST 2021

clemenswasser added a comment.

@vitalybuka I have now removed all `LSAN_BASE` occurrences.
However the invocations of the compiled test executables don't seem to work either.
This doesn't work:
`// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do`
It generates this error:

  [build] $ ":" "RUN: at line 3"
  [build] $ "env" "LSAN_OPTIONS=:detect_leaks=1:use_stacks=0:use_registers=0" "not" "E:\git\llvm-project\llvm\build\ninja_debug\projects\compiler-rt\test\lsan\X86_64LsanConfig\TestCases\Output\leak_check_at_exit.cpp.tmp.exe" "foo"
  [build] note: command had no output on stdout or stderr
  [build] error: command failed with exit status: True

One of the problems seems to be that `%t` doesn't have a `.exe` ending on Windows.
I also tried changing `%t` to `%t.exe`, but that doesn't fix the problem and produces the same error.
I think the `not` command(?) is the part that fails?

When I run it on my own, it does work:

  PS E:\git\llvm-project> & 'E:\git\llvm-project\llvm\build\ninja_debug\projects\compiler-rt\test\lsan\X86_64LsanConfig\TestCases\Output\leak_check_at_exit.cpp.tmp.exe'
  Test alloc: 000061A000000000.
  ==25768==ERROR: LeakSanitizer: detected memory leaks
  Direct leak of 1337 byte(s) in 1 object(s) allocated from:
      #0 0x7ff6e2f745be in __asan_wrap_malloc E:\git\llvm-project\compiler-rt\lib\lsan\lsan_interceptors.cpp:75
      #1 0x7ff6e2f2aade in main E:\git\llvm-project\compiler-rt\test\lsan\TestCases\leak_check_at_exit.cpp:13:40
      #2 0x7ff6e2f79b5b in __scrt_common_main_seh d:\a01\_work\6\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
      #3 0x7fffde187033  (C:\WINDOWS\System32\KERNEL32.DLL+0x180017033)
      #4 0x7fffde8a2650  (C:\WINDOWS\SYSTEM32\ntdll.dll+0x180052650)
  SUMMARY: LeakSanitizer: 1337 byte(s) leaked in 1 allocation(s).



More information about the cfe-commits mailing list