CONFIG_DEBUG_USER【转】

转自:https://blog.csdn.net/adaptiver/article/details/12778621

关于CONFIG_DEBUG_USER
把menuconfig中查到的 CONFIG_DEBUG_USER 信息copy在下面:
  | CONFIG_DEBUG_USER:
  |
  | When a user program crashes due to an exception, the kernel can
  | print a brief message explaining what the problem was. This is
  | sometimes helpful for debugging but serves no purpose on a
  | production system. Most people should say N here.
  |
  | In addition, you need to pass user_debug=N on the kernel command
  | line to enable this feature.  N consists of the sum of:
  |
  |     1 - undefined instruction events
  |     2 - system calls
  |     4 - invalid data aborts
  |     8 - SIGSEGV faults
  |    16 - SIGBUS faults
  |
  | Symbol: DEBUG_USER [=n]
  | Type  : boolean
  | Prompt: Verbose user fault messages
  |   Defined at arch/arm/Kconfig.debug:49
  |   Location:
  |     -> Kernel hacking

要试用该功能:

首先在config文件中添加该选项,然后在 kernel 的cmdline中添加 user_debug=1 或者 user_debug=31
类似:
console=ttyS2 quiet user_debug=31
setenv bootargs console=ttySAC0,115200 user_debug=1 saveenv

user_debug的值可根据情况选定,下面这几个宏与上面的粗体部分可对照一下,可得知各个bit使能之后能得到的信息。

#define UDBG_UNDEFINED (1 << 0)
#define UDBG_SYSCALL (1 << 1)
#define UDBG_BADABORT (1 << 2)
#define UDBG_SEGV (1 << 3)
#define UDBG_BUS (1 << 4)

有一篇文章就这一点而言有参考意义:

http://blog.chinaunix.net/uid-25756789-id-3420210.html

原文地址:https://www.cnblogs.com/sky-heaven/p/9339864.html