How do I get line numbers in the debug output with clang's -fsanitize=address?

后端 未结 5 1854
囚心锁ツ
囚心锁ツ 2021-02-05 18:02

I am trying to debug a memory error detected by clang with asan, but missed by valgrind. But I cannot get my clang built bina

5条回答
  •  Happy的楠姐
    2021-02-05 18:36

    If we look at the clang AddressSanitizer documentation it says:

    To make AddressSanitizer symbolize its output you need to set the ASAN_SYMBOLIZER_PATH environment variable to point to the llvm-symbolizer binary (or make sure llvm-symbolizer is in your $PATH):

    and shows the the following example:

    ASAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer ./a.out

    As the OP noted, the install location may vary, but once you know where llvm-symbolizer is located the steps are the same.

提交回复
热议问题