From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9690 invoked by alias); 23 Jan 2006 20:48:08 -0000 Received: (qmail 9682 invoked by uid 22791); 23 Jan 2006 20:48:08 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Mon, 23 Jan 2006 20:48:07 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1F18bc-0007S8-Kp; Mon, 23 Jan 2006 15:48:04 -0500 Date: Mon, 23 Jan 2006 20:48:00 -0000 From: Daniel Jacobowitz To: NZG Cc: gdb-patches@sourceware.org, uClinux development list Subject: Re: gdb code review, pointer madness Message-ID: <20060123204804.GA28608@nevyn.them.org> Mail-Followup-To: NZG , gdb-patches@sourceware.org, uClinux development list References: <200601231438.26040.ngustavson@emacinc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200601231438.26040.ngustavson@emacinc.com> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00339.txt.bz2 On Mon, Jan 23, 2006 at 02:38:25PM -0600, NZG wrote: > I'm trying to get gdb 6.1's machine interface to work correctly with the m68k > arch, and I'm having some weird results. > > I've noticed that if I do a (frame -1) command on gdb after connecting to > remote gdb server, but before breaking in the main program, gdb goes crazy > and starts requesting random memory locations from gdbserver until something > crashes. > > Sooo... I'm using regular gdb to debug the m68k-elf-gdb connection, and I'm > seeing a problem "extract_unsigned_integer" (pasted below). > > Specifically this loop doesn't seem to be executing correctly > > for (p = startaddr; p < endaddr; ++p) > retval = (retval << 8) | *p; > > In the function call I'm watching, > endaddr = startaddr+4, > yet, when I step through the function the loop executes 8 times and overshoots > the array. You are probably just debugging optimized code. Either that, or your host compiler is completely broken; the loop is correct. -- Daniel Jacobowitz CodeSourcery