From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28677 invoked by alias); 11 Jun 2012 10:14:37 -0000 Received: (qmail 28666 invoked by uid 22791); 11 Jun 2012 10:14:36 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_EG X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Jun 2012 10:14:23 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Se1dd-0001hf-2T from Maciej_Rozycki@mentor.com ; Mon, 11 Jun 2012 03:14:21 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 11 Jun 2012 03:13:47 -0700 Received: from [172.30.0.208] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Mon, 11 Jun 2012 11:14:19 +0100 Date: Mon, 11 Jun 2012 10:14:00 -0000 From: "Maciej W. Rozycki" To: Joel Brobecker CC: Mark Kettenis , Subject: Re: [RFA 1/2] mips: Switch inferior function calls to ON_STACK method. In-Reply-To: Message-ID: References: <201205042118.q44LIh3p018153@glazunov.sibelius.xs4all.nl> <201205051144.q45Bitv4006357@glazunov.sibelius.xs4all.nl> <20120508160542.GB15555@adacore.com> <20120508204257.GC15555@adacore.com> <20120508220805.GD15555@adacore.com> <201205090823.q498Njc7019605@glazunov.sibelius.xs4all.nl> <20120509143537.GH15555@adacore.com> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00276.txt.bz2 On Mon, 14 May 2012, Maciej W. Rozycki wrote: > I've lost track, sorry, however here is the promised update I will > include with the microMIPS change. I used a local variable to hold the > address of the breakpoint slot after all lest the result be horrible. No > regressions on mips-sde-elf or mips-linux-gnu, checked the usual set of > standard MIPS, MIPS16 and microMIPS multilibs. Hmm, I intended to fold this update into the original microMIPS change before committing, but somehow I did not. I have checked it now instead. 2012-06-11 Maciej W. Rozycki gdb/ * mips-tdep.c (mips_push_dummy_code): Handle microMIPS code. Maciej gdb-micromips-on-stack.diff Index: gdb-fsf-trunk-quilt/gdb/mips-tdep.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/mips-tdep.c 2012-05-12 21:21:38.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/mips-tdep.c 2012-05-12 22:45:37.355619042 +0100 @@ -4198,11 +4198,18 @@ mips_push_dummy_code (struct gdbarch *gd CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache) { - CORE_ADDR nop_addr; static gdb_byte nop_insn[] = { 0, 0, 0, 0 }; + CORE_ADDR nop_addr; + CORE_ADDR bp_slot; /* Reserve enough room on the stack for our breakpoint instruction. */ - *bp_addr = sp - sizeof (nop_insn); + bp_slot = sp - sizeof (nop_insn); + + /* Return to microMIPS mode if calling microMIPS code to avoid + triggering an address error exception on processors that only + support microMIPS execution. */ + *bp_addr = (mips_pc_is_micromips (gdbarch, funaddr) + ? make_compact_addr (bp_slot) : bp_slot); /* The breakpoint layer automatically adjusts the address of breakpoints inserted in a branch delay slot. With enough @@ -4211,7 +4218,7 @@ mips_push_dummy_code (struct gdbarch *gd trigger the adjustement, and break the function call entirely. So, we reserve those 4 bytes and write a nop instruction to prevent that from happening. */ - nop_addr = *bp_addr - sizeof (nop_insn); + nop_addr = bp_slot - sizeof (nop_insn); write_memory (nop_addr, nop_insn, sizeof (nop_insn)); sp = mips_frame_align (gdbarch, nop_addr);