From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24203 invoked by alias); 14 Apr 2004 11:23:50 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 24191 invoked from network); 14 Apr 2004 11:23:48 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.77.109) by sources.redhat.com with SMTP; 14 Apr 2004 11:23:48 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i3EBNlAo000660 for ; Wed, 14 Apr 2004 13:23:47 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i3EBNlVn007919 for ; Wed, 14 Apr 2004 13:23:47 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i3EBNloh007916; Wed, 14 Apr 2004 13:23:47 +0200 (CEST) Date: Wed, 14 Apr 2004 11:23:00 -0000 Message-Id: <200404141123.i3EBNloh007916@elgar.kettenis.dyndns.org> From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [PATCH/RFC] Add FUNCTION_START_OFFSET to return value of find_function_addr X-SW-Source: 2004-04/txt/msg00281.txt.bz2 The reason why inferior function calls don't work on the VAX is pretty simple. On the VAX the first instruction of a function has an offset of 2 bytes from the function's address; that's why we have FUNCTION_START_OFFSET in GDB. At the function's start address itself we find the function's entry mask, which defines which registers should be saved. The generic dummy frame framework doesn't take this into account, and sets the PC to the function's address. The result is a SIGILL. The attached patch fixes the problems by adding FUNCTION_START_OFFSET to the return value of infcall.c:find_function_addr(). Currently the VAX is the only target that sets FUNCTION_START_OFFSET. With this patch, the majority of the inferior function call tests in the testsuite pass. Most of the failures are related to function calls involving floating point arguments. This is because GDB doesn't understand the VAX floating-point format. If nobody objects, I'll check this in in a few days. Mark Index: ChangeLog from Mark Kettenis * infcall.c (find_function_addr): Add FUNCTION_START_OFFSET. Index: infcall.c =================================================================== RCS file: /cvs/src/src/gdb/infcall.c,v retrieving revision 1.40 diff -u -p -r1.40 infcall.c --- infcall.c 7 Mar 2004 18:06:14 -0000 1.40 +++ infcall.c 14 Apr 2004 11:01:40 -0000 @@ -206,7 +206,7 @@ find_function_addr (struct value *functi error ("Invalid data type for function to be called."); *retval_type = value_type; - return funaddr; + return funaddr + FUNCTION_START_OFFSET; } /* Call breakpoint_auto_delete on the current contents of the bpstat