We are trying to debug an OpenWrt linux kernel (V5.4.143). I am following the steps from the Armv8_Targeting_Manual.pdf section 8.3.2 about how to debug a linux kernel.
I make sure that the kernel is being compiled with debug symbols. I import the vmlinux file, though there are also vmlinux.elf and vmlinux.debug files in a lower directory.
I setup all the options as they are shown in the document and then hit debug.
After doing this I don't get the same screen to browse for source code and it is not stopping at my initial breakpoint (0x8008000). I can pause the debugger but it seems like it is lost somewhere.
Any ideas or help?
thank you, I will ty that. I did see that forum question but it seemed like the same instructions i was following. I will try your suggestion and get back to you.
In the instructions it uses "BitBake" do we need to use that to get debugging working?
Please add "nokaslr" in bootargs as the following in u-boot.
=> setenv bootargs "console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 nokaslr"
For Linux Kernel debugging, you could refer to the attached document in the following link.
OK, I tried following that document, which is basically the same thing as what i had done. I also tried the nokaslr.
However, I can't actually even try the steps because as soon I hit debug in codewarrrior I can't type anything in the UBoot console. It seems frozen like the JTAG has taken control. Codewarrior says that it is running but if I hit "Suspend" it doesn't really look like it is suspending anything.
We have been using the JTAG to program the flash so I know it works that much at least.
On the target board, after setting up u-boot and entering into u-boot prompt. In CodeWarrior IDE,
click “Debug” to connect to the target board to attach to u-boot. After CodeWarrior connect to the
target board, please click “Suspend” button in CodeWarrior IDE to stop the running u-boot, and
enter “break _text” in the gdb console to set the breakpoint at the start of Linux Kernel.
Then in CodeWarrior IDE resume the program, in the target console, type the command under u-boot prompt to boot up Linux Kernel.
Here are the steps i take, following your directions, and the outcomes that I see.
- Go into u-boot and stop it from booting to the kernel
- load kernel image into RAM
- Connect to the device by clicking "debug", NOTE: the middle window seems to indicate we are broke at some address 0x87b8cc5c.
- Click Suspend in Codewarrior. NOTE: The suspend button is greyed out but the resume button is not enabled.
- After about 20 seconds An error box comes up.
- At this point I am stuck since I cannot type in the u-boot terminal or resume the processor.
Please configure Debugger and Startup panels carefully following the document which I mentioned. After connecting to the target and click suspend button, you should get the IDE similar as the following.
Thank you for taking time to help. However, I must be missing a step becasue I have repeated the steps you outline in your document, several times, and I still cannot get it to debug the linux kernel.
Do I need to use a special u-boot? I am using the u-boot from our distribution OpenWrt.
I get to the uboot command. Attach with the debugger and it stops but it apears to be lost. I can set the break point and resume but I cannot then type anything into u-boot. It is frozen.
I get the following in the debug console after attaching.
No need special u-boot.
Please type "enter" to enter u-boot prompt "=>".
Then connect and attach CodeWarrior to u-boot, after click "suspend" button, please set the breakpoints in the debugger console, then click Resume in CW IDE, you could enter commands under u-boot prompt "=>".
Probably you could send your CW workspace without source code to me, I use it to do verification on my side.
OK, I am going to need more detailed directions then
I only have one workspace, the one I sent you. The project I was using to debug shows up in the project explorer as shown below. It was created by following the document you pointed me to. I "Imported" the vmlinux image I want to debug and set up the project as specified in the document. What is it you want me to send you?
Attached you will find exported Debug and Project settings