AnsweredAssumed Answered

Linux kernel debug breakpoint problem

Question asked by Andrew Lee-Smith on Feb 9, 2016
Latest reply on Feb 11, 2016 by Andrew Lee-Smith



I have an i.MX7 Rev B board running Freescale Yocto Linux (Linux imx7dsabresd 3.14.38-6UL_ga+ge4944a5) and I'm debugging the kernel using JTAG halted mode debug.


I'm attempting to set a breakpoint so I can debug a kernel module, but when the breakpoint is hit, it causes a kernel exception rather entering into debug mode in the debugger:


root@imx7dsabresd:~# modprobe -r imx_rpmsg_tty

Unhandled prefetch abort: breakpoint debug exception (0x002) at 0x80086600

Internal error: : 2 [#1] PREEMPT SMP ARM

Modules linked in: imx_rpmsg_tty evbug

CPU: 1 PID: 735 Comm: modprobe Not tainted 3.14.38-6UL_ga+ge4944a5 #4

task: a81c6880 ti: a8bc4000 task.ti: a8bc4000

PC is at SyS_delete_module+0x0/0x174

LR is at ret_fast_syscall+0x0/0x30

pc : [<80086600>]    lr : [<8000e460>]    psr: 80080013

sp : a8bc5fa8  ip : 10c53c7d  fp : 000aedf0

r10: 00000000  r9 : a8bc4000  r8 : 8000e5e4

r7 : 00000081  r6 : 000aee24  r5 : 000aee24  r4 : 000aedf0

r3 : 00000000  r2 : 76f00104  r1 : 00000800  r0 : 000aee24

Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32 ISA ARM  Segment user

Control: 10c53c7d  Table: a854c06a  DAC: 00000015

Process modprobe (pid: 735, stack limit = 0xa8bc4238)

Stack: (0xa8bc5fa8 to 0xa8bc6000)

5fa0: 000aedf0 000aee24 000aee24 00000800 76f00104 00000000

5fc0: 000aedf0 000aee24 000aee24 00000081 00000001 00000000 00000001 000aedf0

5fe0: 76ec5eb0 7ebe4a64 00016e3c 76ec5ebc 60080010 000aee24 00000000 00000000

Code: e59510c8 e8bd40f8 eaffff84 80a78208 (e120be70)

---[ end trace 062b135e73d4dfd6 ]---

Segmentation fault


Logging shows that the CP14 DBGDSCR register has both the halted mode debug and monitor mode debug bits cleared when the exception is taken - this lead me to believe that the Cortex-A7 core is being powered down in some way and then restored, and it is this that is clearing the halted mode debug bit from the DBGDSCR - I can find nothing in the kernel which explicitly does this.


Disabling CPU idle by removing it from the kernel or disabling it by issuing the following commands:

echo 1 >  /sys/devices/system/cpu/cpu0/cpuidle/state1/disable

echo 1 >  /sys/devices/system/cpu/cpu0/cpuidle/state2/disable

echo 1 >  /sys/devices/system/cpu/cpu1/cpuidle/state1/disable

echo 1 >  /sys/devices/system/cpu/cpu1/cpuidle/state2/disable

didn't help.


It may be that the core is not powering down, however keeping the core busy by adding a ‘while 1’ loop in bash does help reduce this exception from happening, but does not solve the problem to an acceptable level.


Any help on this issue would be appreciated.


Thank you.