Repository : ssh://git@diktynna/doc
On branches: backup-redmine/2021-08-07,backup-redmine/2021-09-11,backup-redmine/2021-10-09,backup-redmine/2021-11-13,backup-redmine/2021-12-11,backup-redmine/2022-01-08,backup-redmine/2022-02-12,backup-redmine/2022-03-12,backup-redmine/2022-04-09,backup-redmine/2022-05-07,backup-redmine/2022-06-11,backup-redmine/2022-08-06,backup-redmine/2022-10-07,backup-redmine/2022-11-14,backup-redmine/2023-01-14,main
commit e859865b87eeb63e5959afad32dca42957d84474 Author: Sven Eckelmann sven@narfation.org Date: Thu Jul 22 10:45:25 2021 +0000
doc: open-mesh/Kernel_debugging_with_kgdb
e859865b87eeb63e5959afad32dca42957d84474 open-mesh/Kernel_debugging_with_kgdb.textile | 31 ++++------------------------ 1 file changed, 4 insertions(+), 27 deletions(-)
diff --git a/open-mesh/Kernel_debugging_with_kgdb.textile b/open-mesh/Kernel_debugging_with_kgdb.textile index c094db87..bcb0161c 100644 --- a/open-mesh/Kernel_debugging_with_kgdb.textile +++ b/open-mesh/Kernel_debugging_with_kgdb.textile @@ -15,7 +15,7 @@ Most CPUs have some kind of watchdog integrated. They can often be turned off an +# CONFIG_ATH79_WDT is not set </code></pre>
-Unfortunately, there are also external watchdog chips which cannot be turned off. They have to be manually triggered regularly during the debugging process to prevent a sudden reboot. The details depend on the actual hardware but it often ends up in writing to a specific (GPIO control/set/clear) register. +Unfortunately, there are also external watchdog chips which cannot be turned off. They have to be manually triggered regularly during the debugging process to prevent a sudden reboot. The details depend on the actual hardware but it often ends up in writing to a specific (GPIO control/set/clear) register. An example how to manually trigger an GPIO connected watchdog manually can be found in [[GDB Linux snippets#Working-with-external-Watchdog-over-GPIO]]
h3. Enabling KGDB in kernel
@@ -297,7 +297,9 @@ lx-symbols ../batman-adv-2019.2/.pkgdir/ ../backports-4.19.66-1/.pkgdir/ ../butt
The rest of the process works similar to debugging using gdbserver. Just set some additional breakpoints and let the kernel run again. kgdb will then inform gdb whenever a breakpoints was hit. Just keep in mind that it is not possible to interrupt the kernel from gdb (without a Oops or an already existing breakpoint) - use the sysrq mechanism again from Linux to switch back to kgdb.
-Some other ideas are documented in [[Kernel_debugging_with_qemu's_GDB_server]]. This document also contains important hints about [[Kernel_hacking_Debian_image#Building-the-batman-adv-module|increasing the chance of getting debugable modules]] which didn't had all information optimized away. The relevant flags could be set directly in the routing feed like this: +Some other ideas are documented in [[GDB Linux_snippets]]. + +The kernel hacking debian image page should also be checked to [[Kernel_hacking_Debian_image#Building-the-batman-adv-module|increase the chance of getting debugable modules]] which didn't had all information optimized away. The relevant flags could be set directly in the routing feed like this:
<pre><code class="diff"> diff --git a/batman-adv/Makefile b/batman-adv/Makefile @@ -314,28 +316,3 @@ index a7c6a79..c18f978 100644 modules endef </code></pre> - -h2. Working with external Watchdog over GPIO - -There are various boards on ar71xx which use external watchdogs chips via GPIO. They have to be triggered regularly (every minute or even more often) or otherwise the board will just suddenly reboot. This will of course not work when Linux is no longer in control and kgdb/gdb is the only way to interact with the system. - -But luckily, we can just write manually to the ar71xx registers (every n seconds). We have two possible ways: - -* write to the clear/set registers -** set bit n in register GPIO_SET (0x1804000C) to set output value to 1 for GPIO n -** set bit n in register GPIO_CLEAR (0x18040010) to set output value to 0 for GPIO n -* overwrite the complete GPIO_OUT (0x18040008) register (which might modify more GPIO bits then required) - -We will only demonstrate this here for GPIO 12 with GPIO_SET/GPIO_CLEAR. - -<pre> -# check where iomem 018040000-180400ff is mapped to -(gdb) print ath79_gpio_base -$1 = (void *) 0xb8040000 - -# set GPIO 12 to low -(gdb) set {uint32_t}0xb8040010 = 0x00001000 - -# set GPIO 12 to high -(gdb) set {uint32_t}0xb804000C = 0x00001000 -</pre> \ No newline at end of file