ruki 2 gadi atpakaļ
vecāks
revīzija
2f2e8a796e

+ 69 - 1
guide/build_policies.md

@@ -208,7 +208,7 @@ set_policy("build.optimization.lto", true)
 
 We can also turn it on quickly via the command line option.
 
-```console
+```bash
 $ xmake f --policies=build.optimization.lto
 ```
 
@@ -228,6 +228,74 @@ Whereas by default Cuda binary/shared is devlink enabled, we can also disable it
 
 For a detailed background on this, see: [#1976](https://github.com/xmake-io/xmake/issues/1976)
 
+### build.sanitizer.address
+
+Address Sanitizer (ASan) is a fast memory error detection tool that is built-in by the compiler, and usually requires `-fsanitize-address` to be configured in both the build and link flags to enable it correctly.
+
+We can quickly enable it globally by turning on this policy, which will result in compiled programs that directly support ASan detection.
+
+For example, we can enable it from the command line:
+
+```bash
+$ xmake f --policies=build.sanitizer.address
+```
+
+It can also be enabled globally via the interface configuration:
+
+```lua
+set_policy("build.sanitizer.address", true)
+```
+
+Of course, we can also enable it for a specific target individually.
+
+Also, if we configure it globally, we can enable it for all dependencies at the same time.
+
+```lua
+set_policy("build.sanitizer.address", true)
+
+add_requires("zlib")
+add_requires("libpng")
+```
+
+It is equivalent to setting the asan configuration for each package in turn.
+
+```lua
+add_requires("zlib", {configs = {asan = true}})
+add_requires("libpng", {configs = {asan = true}})
+```
+
+!> `add_rules("mode.asan", "mode.tsan", "mode.ubsan", "mode.msan")` will be deprecated, and these new strategies will be used whenever possible, as these build modes cannot take effect on dependent packages simultaneously.
+
+Alternatively, we can validate multiple sanitizer inspections at the same time, e.g.:
+
+
+```lua
+set_policy("build.sanitizer.address", true)
+set_policy("build.sanitizer.undefined", true)
+```
+
+or
+
+```bash
+$ xmake f --policies=build.sanitizer.address,build.sanitizer.undefined
+```
+
+### build.sanitizer.thread
+
+Similar to [build.sanitizer.address](https://xmake.io/#/guide/build_policies?id=buildsanitizeraddress) for detecting thread safety issues.
+
+### build.sanitizer.memory
+
+Similar to [build.sanitizer.address](https://xmake.io/#/guide/build_policies?id=buildsanitizeraddress) for detecting memory issues.
+
+### build.sanitizer.leak
+
+Similar to [build.sanitizer.address](https://xmake.io/#/guide/build_policies?id=buildsanitizeraddress) for detecting memory leaks.
+
+### build.sanitizer.undefined
+
+Similar to [build.sanitizer.address](https://xmake.io/#/guide/build_policies?id=buildsanitizeraddress) for detecting undefined issues.
+
 ### preprocessor.linemarkers
 
 If this policy is turned off, then the cache will generate preprocessor files without linemarkers, which will greatly reduce the size of the preprocessor files.

+ 37 - 1
mirror/guide/build_policies.html

@@ -215,7 +215,7 @@ set_warnings("all", "extra")
 <pre><code class="lang-lua">set_policy("build.optimization.lto", true)
 </code></pre>
 <p>We can also turn it on quickly via the command line option.</p>
-<pre><code class="lang-console">$ xmake f --policies=build.optimization.lto
+<pre><code class="lang-bash">$ xmake f --policies=build.optimization.lto
 </code></pre>
 <h3 id="buildcudadevlink">build.cuda.devlink</h3>
 <p>Version 2.7.7 can be configured to show that device links to specific targets are turned on.</p>
@@ -226,6 +226,42 @@ set_warnings("all", "extra")
 </code></pre>
 <p>Whereas by default Cuda binary/shared is devlink enabled, we can also disable it via the policy display.</p>
 <p>For a detailed background on this, see: <a href="https://github.com/xmake-io/xmake/issues/1976">#1976</a></p>
+<h3 id="buildsanitizeraddress">build.sanitizer.address</h3>
+<p>Address Sanitizer (ASan) is a fast memory error detection tool that is built-in by the compiler, and usually requires <code>-fsanitize-address</code> to be configured in both the build and link flags to enable it correctly.</p>
+<p>We can quickly enable it globally by turning on this policy, which will result in compiled programs that directly support ASan detection.</p>
+<p>For example, we can enable it from the command line:</p>
+<pre><code class="lang-bash">$ xmake f --policies=build.sanitizer.address
+</code></pre>
+<p>It can also be enabled globally via the interface configuration:</p>
+<pre><code class="lang-lua">set_policy("build.sanitizer.address", true)
+</code></pre>
+<p>Of course, we can also enable it for a specific target individually.</p>
+<p>Also, if we configure it globally, we can enable it for all dependencies at the same time.</p>
+<pre><code class="lang-lua">set_policy("build.sanitizer.address", true)
+
+add_requires("zlib")
+add_requires("libpng")
+</code></pre>
+<p>It is equivalent to setting the asan configuration for each package in turn.</p>
+<pre><code class="lang-lua">add_requires("zlib", {configs = {asan = true}})
+add_requires("libpng", {configs = {asan = true}})
+</code></pre>
+<p>!> <code>add_rules("mode.asan", "mode.tsan", "mode.ubsan", "mode.msan")</code> will be deprecated, and these new strategies will be used whenever possible, as these build modes cannot take effect on dependent packages simultaneously.</p>
+<p>Alternatively, we can validate multiple sanitizer inspections at the same time, e.g.:</p>
+<pre><code class="lang-lua">set_policy("build.sanitizer.address", true)
+set_policy("build.sanitizer.undefined", true)
+</code></pre>
+<p>or</p>
+<pre><code class="lang-bash">$ xmake f --policies=build.sanitizer.address,build.sanitizer.undefined
+</code></pre>
+<h3 id="buildsanitizerthread">build.sanitizer.thread</h3>
+<p>Similar to <a href="https://xmake.io/#/guide/build_policies?id=buildsanitizeraddress">build.sanitizer.address</a> for detecting thread safety issues.</p>
+<h3 id="buildsanitizermemory">build.sanitizer.memory</h3>
+<p>Similar to <a href="https://xmake.io/#/guide/build_policies?id=buildsanitizeraddress">build.sanitizer.address</a> for detecting memory issues.</p>
+<h3 id="buildsanitizerleak">build.sanitizer.leak</h3>
+<p>Similar to <a href="https://xmake.io/#/guide/build_policies?id=buildsanitizeraddress">build.sanitizer.address</a> for detecting memory leaks.</p>
+<h3 id="buildsanitizerundefined">build.sanitizer.undefined</h3>
+<p>Similar to <a href="https://xmake.io/#/guide/build_policies?id=buildsanitizeraddress">build.sanitizer.address</a> for detecting undefined issues.</p>
 <h3 id="preprocessorlinemarkers">preprocessor.linemarkers</h3>
 <p>If this policy is turned off, then the cache will generate preprocessor files without linemarkers, which will greatly reduce the size of the preprocessor files.<br>This will greatly reduce the size of the preprocessor file and improve the efficiency of the cache, but the downside is that the source line information will be lost and if you encounter a compilation error, you will not be able to see the exact line of code that went wrong.</p>
 <h3 id="preprocessorgccdirectives_only">preprocessor.gcc.directives_only</h3>

+ 36 - 1
mirror/zh-cn/guide/build_policies.html

@@ -218,7 +218,7 @@ set_warnings("all", "extra")
 <pre><code class="lang-lua">set_policy("build.optimization.lto", true)
 </code></pre>
 <p>我们也可以通过命令行选项快速开启。</p>
-<pre><code class="lang-console">$ xmake f --policies=build.optimization.lto
+<pre><code class="lang-bash">$ xmake f --policies=build.optimization.lto
 </code></pre>
 <h3 id="buildcudadevlink">build.cuda.devlink</h3>
 <p>2.7.7 版本可以通过这个配置,显示开启对特定目标的设备链接。</p>
@@ -229,6 +229,41 @@ set_warnings("all", "extra")
 </code></pre>
 <p>而默认 Cuda binary/shared 是开启 devlink 的,我们也可以通过策略显示禁用它。</p>
 <p>关于这个的详细背景说明,见:<a href="https://github.com/xmake-io/xmake/issues/1976">#1976</a></p>
+<h3 id="buildsanitizeraddress">build.sanitizer.address</h3>
+<p>Address Sanitizer(ASan)是一个快速的内存错误检测工具,由编译器内置支持,通常我们需要在编译和链接的 flags 中同时配置 <code>-fsanitize-address</code> 才能正确开启。</p>
+<p>而我们可以通过开启这个策略,就可以快速全局启用它,这会使得编译出来的程序,直接支持 ASan 检测。</p>
+<p>例如,我们可以通过命令行的方式去启用:</p>
+<pre><code class="lang-bash">$ xmake f --policies=build.sanitizer.address
+</code></pre>
+<p>也可以通过接口配置去全局启用:</p>
+<pre><code class="lang-lua">set_policy("build.sanitizer.address", true)
+</code></pre>
+<p>当然,我们也可以单独对某个特定的 target 去配置开启。</p>
+<p>另外,如果全局配置它,我们就可以同时对所有依赖包也生效。</p>
+<pre><code class="lang-lua">set_policy("build.sanitizer.address", true)
+
+add_requires("zlib")
+add_requires("libpng")
+</code></pre>
+<p>它等价于,对每个包依次设置 asan 配置。</p>
+<pre><code class="lang-lua">add_requires("zlib", {configs = {asan = true}})
+add_requires("libpng", {configs = {asan = true}})
+</code></pre>
+<p>!> <code>add_rules("mode.asan", "mode.tsan", "mode.ubsan", "mode.msan")</code> 将被废弃,尽可能使用这些新的策略,因为这些构建模式无法同步对依赖包生效。</p>
+<p>另外,我们也可以同时生效多个 sanitizer 检测,例如:</p>
+<pre><code class="lang-lua">set_policy("build.sanitizer.address", true)
+set_policy("build.sanitizer.undefined", true)
+</code></pre>
+<p>或者</p>
+<pre><code>$ xmake f --policies=build.sanitizer.address,build.sanitizer.undefined
+</code></pre><h3 id="buildsanitizerthread">build.sanitizer.thread</h3>
+<p>与 <a href="https://xmake.io/#/zh-cn/guide/build_policies?id=buildsanitizeraddress">build.sanitizer.address</a> 类似,用于检测线程安全问题。</p>
+<h3 id="buildsanitizermemory">build.sanitizer.memory</h3>
+<p>与 <a href="https://xmake.io/#/zh-cn/guide/build_policies?id=buildsanitizeraddress">build.sanitizer.address</a> 类似,用于检测内存问题。</p>
+<h3 id="buildsanitizerleak">build.sanitizer.leak</h3>
+<p>与 <a href="https://xmake.io/#/zh-cn/guide/build_policies?id=buildsanitizeraddress">build.sanitizer.address</a> 类似,用于检测内存泄漏问题。</p>
+<h3 id="buildsanitizerundefined">build.sanitizer.undefined</h3>
+<p>与 <a href="https://xmake.io/#/zh-cn/guide/build_policies?id=buildsanitizeraddress">build.sanitizer.address</a> 类似,用于检测 undefined 问题。</p>
 <h3 id="preprocessorlinemarkers">preprocessor.linemarkers</h3>
 <p>通常用户编译缓存中,预处理器的生成策略,默认开启,如果配置关闭这个策略,那么缓存生成的预处理文件内容将不包含 linemarkers 信息,这会极大减少预处理文件大小。<br>也会提升缓存的处理效率,但是缺点就是会丢失源码行信息,如果遇到编译错误,将无法看到准确的出错代码行。</p>
 <h3 id="preprocessorgccdirectives_only">preprocessor.gcc.directives_only</h3>

+ 102 - 102
sitemap.xml

@@ -12,512 +12,512 @@
 
 <url>
   <loc>https://xmake.io/mirror/guide/project_examples.html</loc>
-  <lastmod>2023-09-26T10:43:07+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:50+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/quickstart.html</loc>
-  <lastmod>2023-09-26T10:43:07+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:50+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/faq.html</loc>
-  <lastmod>2023-09-26T10:43:07+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:50+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/build_policies.html</loc>
-  <lastmod>2023-09-26T10:43:07+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:51+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/configuration.html</loc>
-  <lastmod>2023-09-26T10:43:08+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:51+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/syntax_description.html</loc>
-  <lastmod>2023-09-26T10:43:08+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:51+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/installation.html</loc>
-  <lastmod>2023-09-26T10:43:08+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:51+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/remote_build.html</loc>
-  <lastmod>2023-09-26T10:43:08+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:51+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/unity_build.html</loc>
-  <lastmod>2023-09-26T10:43:08+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:51+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/distcc_build.html</loc>
-  <lastmod>2023-09-26T10:43:08+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/trybuild.html</loc>
-  <lastmod>2023-09-26T10:43:08+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/autogen.html</loc>
-  <lastmod>2023-09-26T10:43:09+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/build_cache.html</loc>
-  <lastmod>2023-09-26T10:43:09+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/plugin_development.html</loc>
-  <lastmod>2023-09-26T10:43:09+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/more_plugins.html</loc>
-  <lastmod>2023-09-26T10:43:09+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/builtin_plugins.html</loc>
-  <lastmod>2023-09-26T10:43:09+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/awesome.html</loc>
-  <lastmod>2023-09-26T10:43:09+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/technical_support.html</loc>
-  <lastmod>2023-09-26T10:43:09+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/changelog.html</loc>
-  <lastmod>2023-09-26T10:43:10+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/contact.html</loc>
-  <lastmod>2023-09-26T10:43:10+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/introduction.html</loc>
-  <lastmod>2023-09-26T10:43:10+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/who_is_using_xmake.html</loc>
-  <lastmod>2023-09-26T10:43:10+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/sponsor.html</loc>
-  <lastmod>2023-09-26T10:43:10+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/index.html</loc>
-  <lastmod>2023-09-26T10:43:10+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/project_examples.html</loc>
-  <lastmod>2023-09-26T10:43:11+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/quickstart.html</loc>
-  <lastmod>2023-09-26T10:43:11+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/faq.html</loc>
-  <lastmod>2023-09-26T10:43:11+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/build_policies.html</loc>
-  <lastmod>2023-09-26T10:43:11+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/configuration.html</loc>
-  <lastmod>2023-09-26T10:43:11+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/syntax_description.html</loc>
-  <lastmod>2023-09-26T10:43:11+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/installation.html</loc>
-  <lastmod>2023-09-26T10:43:11+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/remote_build.html</loc>
-  <lastmod>2023-09-26T10:43:12+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/unity_build.html</loc>
-  <lastmod>2023-09-26T10:43:12+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/distcc_build.html</loc>
-  <lastmod>2023-09-26T10:43:12+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/trybuild.html</loc>
-  <lastmod>2023-09-26T10:43:12+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/autogen.html</loc>
-  <lastmod>2023-09-26T10:43:12+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/build_cache.html</loc>
-  <lastmod>2023-09-26T10:43:12+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/plugin_development.html</loc>
-  <lastmod>2023-09-26T10:43:12+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/more_plugins.html</loc>
-  <lastmod>2023-09-26T10:43:13+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/builtin_plugins.html</loc>
-  <lastmod>2023-09-26T10:43:13+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/awesome.html</loc>
-  <lastmod>2023-09-26T10:43:13+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/technical_support.html</loc>
-  <lastmod>2023-09-26T10:43:13+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/changelog.html</loc>
-  <lastmod>2023-09-26T10:43:13+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/contact.html</loc>
-  <lastmod>2023-09-26T10:43:14+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/peripheral_items.html</loc>
-  <lastmod>2023-09-26T10:43:14+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/introduction.html</loc>
-  <lastmod>2023-09-26T10:43:14+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/who_is_using_xmake.html</loc>
-  <lastmod>2023-09-26T10:43:14+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/sponsor.html</loc>
-  <lastmod>2023-09-26T10:43:14+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/course.html</loc>
-  <lastmod>2023-09-26T10:43:14+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/index.html</loc>
-  <lastmod>2023-09-26T10:43:14+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/getting_started.html</loc>
-  <lastmod>2023-09-26T10:43:15+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/specification.html</loc>
-  <lastmod>2023-09-26T10:43:15+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_variables.html</loc>
-  <lastmod>2023-09-26T10:43:15+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/conditions.html</loc>
-  <lastmod>2023-09-26T10:43:15+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_rule.html</loc>
-  <lastmod>2023-09-26T10:43:15+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/target_instance.html</loc>
-  <lastmod>2023-09-26T10:43:15+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/project_target.html</loc>
-  <lastmod>2023-09-26T10:43:16+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_modules.html</loc>
-  <lastmod>2023-09-26T10:43:16+08:00</lastmod>
+  <lastmod>2023-09-26T11:22:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_toolchain.html</loc>
-  <lastmod>2023-09-26T10:43:16+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/plugin_task.html</loc>
-  <lastmod>2023-09-26T10:43:16+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_dependencies.html</loc>
-  <lastmod>2023-09-26T10:43:16+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/configuration_option.html</loc>
-  <lastmod>2023-09-26T10:43:16+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/extension_modules.html</loc>
-  <lastmod>2023-09-26T10:43:17+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/helper_interfaces.html</loc>
-  <lastmod>2023-09-26T10:43:17+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/global_interfaces.html</loc>
-  <lastmod>2023-09-26T10:43:17+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_instance.html</loc>
-  <lastmod>2023-09-26T10:43:17+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/option_instance.html</loc>
-  <lastmod>2023-09-26T10:43:17+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/builtin_themes.html</loc>
-  <lastmod>2023-09-26T10:43:17+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/switch_theme.html</loc>
-  <lastmod>2023-09-26T10:43:17+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_3rd_source_library.html</loc>
-  <lastmod>2023-09-26T10:43:18+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package_old.html</loc>
-  <lastmod>2023-09-26T10:43:18+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package.html</loc>
-  <lastmod>2023-09-26T10:43:18+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/system_package.html</loc>
-  <lastmod>2023-09-26T10:43:18+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/remote_package.html</loc>
-  <lastmod>2023-09-26T10:43:18+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/remote_toolchain.html</loc>
-  <lastmod>2023-09-26T10:43:18+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2023-09-26T10:43:19+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/getting_started.html</loc>
-  <lastmod>2023-09-26T10:43:19+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/specification.html</loc>
-  <lastmod>2023-09-26T10:43:19+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_variables.html</loc>
-  <lastmod>2023-09-26T10:43:19+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/conditions.html</loc>
-  <lastmod>2023-09-26T10:43:19+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_rule.html</loc>
-  <lastmod>2023-09-26T10:43:19+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/target_instance.html</loc>
-  <lastmod>2023-09-26T10:43:19+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/project_target.html</loc>
-  <lastmod>2023-09-26T10:43:20+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_modules.html</loc>
-  <lastmod>2023-09-26T10:43:20+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_toolchain.html</loc>
-  <lastmod>2023-09-26T10:43:20+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/plugin_task.html</loc>
-  <lastmod>2023-09-26T10:43:20+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_dependencies.html</loc>
-  <lastmod>2023-09-26T10:43:20+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/configuration_option.html</loc>
-  <lastmod>2023-09-26T10:43:21+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/extension_modules.html</loc>
-  <lastmod>2023-09-26T10:43:21+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/helper_interfaces.html</loc>
-  <lastmod>2023-09-26T10:43:21+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/global_interfaces.html</loc>
-  <lastmod>2023-09-26T10:43:21+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_instance.html</loc>
-  <lastmod>2023-09-26T10:43:21+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/option_instance.html</loc>
-  <lastmod>2023-09-26T10:43:21+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/builtin_themes.html</loc>
-  <lastmod>2023-09-26T10:43:21+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/switch_theme.html</loc>
-  <lastmod>2023-09-26T10:43:22+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_3rd_source_library.html</loc>
-  <lastmod>2023-09-26T10:43:22+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package_old.html</loc>
-  <lastmod>2023-09-26T10:43:22+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package.html</loc>
-  <lastmod>2023-09-26T10:43:22+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/system_package.html</loc>
-  <lastmod>2023-09-26T10:43:22+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/remote_package.html</loc>
-  <lastmod>2023-09-26T10:43:22+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/remote_toolchain.html</loc>
-  <lastmod>2023-09-26T10:43:23+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2023-09-26T10:43:23+08:00</lastmod>
+  <lastmod>2023-09-26T11:23:07+08:00</lastmod>
 </url>
 
 </urlset>

+ 69 - 1
zh-cn/guide/build_policies.md

@@ -212,7 +212,7 @@ set_policy("build.optimization.lto", true)
 
 我们也可以通过命令行选项快速开启。
 
-```console
+```bash
 $ xmake f --policies=build.optimization.lto
 ```
 
@@ -232,6 +232,74 @@ target("test")
 
 关于这个的详细背景说明,见:[#1976](https://github.com/xmake-io/xmake/issues/1976)
 
+### build.sanitizer.address
+
+Address Sanitizer(ASan)是一个快速的内存错误检测工具,由编译器内置支持,通常我们需要在编译和链接的 flags 中同时配置 `-fsanitize-address` 才能正确开启。
+
+而我们可以通过开启这个策略,就可以快速全局启用它,这会使得编译出来的程序,直接支持 ASan 检测。
+
+例如,我们可以通过命令行的方式去启用:
+
+```bash
+$ xmake f --policies=build.sanitizer.address
+```
+
+也可以通过接口配置去全局启用:
+
+```lua
+set_policy("build.sanitizer.address", true)
+```
+
+当然,我们也可以单独对某个特定的 target 去配置开启。
+
+另外,如果全局配置它,我们就可以同时对所有依赖包也生效。
+
+```lua
+set_policy("build.sanitizer.address", true)
+
+add_requires("zlib")
+add_requires("libpng")
+```
+
+它等价于,对每个包依次设置 asan 配置。
+
+```lua
+add_requires("zlib", {configs = {asan = true}})
+add_requires("libpng", {configs = {asan = true}})
+```
+
+!> `add_rules("mode.asan", "mode.tsan", "mode.ubsan", "mode.msan")` 将被废弃,尽可能使用这些新的策略,因为这些构建模式无法同步对依赖包生效。
+
+另外,我们也可以同时生效多个 sanitizer 检测,例如:
+
+
+```lua
+set_policy("build.sanitizer.address", true)
+set_policy("build.sanitizer.undefined", true)
+```
+
+或者
+
+```
+$ xmake f --policies=build.sanitizer.address,build.sanitizer.undefined
+```
+
+### build.sanitizer.thread
+
+与 [build.sanitizer.address](https://xmake.io/#/zh-cn/guide/build_policies?id=buildsanitizeraddress) 类似,用于检测线程安全问题。
+
+### build.sanitizer.memory
+
+与 [build.sanitizer.address](https://xmake.io/#/zh-cn/guide/build_policies?id=buildsanitizeraddress) 类似,用于检测内存问题。
+
+### build.sanitizer.leak
+
+与 [build.sanitizer.address](https://xmake.io/#/zh-cn/guide/build_policies?id=buildsanitizeraddress) 类似,用于检测内存泄漏问题。
+
+### build.sanitizer.undefined
+
+与 [build.sanitizer.address](https://xmake.io/#/zh-cn/guide/build_policies?id=buildsanitizeraddress) 类似,用于检测 undefined 问题。
+
 ### preprocessor.linemarkers
 
 通常用户编译缓存中,预处理器的生成策略,默认开启,如果配置关闭这个策略,那么缓存生成的预处理文件内容将不包含 linemarkers 信息,这会极大减少预处理文件大小。