Bug 16721

Summary: Erroneous backtrace on AVR
Product: gdb Reporter: Pierre Langlois <pierre.langlois>
Component: backtraceAssignee: Pierre Langlois <pierre.langlois>
Severity: normal CC: jeremy.bennett
Priority: P2    
Version: 7.7   
Target Milestone: ---   
Host: Target: avr
Build: Last reconfirmed:
Attachments: Test program and elf file.

Description Pierre Langlois 2014-03-18 14:48:49 UTC
Created attachment 7480 [details]
Test program and elf file.

Stack unwinding is not working with this small program:

(gdb) bt
#0  multiply (a=25, b=8) at ../src/main.c:4
#1  *0x01e00000 in ?? ()

This was tested running against simulator models with the atmega2560 chip.


GNU gdb (AVR 8-bit toolchain (built 20140310))
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-unknown-linux-gnu --target=avr".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
Find the GDB manual and other documentation resources online at:
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) file atmega-test.elf
Reading symbols from atmega-test.elf...done.
(gdb) target d[Kremote :51000
Remote debugging using :51000
0x00000116 in multiply (a=25, b=8) at main.c:4
4		return a * b;
(gdb) monitor reset
(gdb) load
Loading section .text, size 0x1a4 lma 0x0
Start address 0x0, load size 420
Transfer rate: 3360 bits in <1 sec, 210 bytes/write.
(gdb) b multiply
Breakpoint 1 at 0x114: file main.c, line 4.
(gdb) c

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00000116 in multiply (a=25, b=8) at main.c:4
4		return a * b;
(gdb) bt
#0  0x00000116 in multiply (a=25, b=8) at main.c:4
#1  0x01e00000 in ?? ()
(gdb) q
A debugging session is active.

	Inferior 1 [Remote target] will be killed.

Quit anyway? (y or n)
Comment 1 Pierre Langlois 2014-03-24 10:39:01 UTC
Fixed by commit 7588d2eca0397166c2445eae6559c89f9b44e4e7

Comment 2 cvs-commit@gcc.gnu.org 2014-04-11 09:34:59 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gdb and binutils".

The branch, gdb-7.7-branch has been updated
       via  999686dbc169a7beb0e7e88f5c76dca12174fdbf (commit)
      from  7456303a042711adee7c0ab3ec76df6e29616c88 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------

commit 999686dbc169a7beb0e7e88f5c76dca12174fdbf
Author: Pierre Langlois <pierre.langlois@embecosm.com>
Date:   Fri Mar 21 19:46:07 2014 +0000

    Erroneous backtrace on AVR.
    	PR backtrace/16721
    	PR backtrace/16832
    	* 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.
    	(avr_scan_prologue): Accept push r1 instruction for small stack
    	* MAINTAINERS (Write After Approval): Add "Pierre Langlois".


Summary of changes:
 gdb/ChangeLog   |   11 +++++++++++
 gdb/MAINTAINERS |    1 +
 gdb/avr-tdep.c  |   11 +++++++++--
 3 files changed, 21 insertions(+), 2 deletions(-)