Skip to content

Commit

Permalink
[wimal] Enable address sanitizer by environment variable
Browse files Browse the repository at this point in the history
Set WIMAL_CC_ASAN=1 to enable address sanitizer.
  • Loading branch information
disigma committed Jul 12, 2024
1 parent 36bb033 commit 20c13aa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions wimal/cc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ void Cc::Run(const Context *context, std::vector<std::string> extraArgs) {
break;
}
}
// Set env WIMAL_CC_ASAN=1 to enable address sanitizer.
auto env = getenv("WIMAL_CC_ASAN");
if (env && strcmp(env, "1") == 0) {
args.emplace_back("-fsanitize=address");
args.emplace_back("-fno-omit-frame-pointer");
}
std::vector<char *> arguments;
arguments.reserve(args.size() + context->args.size() + extraArgs.size() + 1);
for (const auto &arg : args) {
Expand Down

0 comments on commit 20c13aa

Please sign in to comment.