From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22699 invoked by alias); 17 Nov 2005 20:23:29 -0000 Received: (qmail 22619 invoked by uid 22791); 17 Nov 2005 20:23:26 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 17 Nov 2005 20:23:26 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1EcqI0-0005nw-Cr; Thu, 17 Nov 2005 15:23:24 -0500 Date: Thu, 17 Nov 2005 20:23:00 -0000 From: Daniel Jacobowitz To: "Newman, Sarah R" Cc: gdb@sources.redhat.com Subject: Re: single stepping mips remote programs built with gcc 4.0 Message-ID: <20051117202324.GA22122@nevyn.them.org> Mail-Followup-To: "Newman, Sarah R" , gdb@sources.redhat.com References: <5990BE666D0436419054489CDD9D505409EE88E9@emss01m10.us.lmco.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5990BE666D0436419054489CDD9D505409EE88E9@emss01m10.us.lmco.com> User-Agent: Mutt/1.5.8i Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2005-11/txt/msg00357.txt.bz2 On Thu, Nov 17, 2005 at 12:13:48PM -0800, Newman, Sarah R wrote: > Hi, I have a version of gdb from CVS on 8/29/2005. I have configured with the target as mips-elf and the host as cygwin and I am using it to connect to a remote mips system. All of my programs I am trying to run remotely have been built with GCC 4+. I am single stepping through code where part of it consists of something like the following in the disassembly listing: > > 00003dac : > 00003dac: 24040001 li a0,1 > 00003db0: 08000deb j 000037ac > 00003db4: 24050001 li a1,1 > > 00003db8 : > 00003db8: 3c02bd00 lui v0,0xbd00 > > When stopped at the beginning of the function, I can tell by looking > at the remote protocol debug output that a breakpoint is being set in > memory at the location of getCurrentBuffer2, not setArraySize. We > suspect that this may have to do with GCC 4+ doing straight jumps to > other functions and not jump and link followed by jump register to > leave the function. Has anyone else encountered this or found a > solution? Could you please build a debuggable GDB binary, and trace through mips32_next_pc? It looks like it should handle the 'j' instruction just fine: case 2: /* J */ case 3: /* JAL */ { unsigned long reg; reg = jtype_target (inst) << 2; /* Upper four bits get never changed... */ pc = reg + ((pc + 4) & 0xf0000000); } break; J and JAL share a format, so this should be correct. It's as if the value GDB is extracting for the instruction is incorrect. -- Daniel Jacobowitz CodeSourcery, LLC