blade-build icon indicating copy to clipboard operation
blade-build copied to clipboard

请问如何在blade中应用AddressSanitizer

Open kaocs opened this issue 5 years ago • 5 comments

如题

kaocs avatar Dec 25 '19 05:12 kaocs

修改 BLADE_ROOT 如下

cc_config(
    cppflags = [
        # Other flags...
        '-fsanitize=address',        
    ],
    # Other configurations...
    linkflags = [
        # Other flags...
        '-fsanitize=address -static-libasan', 
    ]
)

此外,需要注意的是,使用 AddressSanitizer 时,不能链接其他的内存管理库,例如 tcmalloc/jemalloc

WindLeeWT avatar Dec 26 '19 12:12 WindLeeWT

考虑支持命令行启用

chen3feng avatar Jan 16 '20 14:01 chen3feng

blade启动前,先执行下面命令,不知是否可行 export CPP="cpp -fsanitize=address" export CXX="c++ -fsanitize=address" export CC="gcc -fsanitize=address" export LD="c++ -fsanitize=address"

paleyl avatar Jun 30 '20 08:06 paleyl

修改 BLADE_ROOT 如下

cc_config(
    cppflags = [
        # Other flags...
        '-fsanitize=address',        
    ],
    # Other configurations...
    linkflags = [
        # Other flags...
        '-fsanitize=address -static-libasan', 
    ]
)

此外,需要注意的是,使用 AddressSanitizer 时,不能链接其他的内存管理库,例如 tcmalloc/jemalloc

请问这个'-fsanitize=address -static-libasan', 对gcc的版本有要求吗? Linking Shared Library build64_release/app/brand/common/libdatetime.so g++: error: unrecognized command line option '-fsanitize=address -static-libasan'

paleyl avatar Jun 30 '20 09:06 paleyl

分开写呢?分别用引号包括,逗号分割

On Tue, Jun 30, 2020, 17:28 paleyl [email protected] wrote:

修改 BLADE_ROOT 如下

cc_config(

cppflags = [

    # Other flags...

    '-fsanitize=address',

],

# Other configurations...

linkflags = [

    # Other flags...

    '-fsanitize=address -static-libasan',

]

)

此外,需要注意的是,使用 AddressSanitizer 时,不能链接其他的内存管理库,例如 tcmalloc/jemalloc

请问这个'-fsanitize=address -static-libasan', 对gcc的版本有要求吗? Linking Shared Library build64_release/app/brand/common/libdatetime.so g++: error: unrecognized command line option '-fsanitize=address -static-libasan'

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chen3feng/blade-build/issues/578#issuecomment-651676929, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPH4SVMKBJ2T6OXZSADRNTRZGV3JANCNFSM4J7CRMNQ .

chen3feng avatar Jul 01 '20 06:07 chen3feng