sholla
Posts: 5
Joined: Wed Sep 02, 2015 5:13 am

Openocd setup is OK but breakpoints are ignored..

Wed Jun 12, 2019 11:04 am

I am trying to get the jtag working in the following setup...

Raspberry pi B+
Openocd 0.10.0
JLink v9
cross-gdb 8.2

I can halt the cpu, do a backtrace command 'bt', put hardware breakpoints, resume
execution and break again by control-c. But the breakpoints are not triggered ...

Tested this by putting a hardware breakpoint 'hbreak' on sys_open system call
and then running ls command in the rpi ssh console.

Any ideas as to what is happening ?

----------------
Open On-Chip Debugger 0.10.0+dev-00746-g8f518d35 (2019-03-20-10:21)
Licensed under GNU GPL v2
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
unable to receive message
Info : J-Link V9 compiled Oct 9 2015 20:34:47
Info : Hardware version: 9.10
Info : VTarget = 3.343 V
Info : clock speed 3 kHz
Info : JTAG tap: rspi.arm tap/device found: 0x07b7617f (mfg: 0x0bf (Broadcom), part: 0x7b76, ver: 0x0)
Info : found ARM1176
Info : rspi.arm: hardware has 6 breakpoints, 2 watchpoints
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333

sean.lawless
Posts: 3
Joined: Thu Jun 06, 2019 6:07 pm

Re: Openocd setup is OK but breakpoints are ignored..

Fri Jun 14, 2019 1:50 am

Did you try software breakpoints? Also, sharing your OpenOCD configuration file(s) might also help others see the problem, for example, what is causing the "unable to receive message" in the output you posted, this is an unfamiliar message to me.

sholla
Posts: 5
Joined: Wed Sep 02, 2015 5:13 am

Re: Openocd setup is OK but breakpoints are ignored..

Fri Jun 14, 2019 5:24 am

Looks like I was too hasty in complaining about the breakpoints.
I think the call to sys_open is optimised out. If I put the break point
on do_sys_open then that is triggered as follows..

(gdb) hbreak do_sys_open
Hardware assisted breakpoint 1 at 0xc015ad5c: file /usr/src/kernel/fs/open.c, line 1045.
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xb6b221a8 "/var/db/services.db", flags=655360, mode=0)
at /usr/src/kernel/fs/open.c:1045
1045 /usr/src/kernel/fs/open.c: No such file or directory.
(gdb) c
Continuing.
----

If I just keep on continuing from the break point, eventually kernel crashes ...
now the problem is to figure out whether this is due to jtag debug events or something else.
But I have not seen this crash without the jtag i/f even if I keep rpi powered on for long time..

[email protected]:~# [ 324.465805] rpi_firmware_get_throttled: 6 callbacks suppressed
[ 324.465819] Under-voltage detected! (0x00050000)
[ 343.857800] rpi_firmware_get_throttled: 6 callbacks suppressed
[ 343.857812] Voltage normalised (0x00000000)
[ 373.417672] mmc0: timeout waiting for hardware interrupt.
[ 373.423110] [131ae82e] TSK> da4a70d0 0
[ 373.426863] [131ae85a] REQ< da4b3ce4 10801
[ 373.430960] [131ae85c] CMD< d 10000
[ 373.434448] [131ae861] FCM< da4b3ce4 da4b3d44
....
[ 374.449147] mmc0: ===========================================
[ 375.958910] Unable to handle kernel NULL pointer dereference at virtual address 08
[ 375.967021] pgd = d98c4000
[ 375.969729] [00000028] *pgd=199bd831, *pte=00000000, *ppte=00000000
[ 375.976015] Internal error: Oops: 17 [#1] ARM
[ 375.980372] Modules linked in: ipv6 ipt_REJECT nf_reject_ipv4 xt_tcpudp nf_conntrd
[ 375.998259] CPU: 0 PID: 244 Comm: syslogd Not tainted 4.14.98 #1
[ 376.004264] Hardware name: BCM2835
[ 376.007665] task: da4e9bc0 task.stack: d98ca000
[ 376.012225] PC is at bcm2835_sdhost_dma_complete+0xd0/0x248
[ 376.017803] LR is at log_event_impl.part.1+0x94/0xb8
[ 376.022768] pc : [<c04f01f8>] lr : [<c04ee788>] psr: a0000193
[ 376.029034] sp : d98cbe00 ip : 00000000 fp : d98cbe2c
[ 376.034257] r10: 00000000 r9 : dac1bb5c r8 : c0019bd4
[ 376.039481] r7 : 00000000 r6 : c0a728d0 r5 : a0000113 r4 : dae91b00
[ 376.046008] r3 : 00000001 r2 : c06548e0 r1 : c06548e0 r0 : dad2ea10
[ 376.052536] Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
[ 376.059758] Control: 00c5387d Table: 198c4008 DAC: 00000055
[ 376.065504] Process syslogd (pid: 244, stack limit = 0xd98ca188)
[ 376.071509] Stack: (0xd98cbe00 to 0xd98cc000)
[ 376.075874] be00: dac1bb10 d98cbe0c d98cbe34 dac1bb10 d98cbe0c d98cbe34 00000200 0
[ 376.084060] be20: d98cbe7c d98cbe30 c03bcd18 c04f0134 d98cbe58 d98cbe34 d98cbe34 0
[ 376.092244] be40: 00000000 c04f0128 00000000 dae91b00 c006e1fc dac1bb44 dae91b1c 4
[ 376.100428] be60: 00000000 dac28000 00000100 00000010 d98cbe9c d98cbe80 c0026c40 c
[ 376.108612] be80: c09ed638 00000006 ffffe000 00000005 d98cbeec d98cbea0 c00095a0 8
[ 376.116795] bea0: c0062958 c0064f30 00000000 00000001 00400000 00001d16 0000000a 8
[ 376.124979] bec0: c0065b04 00000000 c09db698 00000001 00000000 dac28000 d98ca000 0
[ 376.133163] bee0: d98cbf04 d98cbef0 c002672c c0009494 00000000 c09db698 d98cbf2c 8
[ 376.141348] bf00: c0062030 c0026610 d98cbf48 c095790c ffffffff d98cbf7c c000fee4 0
[ 376.149533] bf20: d98cbf44 d98cbf30 c0009418 c0061fdc c015ad60 80000013 d98cbfa4 8
[ 376.157718] bf40: c065191c c00093e8 ffffff9c be8dff09 00020d41 000001b6 0184c150 8
[ 376.165904] bf60: 0184c5ac 00000142 c000fee4 d98ca000 00000000 d98cbfa4 d98cbf98 8
[ 376.174088] bf80: c015af84 c015ad60 80000013 ffffffff 0184c150 bf000000 00000000 8
[ 376.182273] bfa0: c000fd40 c015af74 0184c150 5cf7e4a8 ffffff9c be8dff09 00020d41 6
[ 376.190457] bfc0: 0184c150 5cf7e4a8 0184c5ac 00000142 00000000 00000002 be8dfbb4 4
[ 376.198642] bfe0: 0000006c be8dfae0 b6e85000 b6e0630c 60000010 ffffff9c 00000000 0
[ 376.206859] [<c04f01f8>] (bcm2835_sdhost_dma_complete) from [<c03bcd18>] (vchan_c)
[ 376.216111] [<c03bcd18>] (vchan_complete) from [<c0026c40>] (tasklet_action+0x84/)
[ 376.224049] [<c0026c40>] (tasklet_action) from [<c00095a0>] (__do_softirq+0x118/0)
[ 376.231983] [<c00095a0>] (__do_softirq) from [<c002672c>] (irq_exit+0x128/0x17c)
[ 376.239409] [<c002672c>] (irq_exit) from [<c0062030>] (__handle_domain_irq+0x60/0)
[ 376.247257] [<c0062030>] (__handle_domain_irq) from [<c0009418>] (bcm2835_handle_)
[ 376.255971] [<c0009418>] (bcm2835_handle_irq) from [<c065191c>] (__irq_svc+0x5c/0)
[ 376.263802] Exception stack(0xd98cbf48 to 0xd98cbf90)
[ 376.268860] bf40: ffffff9c be8dff09 00020d41 000001b6 0184c150 8
[ 376.277045] bf60: 0184c5ac 00000142 c000fee4 d98ca000 00000000 d98cbfa4 d98cbf98 8
[ 376.285224] bf80: c015af84 c015ad60 80000013 ffffffff
[ 376.290302] [<c065191c>] (__irq_svc) from [<c015ad60>] (do_sys_open+0x4/0x1e0)
[ 376.297538] Code: e592801c e3580000 0a000004 e3a0c000 (e5972028)
[ 376.303636] ---[ end trace caab4f574a99bd4a ]---
[ 376.308254] Kernel panic - not syncing: Fatal exception in interrupt
[ 376.314618] ---[ end Kernel panic - not syncing: Fatal exception in interrupt

------
(gdb) hbreak do_sys_open
Hardware assisted breakpoint 1 at 0xc015ad5c: file /usr/src/kernel/fs/open.c, line 1045.
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xb6b221a8 "/var/db/services.db", flags=655360, mode=0)
at /usr/src/kernel/fs/open.c:1045
1045 /usr/src/kernel/fs/open.c: No such file or directory.
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xb6b05098 "/etc/services", flags=524288, mode=0)
at /usr/src/kernel/fs/open.c:1045
1045 in /usr/src/kernel/fs/open.c
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xb6b050a8 "/etc/hosts", flags=524288, mode=0)
at /usr/src/kernel/fs/open.c:1045
1045 in /usr/src/kernel/fs/open.c
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xb6b221a8 "/var/db/services.db", flags=655360, mode=0)
at /usr/src/kernel/fs/open.c:1045
1045 in /usr/src/kernel/fs/open.c
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xbe8dff09 "/var/log/messages", flags=134465, mode=438)
at /usr/src/kernel/fs/open.c:1045
1045 in /usr/src/kernel/fs/open.c
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xb6b05098 "/etc/services", flags=524288, mode=0)
at /usr/src/kernel/fs/open.c:1045
1045 in /usr/src/kernel/fs/open.c
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xb6b050a8 "/etc/hosts", flags=524288, mode=0)
at /usr/src/kernel/fs/open.c:1045
1045 in /usr/src/kernel/fs/open.c
(gdb) c
Continuing.

Breakpoint 1, do_sys_open (dfd=-100, filename=0xbe8dff09 "/var/log/messages", flags=134465, mode=438)
at /usr/src/kernel/fs/open.c:1045
1045 in /usr/src/kernel/fs/open.c
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
__loop_delay () at /usr/src/kernel/arch/arm/lib/delay-loop.S:58
58 /usr/src/kernel/arch/arm/lib/delay-loop.S: No such file or directory.
(gdb)

---
openocd configuration file jlink.cfg:
---------------------------------------------------
#
# SEGGER J-Link
#
# http://www.segger.com/jlink.html
#

interface jlink
adapter_khz 3
transport select jtag


tcl/target/raspberry-0.1.cfg
---------------------------------------
#adapter_nsrst_delay 400
reset_config none

if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
set _CHIPNAME rspi
}

if { [info exists CPU_TAPID ] } {
set _CPU_TAPID $CPU_TAPID
} else {
set _CPU_TAPID 0x07b7617F
}

jtag newtap $_CHIPNAME arm -irlen 5 -expected-id $_CPU_TAPID

set _TARGETNAME $_CHIPNAME.arm
target create $_TARGETNAME arm11 -chain-position $_TARGETNAME
rspi.arm configure -event gdb-attach { halt }

Return to “Bare metal, Assembly language”