kgdb kernel debug on iMX8 board over serial

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

kgdb kernel debug on iMX8 board over serial

2,144 Views
stuartrubin
Contributor III

Has anyone had success running kgdb to debug the kernel on an iMX8 (e.g. imx8-qm-mek) board? Connected via serial port? I'm close, but can't quite get it working. All suggestions welcome. Thank you!

Tags (2)
5 Replies

2,078 Views
lorenzo_giraudi
Contributor III

Someone from NXP ever tried this?

0 Kudos

2,098 Views
lorenzo_giraudi
Contributor III

 Hi stuartrubin,

I was going to post the same question!

I followed the instruction shown here: https://elinux.org/images/1/1b/ELC19_Serial_kdb_kgdb.pdf but can make it to work. This is what I get:

  • I can do echo ttyLP0 > /sys/module/kgdboc/parameters/kgdboc and it gets successfully registered (note: ttyLP0 is my console too)
  • when I do echo g > /proc/sysrq-trigger I get messages telling that the kernel dropped into kdb, then I see the kdb prompt but it stops there, when I try to type nothing happens

I have the idea that it may involve the polling functions lpuart32_poll_put_char and  lpuart32_poll_get_char but I do not know how to debug it.

It would be great to know if someone from NXP ever tried it.

BR,

Lorenzo

0 Kudos

1,600 Views
r_veens
Contributor III

I think im having the same issue, did you ever manage to find a solution?

 

[ 48.900382] Internal error: synchronous external abort: 96000210 [#2] PREEMPT SMP
[ 48.907890] CPU: 2 PID: 22 Comm: kworker/2:0 Tainted: G D 5.10.35-lts-5.10.y+g386cc8f1255e #26
[ 48.917805] Hardware name: Freescale i.MX8QXP MEK AME (DT)
[ 48.923309] Workqueue: events deferred_probe_work_func
[ 48.928456] Call trace:
[ 48.930912] dump_backtrace+0x0/0x1a0
[ 48.934574] show_stack+0x18/0x70
[ 48.937895] dump_stack+0xd0/0x12c
[ 48.941300] kgdb_reenter_check.part.0+0xf0/0x114
[ 48.946006] kgdb_handle_exception+0x124/0x140
[ 48.950456] kgdb_notify+0x34/0x70
[ 48.953862] notify_die+0x7c/0xcc
[ 48.957179] die+0xa8/0x244
[ 48.959976] arm64_notify_die+0xb8/0xd0
[ 48.963816] do_sea+0x5c/0xa0
[ 48.966787] do_mem_abort+0x44/0xa4
[ 48.970280] el1_abort+0x44/0x6c
[ 48.973509] el1_sync_handler+0xac/0xd0
[ 48.977351] el1_sync+0x80/0x100
[ 48.980585] lpuart32_poll_put_char+0x60/0xc4
[ 48.984945] kgdboc_put_char+0x34/0x4c
[ 48.988696] put_packet+0x40/0x130
[ 48.992102] gdb_serial_stub+0xe6c/0xfa0
[ 48.996028] kgdb_cpu_enter+0x1b4/0x650
[ 48.999866] kgdb_handle_exception+0xd8/0x140
[ 49.004229] kgdb_brk_fn+0x20/0x30
[ 49.007635] call_break_hook+0x6c/0x80
[ 49.011388] brk_handler+0x1c/0x60
[ 49.014797] do_debug_exception+0xc4/0x150
[ 49.018894] el1_dbg+0x34/0x50
[ 49.021952] el1_sync_handler+0x9c/0xd0
[ 49.025790] el1_sync+0x80/0x100
[ 49.029026] pwm_buzzer_probe+0x0/0x520
[ 49.032865] really_probe+0xe4/0x4c0
[ 49.036444] driver_probe_device+0x58/0xc0
[ 49.040544] __device_attach_driver+0xa8/0x10c
[ 49.044992] bus_for_each_drv+0x78/0xd0
[ 49.048832] __device_attach+0xd8/0x180
[ 49.052670] device_initial_probe+0x14/0x20
[ 49.056857] bus_probe_device+0x9c/0xa4
[ 49.060697] deferred_probe_work_func+0x80/0xc0
[ 49.065236] process_one_work+0x1cc/0x350
[ 49.069248] worker_thread+0x2bc/0x46c
[ 49.073001] kthread+0x154/0x160
[ 49.076232] ret_from_fork+0x10/0x30
[ 49.079811] Kernel panic - not syncing: Recursive entry to debugger
[ 49.086087] SMP: stopping secondary CPUs
[ 50.090013] SMP: failed to stop secondary CPUs 0-3
[ 50.094805] Kernel Offset: disabled
[ 50.098298] CPU features: 0x0240002,20002008
[ 50.102570] Memory Limit: none
[ 50.105635] ---[ end Kernel panic - not syncing: Recursive entry to debugger ]---

0 Kudos

2,129 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello stuartrubin,

There may be a different version of gdb depending on the BSP you are using but this package is part of the open embedded layer so you may be able to import the recipe from an older release of the Open Embedded layers. However, you would need to be careful with the dependencies for the older version as there may be conflicts.

https://www.emcraft.com/som/imx-8m/remote-debugging-with-gdb

 

Regards

 

0 Kudos

2,124 Views
stuartrubin
Contributor III

Bio_TICFSL thank you for your response. I am able to do a normal application debug with gdb. What I actually need is to debug the kernel and drivers with kgdb (not the user space gdb). Any experience with this?