Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Fix erroneous backtrace on avrxmega architectures.
@ 2014-04-08 14:30 Pierre Langlois
  2014-04-08 14:49 ` Joel Brobecker
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Langlois @ 2014-04-08 14:30 UTC (permalink / raw)
  To: gdb-patches

Hi all,

This patch adds avrxmega architectures to GDB, as given by bfd_architecture,
when setting call_length. This is the length of an address pushed on the stack
by a call instruction.

It was incorrect on avrxmega devices with more than 128k of memory (tested on
the atxmega256a3bu), which would break stack-unwinding.

Best,

Pierre

2014-04-08  Pierre Langlois  <pierre.langlois@embecosm.com>

	* avr-tdep.c (struct gdbarch_tdep): Mention avrxmega in the comment.
	(avr_gdbarch_init): Add xmega architectures given by bfd_architecture
	when setting the size of call_length.
---
  gdb/avr-tdep.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 7fb16d1..9b0bfaf 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -180,7 +180,7 @@ struct avr_unwind_cache
  struct gdbarch_tdep
  {
    /* Number of bytes stored to the stack by call instructions.
-     2 bytes for avr1-5, 3 bytes for avr6.  */
+     2 bytes for avr1-5 and avrxmega1-5, 3 bytes for avr6 and avrxmega6-7.  */
    int call_length;
  
    /* Type for void.  */
@@ -1356,14 +1356,21 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
    switch (info.bfd_arch_info->mach)
      {
      case bfd_mach_avr1:
+    case bfd_mach_avrxmega1:
      case bfd_mach_avr2:
+    case bfd_mach_avrxmega2:
      case bfd_mach_avr3:
+    case bfd_mach_avrxmega3:
      case bfd_mach_avr4:
+    case bfd_mach_avrxmega4:
      case bfd_mach_avr5:
+    case bfd_mach_avrxmega5:
      default:
        call_length = 2;
        break;
      case bfd_mach_avr6:
+    case bfd_mach_avrxmega6:
+    case bfd_mach_avrxmega7:
        call_length = 3;
        break;
      }
-- 
1.9.1


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

* Re: [PATCH] Fix erroneous backtrace on avrxmega architectures.
  2014-04-08 14:30 [PATCH] Fix erroneous backtrace on avrxmega architectures Pierre Langlois
@ 2014-04-08 14:49 ` Joel Brobecker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Brobecker @ 2014-04-08 14:49 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: gdb-patches

> 2014-04-08  Pierre Langlois  <pierre.langlois@embecosm.com>
> 
> 	* avr-tdep.c (struct gdbarch_tdep): Mention avrxmega in the comment.
> 	(avr_gdbarch_init): Add xmega architectures given by bfd_architecture
> 	when setting the size of call_length.

Thanks for the patch. Please go ahead and commit.

-- 
Joel


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

end of thread, other threads:[~2014-04-08 14:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-08 14:30 [PATCH] Fix erroneous backtrace on avrxmega architectures Pierre Langlois
2014-04-08 14:49 ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox