Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
426 views
in Technique[技术] by (71.8m points)

c - How to use kgdb on ARM??

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...