From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4943 invoked by alias); 9 Jul 2008 15:48:28 -0000 Received: (qmail 4924 invoked by uid 22791); 9 Jul 2008 15:48:26 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jul 2008 15:48:08 +0000 Received: (qmail 31330 invoked from network); 9 Jul 2008 15:48:06 -0000 Received: from unknown (HELO orlando.local) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 9 Jul 2008 15:48:06 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: Fix Ericsson DICOS inferior function calls Date: Wed, 09 Jul 2008 15:48:00 -0000 User-Agent: KMail/1.9.9 Cc: Mark Kettenis References: <200807072309.56077.pedro@codesourcery.com> <200807072256.m67MuLP2010832@brahms.sibelius.xs4all.nl> In-Reply-To: <200807072256.m67MuLP2010832@brahms.sibelius.xs4all.nl> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_62NdIuo0CYMrUqb" Message-Id: <200807091648.10557.pedro@codesourcery.com> X-IsSubscribed: yes 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: 2008-07/txt/msg00138.txt.bz2 --Boundary-00=_62NdIuo0CYMrUqb Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 436 Hi Mark, On Monday 07 July 2008 23:56:21, Mark Kettenis wrote: > I think we should get rid of generic_push_dummy_code(), and instead > require that each target that puts the dummy breakpoint on the stack > provides its own push_dummy_code() function. Could you provide one > for DICOS? Something like this? It looks like the only other target that uses ON_STACK and doesn't define a push_dummy_code is spu-tdep.c. -- Pedro Alves --Boundary-00=_62NdIuo0CYMrUqb Content-Type: text/x-diff; charset="utf-8"; name="dicos_push_dummy_code.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dicos_push_dummy_code.diff" Content-length: 1930 2008-07-09 Pedro Alves * i386-dicos-tdep.c (i386_dicos_frame_align): Delete. (i386_dicos_push_dummy_code): New. (i386_dicos_init_abi): Don't register i386_dicos_frame_align. Register i386_dicos_push_dummy_code. --- gdb/i386-dicos-tdep.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) Index: src/gdb/i386-dicos-tdep.c =================================================================== --- src.orig/gdb/i386-dicos-tdep.c 2008-07-09 00:33:38.000000000 +0100 +++ src/gdb/i386-dicos-tdep.c 2008-07-09 00:41:36.000000000 +0100 @@ -25,14 +25,21 @@ #include "inferior.h" static CORE_ADDR -i386_dicos_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp) +i386_dicos_push_dummy_code (struct gdbarch *gdbarch, + CORE_ADDR sp, CORE_ADDR funaddr, + struct value **args, int nargs, + struct type *value_type, + CORE_ADDR *real_pc, CORE_ADDR *bp_addr, + struct regcache *regcache) { - /* Having a call dummy on the stack requires a gdbarch_frame_align - method to align the breakpoint instruction in the stack. - Strictly speaking, we could just return SP pristine on x86. But, - as long as we're providing a frame align method, might as well - align for efficiency. */ - return sp & -(CORE_ADDR)16; + int bplen; + CORE_ADDR bppc = sp; + + gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen); + *bp_addr = sp - bplen; + *real_pc = funaddr; + + return *bp_addr; } static void @@ -46,7 +53,7 @@ i386_dicos_init_abi (struct gdbarch_info text location we could find with a symbol where to place the call dummy, so we put it on the stack. */ set_gdbarch_call_dummy_location (gdbarch, ON_STACK); - set_gdbarch_frame_align (gdbarch, i386_dicos_frame_align); + set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code); } /* Look in the elf symbol table of ABFD for a symbol named WANTED. --Boundary-00=_62NdIuo0CYMrUqb--