From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25907 invoked by alias); 1 Mar 2006 17:27:56 -0000 Received: (qmail 25899 invoked by uid 22791); 1 Mar 2006 17:27:55 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 01 Mar 2006 17:27:55 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 7D684544001; Wed, 1 Mar 2006 18:27:52 +0100 (CET) Date: Wed, 01 Mar 2006 17:27:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: [RFA] mn10300-tdep.c: Always write return address to MDR register on push_dummy_call Message-ID: <20060301172752.GV3184@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2i 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-03/txt/msg00010.txt.bz2 Hi, the mn10300 hardware always writes the return address to the stack and into the MDR register when any "call" machine instruction is executed. The mn10300_push_dummy_call function does only write the return address to the stack, which might result into problems when leaf functions are called and the MDR register is known not to be clobbered by "mul" or "div" instructions. The below patch also writes the return address always into the MDR register, like the hardware. Ok to apply? Corinna * mn10300-tdep.c (mn10300_push_dummy_call): Write breakpoint address to MDR register. Index: mn10300-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/mn10300-tdep.c,v retrieving revision 1.136 diff -u -p -r1.136 mn10300-tdep.c --- mn10300-tdep.c 28 Feb 2006 22:28:21 -0000 1.136 +++ mn10300-tdep.c 1 Mar 2006 17:23:05 -0000 @@ -1055,6 +1055,11 @@ mn10300_push_dummy_call (struct gdbarch /* Push the return address that contains the magic breakpoint. */ sp -= 4; write_memory_unsigned_integer (sp, push_size, bp_addr); + + /* The CPU also writes the return address always into the + MDR register on "call". */ + regcache_cooked_write_unsigned (regcache, E_MDR_REGNUM, bp_addr); + /* Update $sp. */ regcache_cooked_write_unsigned (regcache, E_SP_REGNUM, sp); return sp; -- Corinna Vinschen Cygwin Project Co-Leader Red Hat