public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] v2 gdb/arm: Fixes for Cortex-M stack unwinding
@ 2022-11-18 15:52 Torbjörn SVENSSON
  2022-11-18 15:52 ` [PATCH v2 1/4] gdb/arm: Update active msp/psp when switching stack Torbjörn SVENSSON
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Torbjörn SVENSSON @ 2022-11-18 15:52 UTC (permalink / raw)
  To: gdb-patches; +Cc: luis.machado, vanekt, torbjorn.svensson

Hi,

This patchset attempts to attack the issue reported in pr/29738.

Based on my testing on a STM32L552 with TrustZone, it appears to work as
expected, but I'd love to have another set of eyes on this!

Most of the items reported can be seen using the GTZC example from ST:
https://github.com/STMicroelectronics/STM32CubeL5/tree/master/Projects/NUCLEO-L552ZE-Q/Examples/GTZC/GTZC_TZSC_MPCBB_TrustZone

I've manually verfied the register content by setting break points in
* main
* Error_Handler
* SecureFault_Handler


For the dwarf2 problem in pr/29738, I added 7-chained functions like
below and placed a breakpoint at myfunc7:

  void myfunc7()
    {
      HAL_Delay(1);
    }
  ...
  void myfunc1()
    {
      HAL_Delay(1);
      myfunc2();
    }

For each breakpoint, I then used the below macros to print the
registers. For each of the printed frames, I then manually checked if
the values maked sense.

define show_reg
  shell printf "%-8s " '$arg0'
  p/x $arg0
end
define show_stacks
  shell echo
  shell echo -e "\x1b[35mContent at $arg0\x1b[0m"
  bt
  set $i = 0
  while $i <= $arg1
    f $i
    show_reg $lr
    show_reg $pc
    show_reg $sp
    show_reg $msp
    show_reg $msp_s
    show_reg $msp_ns
    show_reg $psp
    show_reg $psp_s
    show_reg $psp_ns

    shell echo
    set $i = $i + 1
  end
  shell echo
  shell echo
end


The show_stacks macro takes 2 arguments, a description and the number of
frames to print registers for.
To show the registers for all the frames when at the Error_Handler
breakpoint, I used:
show_stacks "Error_Handler" 7


After talkning to Luis about the v1 series of these patches, we
concluded that a generic way to store the data needed by the
prev_register function was better than trying to squeze the logic
into the _init function.


Kind regards,
Torbjörn



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-01-19 10:31 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 15:52 [PATCH 0/4] v2 gdb/arm: Fixes for Cortex-M stack unwinding Torbjörn SVENSSON
2022-11-18 15:52 ` [PATCH v2 1/4] gdb/arm: Update active msp/psp when switching stack Torbjörn SVENSSON
2022-11-21 14:04   ` Luis Machado
2022-11-18 15:52 ` [PATCH v2 2/4] gdb/arm: Ensure that stack pointers are in sync Torbjörn SVENSSON
2022-11-21 14:04   ` Luis Machado
2022-11-18 15:52 ` [PATCH v2 3/4] gdb: dwarf2 generic implementation for caching function data Torbjörn SVENSSON
2022-11-18 16:01   ` Torbjorn SVENSSON
2022-12-20 21:04     ` Tom Tromey
2022-11-21 21:16   ` Luis Machado
2022-11-29 15:19     ` Torbjorn SVENSSON
2022-11-29 16:24       ` Tomas Vanek
2022-11-30 10:16         ` Torbjorn SVENSSON
2022-11-30 10:19           ` Luis Machado
2022-12-08  1:11           ` Luis Machado
2022-12-19 19:28     ` [PING] " Torbjorn SVENSSON
2022-12-20 21:02   ` Tom Tromey
2022-12-28 16:16     ` Torbjorn SVENSSON
2023-01-05 20:53       ` Torbjorn SVENSSON
2023-01-14  6:54       ` Joel Brobecker
2023-01-18 18:47   ` Tom Tromey
2023-01-19 10:31     ` Torbjorn SVENSSON
2022-11-18 15:52 ` [PATCH v2 4/4] gdb/arm: Use new dwarf2 function cache Torbjörn SVENSSON
2022-11-21 21:04   ` Luis Machado
2022-11-29 15:19     ` Torbjorn SVENSSON

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).