kgdbwait不等待

lysddp 2011-09-02 04:07:07
求助,最近搭建kgdb老是搭不起来,麻烦搭建过的大哥大姐帮忙看下吧,被这东西搞得很凌乱。

环境:目标机和开发机都是centos6.0( 内核2.6.32),已经用串口测试过两机能正常通信。

先在开发机上编译了一个2.6.32的内核,kernel中配置文件的相应的选项如下:

1)Prompt for development and/or incomplete code/drivers
2)CONFIG_KGDB = y
Location:
-> Kernel hacking
-> KGDB: kernel debugger
3)CONFIG_KGDB_SERIAL_CONSOLE = y (使用串口进行通信)
Location:
-> Kernel hacking
-> KGDB: kernel debugger
-> KGDB: use kgdb over the serial console
4)CONFIG_DEBUG_RODATA = n
5)CONFIG_KGDB_LOW_LEVEL_TRAP = y
6)CONFIG_DEBUG_INFO = y
7)CONFIG_FRAME_POINTER = y
8)CONFIG_MAGIC_SYSRQ = y

编译完成之后,将开发机../arch/x86/boot/bzImage和/boot/vmlinuz还有/boot/System.map都拷贝到了目标机的/boot目录下,
修改目标的menu.lst,里面的参数设置如下:

title CentOS Linux (2.6.32-kgdb)
root (hd0,0)
kernel /vmlinuz-2.6.32-kgdb ro root=/dev/mapper/vg_lys-lv_root rd_LVM_LV=vg_lys/lv_root rd_LVM_LV=vg_lys/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=zh_CN.UTF-8 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet

kgdbwait kgdboc=ttyS0,115200
initrd /initramfs-2.6.32-kgdb

然后先测试下这时候两机间的串口是可以正常通信的。
重启目标机,可是目标启动之后并没有等待开发机的连接而是直接就login进去了,这到底是怎么回事,跪求指教,呜呜!!!
...全文
130 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Wenxy1 2011-09-04
  • 打赏
  • 举报
回复
kgdb通过串口调试,需要特别的串口芯片和驱动。

摘自内核源代码树中的文档:
kgdboc= [HW] kgdb over consoles.
Requires a tty driver that supports console polling.
(only serial supported for now)
Format: <serial_device>[,baud]


!Iinclude/linux/kgdb.h
</sect1>
<sect1 id="kgdbocDesign">
<title>kgdboc internals</title>
<para>
The kgdboc driver is actually a very thin driver that relies on the
underlying low level to the hardware driver having "polling hooks"
which the to which the tty driver is attached. In the initial
implementation of kgdboc it the serial_core was changed to expose a
low level uart hook for doing polled mode reading and writing of a
single character while in an atomic context. When kgdb makes an I/O
request to the debugger, kgdboc invokes a call back in the serial
core which in turn uses the call back in the uart driver. It is
certainly possible to extend kgdboc to work with non-uart based
consoles in the future.
</para>
<para>
When using kgdboc with a uart, the uart driver must implement two callbacks in the <constant>struct uart_ops</constant>. Example from drivers/8250.c:<programlisting>
#ifdef CONFIG_CONSOLE_POLL
.poll_get_char = serial8250_get_poll_char,
.poll_put_char = serial8250_put_poll_char,
#endif

lysddp 2011-09-04
  • 打赏
  • 举报
回复
但是我在之前已经先测试过机子可以串口通信了。
Wenxy1 2011-09-03
  • 打赏
  • 举报
回复
可能是串口驱动问题, kgdb通过串口调试只支持某些串口硬件。
也许你可以试试通过网口调试。

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧