Compile Chrome with Sanitizers

13 views
Skip to first unread message

Yizhuo Zhai

unread,
Jan 31, 2023, 12:37:46 PM1/31/23
to Chromium-dev
Hi All:
I now would like to compile chrome with C/C++ sanitizers, by adding the -fsanitize option to the toochain.ninja (add the option after cflag, cflag_cc and ldflag). But seems it brings a lot of trouble to protoc. If I understand correctly, the protoc only helps to generate some files and do not need to be instrumented with sanitizers. Could anyone give me the hint how to only instrument the code that would be finally compiled to Chrome? For example, no bother to care about some third-party folder and the ninja file to add the flag. I appreciate any help here.

K. Moon

unread,
Jan 31, 2023, 4:45:31 PM1/31/23
to yzha...@ucr.edu, Chromium-dev
Have you looked at this documentation already?
https://chromium.googlesource.com/chromium/src/+/main/docs/asan.md

There's no need to add the -fsanitize option yourself, you just need to configure GN to turn on the sanitizers you're interested in.

On Tue, Jan 31, 2023 at 9:37 AM Yizhuo Zhai <yzha...@ucr.edu> wrote:
Hi All:
I now would like to compile chrome with C/C++ sanitizers, by adding the -fsanitize option to the toochain.ninja (add the option after cflag, cflag_cc and ldflag). But seems it brings a lot of trouble to protoc. If I understand correctly, the protoc only helps to generate some files and do not need to be instrumented with sanitizers. Could anyone give me the hint how to only instrument the code that would be finally compiled to Chrome? For example, no bother to care about some third-party folder and the ninja file to add the flag. I appreciate any help here.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/c73b6a35-6a78-457b-a562-b95cec639fbfn%40chromium.org.
Reply all
Reply to author
Forward
0 new messages