gdb cannot finish from cortex-m exception (interrupt) handler

Bug #1549060 reported by Seki, Tsutomu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

Assuming I have a following stack frame, I expect finish command would execute until return to 0x3098, but gdb will try to set hardware breakpoint at 0xfffffffc and it fails.

0x000030fa in ?? ()
(gdb) bt
#0 0x000030fa in ?? ()
#1 <signal handler called>
#2 0x00003098 in ?? ()
#3 0x00123c4a in main ()
(gdb) up
#1 <signal handler called>
(gdb) info frame
Stack level 1, frame at 0x16fff8:
 pc = 0xfffffffd; saved pc = 0x3098
 called by frame at 0x16fff8, caller of frame at 0x16ffd8
 Arglist at unknown address.
 Locals at unknown address, Previous frame's sp is 0x16fff8
 Saved registers:
  r0 at 0x16ffd8, r1 at 0x16ffdc, r2 at 0x16ffe0, r3 at 0x16ffe4, r12 at 0x16ffe8, lr at 0x16ffec, pc at 0x16fff0, xpsr at 0x16fff4
(gdb) down
#0 0x000030fa in ?? ()
(gdb) set debug remote 1
(gdb) finish
Run till exit from #0 0x000030fa in ?? ()
Sending packet: $Z1,fffffffc,2#42...Packet received: E01
Packet Z1 (hardware-breakpoint) is supported
Warning:
Cannot insert hardware breakpoint 0.
Could not insert hardware breakpoints:
You may have requested too many hardware breakpoints/watchpoints.

Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

This needs more information to reproduce this behaviour. Can you please share a small test case and also mention which version of gdb you're using and how the binary image was built?

Revision history for this message
Seki, Tsutomu (sekiriki) wrote :
Download full text (3.4 KiB)

Hi Tejas,

Sorry to have kept you waiting reply. I cannot talk much about above report because I found the bug on proprietary SoC, but I believe this would happen on any Cortex-M processor. To show that, I want to share a test case I had reproduced onon nucleo-F411RE board (http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF260320) with ther example code.

To build the image, download STM32CubeF4 from http://www.st.com/web/jp/catalog/tools/PF259243 and place attached Makefile on it's top directory, then
$ make

To run image,
$ make run

Regards,
sekiriki

--------
GNU gdb (7.7.1-0ubuntu5~14.04.2+1) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from out/Projects/STM32F411RE-Nucleo/Examples/HAL/HAL_TimeBase.elf...done.
Remote debugging using | openocd -f /usr/local/share/openocd/scripts/board/st_nucleo_f411re.cfg -p
Open On-Chip Debugger 0.9.0-dev-00210-g01d65e1-dirty (2015-02-23-19:48)
Licensed under GNU GPL v2
For bug reports, read
 http://openocd.sourceforge.net/doc/doxygen/bugs.html
EXTI15_10_IRQHandler () at Projects/STM32F411RE-Nucleo/Examples/HAL/HAL_TimeBase/Src/stm32f4xx_it.c:174
174 }
(gdb) load
Loading section .isr_vector, size 0x198 lma 0x8000000
Loading section .text, size 0xc3a8 lma 0x8000198
Loading section .rodata, size 0x20 lma 0x800c540
Loading section .init_array, size 0x8 lma 0x800c560
Loading section .fini_array, size 0x4 lma 0x800c568
Loading section .data, size 0x448 lma 0x800c56c
Start address 0x800c374, load size 51636
Transfer rate: 23 KB/sec, 5737 bytes/write.
(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0800c374 msp: 0x20020000
(gdb) b HAL_GPIO_EXTI_IRQHandler
Breakpoint 1 at 0x800810a: file Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c, line 508.
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, HAL_GPIO_EXTI_IRQHandler (GPIO_Pin=8192) at Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c:508
508 if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET)
(gdb) finish
Run till exit from #0 HAL_GPIO_EXTI_IRQHandler (GPIO_Pin=8192) at Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c:508
EXTI15_10_IRQHandler () at Projects/STM32F411RE-Nucleo/Examples/HAL/HAL_TimeBase/Src/stm32f4xx_it.c:174
174 }
(gdb) finish
Run till exit from #0 EXTI15_10_IRQHandler () at Projects/STM32F411RE-Nucleo/Examples/HAL/HAL_TimeBase/Src/stm32f4xx_it.c:174
Warning:
Cannot insert breakpoint 0.
Cannot acc...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.