Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问如何在blade中应用AddressSanitizer #578

Open
kaocs opened this issue Dec 25, 2019 · 5 comments
Open

请问如何在blade中应用AddressSanitizer #578

kaocs opened this issue Dec 25, 2019 · 5 comments

Comments

@kaocs
Copy link

kaocs commented Dec 25, 2019

如题

@WindLeeWT
Copy link
Collaborator

修改 BLADE_ROOT 如下

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

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

@chen3feng
Copy link
Owner

考虑支持命令行启用

@paleyl
Copy link

paleyl commented Jun 30, 2020

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

@paleyl
Copy link

paleyl commented Jun 30, 2020

修改 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'

@chen3feng
Copy link
Owner

chen3feng commented Jul 1, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants