摘录


Compiles debug level messages into the kernel, which would not otherwise be available at runtime. These messages can then be enabled/disabled based on various levels of scope - per source file, function, module, format string, and line number. This mechanism implicitly compiles in all pr_debug() and dev_dbg() calls, which enlarges the kernel text size by about 2%.

If a source file is compiled with DEBUG flag set, any pr_debug() calls in it are enabled by default, but can be disabled at runtime as below. Note that DEBUG flag is turned on by many DEBUG options.

Usage:

Dynamic debugging is controlled via the 'dynamic_debug/control' file, which is contained in the 'debugfs' filesystem. Thus, the debugfs filesystem must first be mounted before making use of this feature. We refer the control file as: <debugfs>/dynamic_debug/control. This file contains a list of the debug statements that can be enabled. The format for each line of the file is:

filename:lineno [module]function flags format

filename : source file of the debug statement lineno : line number of the debug statement module : module that contains the debug statement function : function that contains the debug statement flags : '=p' means the line is turned 'on' for printing format : the format used for the debug statement

From a live system:

nullarbor:~ # cat <debugfs>/dynamic_debug/control # filename:lineno [module]function flags format fs/aio.c:222 [aio]put_ioctx =_ "put_ioctx:\040freeing\040%p\012" fs/aio.c:248 [aio]ioctx_alloc = "ENOMEM:\040nr_events\040too\040high\012" fs/aio.c:1770 [aio]sys_io_cancel = "calling\040cancel\012"

点评

这是个不错的机制,但是我总是配置不起来,也找不到合适的教程,看来只能自己去啃源代码了。

原文

点击这里查看原文

其它

本帖内容由21QA云收藏工具自动生成,欢迎使用。

系统消息 若觉得内容不错,请点击左上角的"赞"图标,以优化网站的内容呈现。 另外,请及时验证注册邮箱,否则收不到21QA发出的红包。 官方Q群:250203055

asked 31 Mar '15, 21:10

%E8%B7%AF%E4%BA%BA%E7%94%B2's gravatar image

路人甲
131566603718

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link: [text](http://url.com/ "title")
  • image: ![alt](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×864
×324
×85

question asked: 31 Mar '15, 21:10

question was seen: 2,036 times

last updated: 31 Mar '15, 21:10

powered by O*S*Q*A

粤ICP备14040061号-1