This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tdep/16717] New: Reading in code space on AVR with a literal value shifts the address.


https://sourceware.org/bugzilla/show_bug.cgi?id=16717

            Bug ID: 16717
           Summary: Reading in code space on AVR with a literal value
                    shifts the address.
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: pierre.langlois at embecosm dot com
          Reporter: pierre.langlois at embecosm dot com
                CC: jeremy.bennett at embecosm dot com

Created attachment 7475
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7475&action=edit
Test program

This is due to the nature of the program counter on AVR, which is 2 bytes
addressed.

(gdb) break *(@code void *) 0x218
Breakpoint 2 at 0x430

or

(gdb) x *(@code void *) 0x218
0x430 <__mulsf3x>:      0xf3a0dfc6

The following GDB session comes from using AVaRice with real hardware
(ATxmega256a3bu).

-----------------------------------------------------------------------------

GNU gdb (AVR 8-bit toolchain (built 20140310)) 7.7.50.20140317-cvs
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:
<http://www.atmel.com>.
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".
(gdb) file atxmega-test.elf
Reading symbols from atxmega-test.elf...done.
(gdb) target remote :4242
Remote debugging using :4242
0x00000000 in __vectors ()
(gdb) load
Loading section .text, size 0x532 lma 0x0
Start address 0x0, load size 1330
Transfer rate: 2 KB/sec, 47 bytes/write.
(gdb) b main
Breakpoint 1 at 0x212: file main.c, line 7.
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.

Breakpoint 1, main () at main.c:7
7      PORTR.DIRSET = 3;
(gdb) break *(@code void *) 0x218
Breakpoint 2 at 0x430
(gdb) break *(@code void *) 0x10a
Breakpoint 3 at 0x214: file main.c, line 7.
(gdb) q
A debugging session is active.

    Inferior 1 [Remote target] will be killed.

Quit anyway? (y or n)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]