> For the complete documentation index, see [llms.txt](https://handbook.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://handbook.bsdcn.org/di-27-zhang-dtrace/27.4.-nei-he-wai-bu-mo-kuai.md).

# 27.4.为内核外部模块启用 DTrace

要为一个内核外模块添加 DTrace 支持（这对于开发和调试非常有用），在模块的 Makefile 中加入以下行：

```sh
CFLAGS+= -DKDTRACE_HOOKS
```

此标志在编译过程中启用 DTrace 钩子，以便对模块进行深度调试和监控。修改后请重新编译该模块，以激活 DTrace 功能。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://handbook.bsdcn.org/di-27-zhang-dtrace/27.4.-nei-he-wai-bu-mo-kuai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
