kdgb linux内核调试,davinci linux kernel 2.6.32 不支持网口调试内核

针对串口调试问题,看了一些资料,由于我们的开发板上只有一个串口,所以只能用kgdboc的方式,

kernel启动参数添加:kgdbwait kgdboc=ttyS0,115200

在目标机上boot linux后,显示:

Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled

serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A

console [ttyS0] enabled

serial8250 serial8250.0: unable to register port at index 1 (IO0 MEM1c20400 IRQ4

1): -28

kgdb: Registered I/O driver kgdboc.

kgdb: Waiting for connection from remote gdb...

在host端执行gdb,kgdb连接成功,如下所示:

root@yangxp:/usr/local/dm368/dvsdk/psp/linux-2.6.32.17-psp03.01.01.39# /root/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-gdb ./vmlinux

GNU gdb (Sourcery G++ Lite 2009q1-203) 6.8.50.20081022-cvs

Copyright (C) 2008 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi".

For bug reporting instructions, please see:

(gdb) set remotebaud 115200

(gdb) target remote /dev/ttyS0

Remote debugging using /dev/ttyS0

kgdb_breakpoint () at kernel/kgdb.c:1723

1723atomic_set(&kgdb_setting_breakpoint, 0);

输入continue后,串口console没有linux启动的打印,gdb程序也无法控制,强行按ctrl-c后退出,发现串口console打印都出来了。linux启动正常,可以输入。

网上说是串口被kdgb占用,目标板的串口console就没有输出,那么,这种情况下,如何更好的调试?

目标板linux起来后,输入echo g > /proc/sysrq-trigger,进入kgdb调试模式。然后host端重新运行gdb程序重新连接,

设置断点,continue后,结果如下:

(gdb) b do_sigaction

Breakpoint 1 at 0xc00520ec: file kernel/signal.c, line 2391.

(gdb) c

The program is not being run.

(gdb) target remote /dev/ttyS0

Remote debugging using /dev/ttyS0

Ignoring packet error, continuing...

Reply contains invalid hex digit 116

(gdb) c

Continuing.

Breakpoint 1, do_sigaction (sig=28, act=0xc1f85f84, oact=0xc1f85f70)

at kernel/signal.c:2391

2391struct task_struct *t = current;

(gdb) bt

#0  do_sigaction (sig=28, act=0xc1f85f84, oact=0xc1f85f70)

at kernel/signal.c:2391

#1  0xc0052318 in sys_rt_sigaction (sig=28, act=0xc1f85f84, oact=0xbedaf6a0,

sigsetsize=0) at kernel/signal.c:2582

#2  0xc002dfa0 in kuser_cmpxchg_fixup ()

#3  0xc002dfa0 in kuser_cmpxchg_fixup ()

Backtrace stopped: previous frame identical to this frame (corrupt stack?)

(gdb) n

0xc00520f0 in get_current ()

at /usr/local/dm368/dvsdk/psp/linux-2.6.32.17-psp03.01.01.39/arch/arm/include/asm/current.h:10

10return current_thread_info()->task;

(gdb) n

Warning:

Cannot insert breakpoint 1.

Error accessing memory address 0xc00520ec: Unknown error 4294967295.

不能调试了。网上查了这个错误,说是CONFIG_DEBUG_RODATA宏要禁用,我的禁用的,况且可以设置断点,到底是什么原因???kdgb就这么不好用吗?请高手指点一下。谢谢!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值