This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug tdep/19401] AVR: gdb uses 2 byte breakpoints even for 4 byte insns which leads to illegal instruction
- From: "vapier at gentoo dot org" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Thu, 24 Dec 2015 23:46:24 +0000
- Subject: [Bug tdep/19401] AVR: gdb uses 2 byte breakpoints even for 4 byte insns which leads to illegal instruction
- Auto-submitted: auto-generated
- References: <bug-19401-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=19401
Mike Frysinger <vapier at gentoo dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |avr-elf
CC|vapier at gentoo dot org |
Component|sim |tdep
Summary|AVR: simulator fails with |AVR: gdb uses 2 byte
|illegal instruction when |breakpoints even for 4 byte
|function call present as |insns which leads to
|argument |illegal instruction
--- Comment #3 from Mike Frysinger <vapier at gentoo dot org> ---
when the breakpoint is hit, the $pc is 0x14a, but that's the middle of the
insn:
(gdb) disassemble main
Dump of assembler code for function main:
0x00000148 <+0>: call 0x11a ; 0x11a <bar>
0x0000014c <+4>: call 0x132 ; 0x132 <foo>
so when execution resumes, you get an invalid insn.
this is because gdb uses a 2 byte breakpoint for all insns:
gdb/avr-tdep.c:
static const unsigned char *
avr_breakpoint_from_pc (struct gdbarch *gdbarch,
CORE_ADDR *pcptr, int *lenptr)
{
static const unsigned char avr_break_insn [] = { 0x98, 0x95 };
*lenptr = sizeof (avr_break_insn);
return avr_break_insn;
}
so it's a bug in gdb -- it shouldn't be splitting insns, or at least when it
does, it should rewind properly.
the sim is behaving correctly -- gdb told it to run an invalid insn :).
--
You are receiving this mail because:
You are on the CC list for the bug.