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

后端 未结 5 1792
囚心锁ツ
囚心锁ツ 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条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 18:14

    Sometimes everything (path to the symboliser, environment variable etc) will be correct, but still you won't get file:line formatted output.

    So run

    dsymutil path/to/your.app/Contents/MacOS/binary
    

    and then run the app and you'll get nicely formatted output. This is also mentioned in the docs.

    Note that on macOS you may need to run dsymutil on your binary to have the file:line info in the AddressSanitizer reports.

    http://clang.llvm.org/docs/AddressSanitizer.html#symbolizing-the-reports

提交回复
热议问题