How to use kgdb on ARM??

耗尽温柔 提交于 2019-11-27 03:16:00

问题


Im using ARMv7 as a target machine. I have compiled the Linux source 2.6.34.13 for target.

Target is connected with Host(Linux Development machine) through serial port using minicom.

Target is loaded with new kernel and KGDB is enabled in command prompt.

$ echo ttyAMA0 > /sys/module/kgdboc/parameters/kgdboc 
$ echo g > /proc/sysrq-trigger

Entering KGDB... message is displayed and waits for commands.

In Host side,

$arm-none-linux-gnueabi-gdb vmlinux

    gdb > set remotebaud 115200
    gdb > set debug remote 1
    gdb > target remote /dev/ttyS0

After this, some command communication takes place by default.

  1. qSupported is sent from Host to Target. But qSuppoted is not supported by target so $#00 is returned. similarly ?, HC-1 commands were sent but receives proper response.

  2. But qOffsets command not receiving any response from target.

I suspect vmlinux. Because if I give list in gdb, its not showing 10 lines of code instead it says

arch/arm/kernel/head.S : No such file or directory.

Note :: Kernel compilation done in server. so no source is available in development machine. But arm-gdb looks for head.S it seems.

I am not sure what mistake im doing. I need symbols to be loaded for entire kernel. Guide me in this regards.


回答1:


That kgdb is looking for head.S is not an error. If you look here you will see that there is a head.S file in the source tree. It's an assembler file that's all. There are several source files written in assembler for this platform.

It is normal, because some instructions especially boot sequences and other "low-level" functionalities are written in assembler because it is easier.

As written in the comments already, gdb needs the sources to browse them while debugging. In the debug-sections, which contain the debug-symbols and are generated when running gcc with -g, there are "only" references to the source-file and line and column, amongst others. See here for more information and further links about debug-symbols with gcc.

That kgdb is looking for head.S is a good sign that you're doing things right. If you have the sources available (and it can be as simple as untarring the tarball of the right version) just run kgdb inside this source-tree or use the -d argument to add source-search-path, being on your development machine of course.




回答2:


Finally Host to Target communication established just bcos of line delay. There is no relationship between kernel source in development machine and time-out issues.

For the time-out kind of issue for some of the commands say qOffset and qSupported is solved by using GtkTerm instead of minicom as the serial port communication tool. Difference is "line delay" option in GtkTerm. so when this is configured to ~250, there is no timeout message thereafter. simply connection established and waits at default break point. If anyone knows how to give this "line delay" in minicom will be more helpful to everyone.

yes ofcourse, we need source code for list command to execute. but without those source also, we can debug i.e si, bt can be executed with the help of vmlinux and system.map.

Note:: set debug remote 1 is not necessary. This gives detailed display of host to command communications. For more detailed view, set debug serial 1.



来源:https://stackoverflow.com/questions/14155577/how-to-use-kgdb-on-arm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!