From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21480 invoked by alias); 15 May 2003 16:19:12 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 21427 invoked from network); 15 May 2003 16:19:10 -0000 Received: from unknown (HELO localhost.redhat.com) (24.157.166.107) by sources.redhat.com with SMTP; 15 May 2003 16:19:10 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 137712B2F; Thu, 15 May 2003 12:19:04 -0400 (EDT) Message-ID: <3EC3BDF7.3060304@redhat.com> Date: Thu, 15 May 2003 16:19:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Theodore A. Roth" Cc: gdb@sources.redhat.com Subject: Re: breakpoint for avr? References: <3EC26895.4090407@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-05/txt/msg00232.txt.bz2 > Ok, I added the BREAKPOINT_FROM_PC method for the avr and as I > suspected it doesn't interfere with remote targets (unless I am over > looking something): Right. If the remote target doesn't support the Z packet, GDB will use BREAKPOINT_FROM_PC and then insert breakpoints in memory. Try > (gdb) b main > Breakpoint 1 at 0x104: file tst.c, line 34. Do a: (gdb) set remote Z-packet off here. You'll then see GDB doing memory writes. > (gdb) c > Continuing. > Sending packet: $Z0,104,2#a9...Ack > Packet received: OK > Packet Z0 (software-breakpoint) is supported > Sending packet: $Hc0#db...Ack > Packet received: > Sending packet: $c#63...Ack > Packet received: T0520:02;21:ff10;22:04010000; > Sending packet: $g#67...Ack > Packet received: 00000000000000000000000000000000000100000000000000000001ff100a0102ff1004010000 > Sending packet: $mfc,8#9a...Ack > Packet received: cfefd0e1debfcdbf > Sending packet: $z0,104,2#c9...Ack > Packet received: OK > > Breakpoint 1, main () at tst.c:34 > (gdb) > > > Andrew, does the attached patch help things with your patch? If so, > I'll go ahead and commit it. Yes, it will avoid the problem. My patch is at: http://sources.redhat.com/ml/gdb-patches/2003-05/msg00211.html Andrew > 2003-05-14 Theodore A. Roth > > * avr-tdep.c (avr_breakpoint_from_pc): New function. > (avr_gdbarch_init): Set breakpoint_from_pc method. > > Index: avr-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/avr-tdep.c,v > retrieving revision 1.47 > diff -u -p -r1.47 avr-tdep.c > --- avr-tdep.c 14 May 2003 20:09:14 -0000 1.47 > +++ avr-tdep.c 14 May 2003 21:47:19 -0000 > @@ -1091,6 +1091,18 @@ avr_push_arguments (int nargs, struct va > return sp; > } > > +/* Not all avr devices support the BREAK insn. Those that don't should treat > + it as a NOP. Thus, it should be ok. Since the avr is currently a remote > + only target, this shouldn't be a problem (I hope). TRoth/2003-05-14 */ > + > +const unsigned char * > +avr_breakpoint_from_pc (CORE_ADDR * pcptr, int *lenptr) > +{ > + static unsigned char avr_break_insn [] = { 0x95, 0x98 }; > + *lenptr = sizeof (avr_break_insn); > + return avr_break_insn; > +} > + > /* Initialize the gdbarch structure for the AVR's. */ > > static struct gdbarch * > @@ -1189,6 +1201,7 @@ avr_gdbarch_init (struct gdbarch_info in > set_gdbarch_inner_than (gdbarch, core_addr_lessthan); > > set_gdbarch_decr_pc_after_break (gdbarch, 0); > + set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc); > > set_gdbarch_function_start_offset (gdbarch, 0); > set_gdbarch_remote_translate_xfer_address (gdbarch,