This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/RFC] Add FUNCTION_START_OFFSET to return value of find_function_addr


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  <kettenis@gnu.org>
 
	* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]