LeakSanitizer in macos: <unknown module> for objective-c function in stacktrace

95 views Asked by At

clang is:

└──( /opt/homebrew/Cellar/llvm/13.0.1_1/bin/clang++ --version
Homebrew clang version 13.0.1
Target: arm64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /opt/homebrew/Cellar/llvm/13.0.1_1/bin

ASAN_OPTIONS is detect_stack_use_after_return=false detect_leaks=1

CMakeLists.txt has:

    add_compile_options(-fsanitize=address -fsanitize=leak -g)
    add_link_options(-fsanitize=address)

after the program exits, lots of leaks report, but in stacktrace, all objective-c function show as <unknown module>, and the address 0x3f368001a2e367b4 also seems wrong:

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x10343b678 in wrap_malloc+0x8c (libclang_rt.asan_osx_dynamic.dylib:arm64+0x3f678)
    #1 0x19ff4d638 in _Block_copy+0x3c (libsystem_blocks.dylib:arm64+0x1638)
    #2 0x3f368001a2e367b4  (<unknown module>)
    #3 0x5c5b8001a2e363c4  (<unknown module>)
    #4 0xea608001a2dec090  (<unknown module>)
    #5 0x8e440001a2debf14  (<unknown module>)
    #6 0x875a8001a2debdd0  (<unknown module>)
    #7 0x2498001a2debd28  (<unknown module>)
    #8 0x2a408001a2e3eab8  (<unknown module>)
    #9 0x731e8001a31bbce4  (<unknown module>)
    #10 0x48600001029f37dc  (<unknown module>)
    #11 0x102942cac in bgfx::gl::RendererContextGL::setRenderContextSize(unsigned int, unsigned int, unsigned int) renderer_gl.cpp:3475
    #12 0x1028f97d0 in bgfx::gl::RendererContextGL::init(bgfx::Init const&) renderer_gl.cpp:1817
    #13 0x1028f9024 in bgfx::gl::rendererCreate(bgfx::Init const&) renderer_gl.cpp:4044
    #14 0x102865bc0 in bgfx::rendererCreate(bgfx::Init const&) bgfx.cpp:2606
    #15 0x102866714 in bgfx::Context::rendererExecCommands(bgfx::CommandBuffer&) bgfx.cpp:2657

but while debugging, these symbols are correct shown in debugger: enter image description here

so how to make them right in LeakSanitizer's report? thanks very much.

0

There are 0 answers