gdb/arm: Stop unwinding on error, but do not assert
commitce6c3d253b97961801bc045d10b7fd022578fd03
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Thu, 6 Oct 2022 14:15:56 +0000 (6 16:15 +0200)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Fri, 14 Oct 2022 13:06:12 +0000 (14 15:06 +0200)
treeec3df5c182f986f1ddd6e69871ef870ed680ced4
parent5abb5d3f67d6469cbb21978df09187f1ae93f5ea
gdb/arm: Stop unwinding on error, but do not assert

When it's impossible to read the FPCCR and XPSR, the unwinding is
unpredictable as the it's not possible to determine the correct
frame size or padding.
The only sane thing to do in this condition is to stop the unwinding.

Example session without this patch:

  (gdb) bt
  #0  SVC_Handler () at .../GPIO/GPIO_EXTI/Src/stm32f4xx_it.c:112
  .../gdb/arm-tdep.c:3594: internal-error: arm_m_exception_cache: Assertion `safe_read_memory_unsigned_integer (FPCCR, ARM_INT_REGISTER_SIZE, byte_order, &fpccr)' failed.
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  ----- Backtrace -----
  0x5583bfb2a157 gdb_internal_backtrace_1
  ...
  ---------------------

  This is a bug, please report it.  For instructions, see:
  <https://www.gnu.org/software/gdb/bugs/>.

  Aborted (core dumped)

Example session with this patch:

  (gdb) bt
  #0  SVC_Handler () at .../GPIO/GPIO_EXTI/Src/stm32f4xx_it.c:112
  warning: Could not fetch required FPCCR content.  Further unwind is impossible.
  #1  <signal handler called>
  (gdb)

Reviewed-by: Pedro Alves <pedro@palves.net>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
gdb/arm-tdep.c