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 breakpoints/16606] New: While setting temporary breakpoint on AVR8 GDB made access to out of range program memory.


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

            Bug ID: 16606
           Summary: While setting temporary breakpoint on AVR8 GDB made
                    access to out of range program memory.
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
          Assignee: unassigned at sourceware dot org
          Reporter: vidarlsw at hotmail dot com

Created attachment 7428
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7428&action=edit
Source code and ELF file for example program.

When debugging an AVR8 program and setting breakpoint at a specified address,
the breakpoint is set on a different address typically (address & 0x800000)
which is in the data segment (OFFSET_DATA is 0x800000). This was seen first for
temporary breakpoints when running debugging with GDB in Atmel Studio 6.2 beta,
it was also reproduced when debugging AVR8 (ATMega2560) in GDB through gdbproxy
(with simulator model libATmega256.dll). The log below shows this problem
resulting in message:
  Warning:
  Cannot insert breakpoint 2.
  Cannot access memory at address 0x80010e

It also shows a problem when stepping out of multiply to main resulting in
message:
  Warning:
  Cannot insert breakpoint 0.
  Cannot access memory at address 0x1f00000

Log of GDB v7.7.50 session (Feb. 14, 2014 version):
----------------------------------------------------------------
$ ../../../binutils-gdb-build-avr-20140214/gdb/gdb
GNU gdb (GDB) 7.7.50.20140214-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=i686-pc-mingw32 --target=avr".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
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) target remote :20349
:20349: A connection attempt failed because the connected party did not
properly respond after a period of time, or established connection f
ailed because connected host has failed to respond.
(gdb) target remote :50349
Remote debugging using :50349
warning: limiting remote suggested packet size (131104 bytes) to 16384
0x00000000 in ?? ()
(gdb) load ATMega2560-simple-program
ATMega2560-simple-program: No such file or directory.
(gdb) load ATMega2560-simple-program.elf
Loading section .text, size 0x152 lma 0x0
Start address 0x0, load size 338
Transfer rate: 165 KB/sec, 338 bytes/write.
(gdb) file ATMega2560-simple-program.elf
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from ATMega2560-simple-program.elf...done.
(gdb) monitor reset
Performing Power-on reset -  Reset OK
(gdb) tbreak main
Temporary breakpoint 1 at 0x13e: file .././ATMega2560-simple-program.c, line
22.
(gdb) cont
Continuing.
Temporary breakpoint 1, main () at .././ATMega2560-simple-program.c:22
22                      int a = multiply(2, 3);
(gdb) break *0x10e
Breakpoint 2 at 0x80010e
(gdb) info break
Num     Type           Disp Enb Address    What
2       breakpoint     keep y   0x0080010e
(gdb) info line 14
Line 14 of ".././ATMega2560-simple-program.c" starts at address 0x10e
<multiply+20> and ends at 0x124 <multiply+42>.
(gdb) step
Warning:
Cannot insert breakpoint 2.
Cannot access memory at address 0x80010e
(gdb) delete break
Delete all breakpoints? (y or n) y
(gdb) step
multiply (a=2, b=3) at .././ATMega2560-simple-program.c:14
14              return a * b;
(gdb) bt
#0  multiply (a=2, b=3) at .././ATMega2560-simple-program.c:14
#1  0x01f00000 in ?? ()
(gdb) where
#0  multiply (a=2, b=3) at .././ATMega2560-simple-program.c:14
#1  0x01f00000 in ?? ()
(gdb) finish
Run till exit from #0  multiply (a=2, b=3) at
.././ATMega2560-simple-program.c:14
Warning:
Cannot insert breakpoint 0.
Cannot access memory at address 0x1f00000
(gdb) step
15      }
(gdb) step
main () at .././ATMega2560-simple-program.c:23
23          }
(gdb) step
22                      int a = multiply(2, 3);
(gdb)

-- 
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]