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]

Re: [ppc64-linux]: register CONVERT_FROM_FUNC_PTR_ADDR method


On Jun 11,  3:53am, Jim Blandy wrote:

> 2003-06-11  Jim Blandy  <jimb@redhat.com>
> 
> 	* ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): New
> 	function.
> 	(ppc_linux_init_abi): Register it as the
> 	CONVERT_FROM_FUNC_PTR_ADDR method under the PPC64 Linux ABI.

Okay, but could you revise the comment to not mention RS/6000 and
to make it clear that the representation in question only pertains
to the 64-bit ABI?

> + /* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR).
> + 
> +    Usually a function pointer's representation is simply the address
> +    of the function. On the RS/6000 however, a function pointer is
> +    represented by a pointer to a TOC entry. This TOC entry contains
> +    three words, the first word is the address of the function, the
> +    second word is the TOC pointer (r2), and the third word is the
> +    static chain value.  Throughout GDB it is currently assumed that a
> +    function pointer contains the address of the function, which is not
> +    easy to fix.  In addition, the conversion of a function address to
> +    a function pointer would require allocation of a TOC entry in the
> +    inferior's memory space, with all its drawbacks.  To be able to
> +    call C++ virtual methods in the inferior (which are called via
> +    function pointers), find_function_addr uses this function to get the
> +    function address from a function pointer.  */

Kevin


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