• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

修訂f3a32a2d04af5bfb77b2cd2913f131b243cee0ec (tree)
時間2003-06-11 17:54:54
作者Jim Blandy <jimb@code...>
CommiterJim Blandy

Log Message

* 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.

Change Summary

差異

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
11 2003-06-11 Jim Blandy <jimb@redhat.com>
22
3+ * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): New
4+ function.
5+ (ppc_linux_init_abi): Register it as the
6+ CONVERT_FROM_FUNC_PTR_ADDR method under the PPC64 Linux ABI.
7+
38 * ppc-linux-tdep.c (ppc_linux_init_abi): long doubles are 16 bytes
49 long.
510
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -894,6 +894,39 @@ ppc64_skip_trampoline_code (CORE_ADDR pc)
894894 }
895895
896896
897+/* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR).
898+
899+ Usually a function pointer's representation is simply the address
900+ of the function. On the RS/6000 however, a function pointer is
901+ represented by a pointer to a TOC entry. This TOC entry contains
902+ three words, the first word is the address of the function, the
903+ second word is the TOC pointer (r2), and the third word is the
904+ static chain value. Throughout GDB it is currently assumed that a
905+ function pointer contains the address of the function, which is not
906+ easy to fix. In addition, the conversion of a function address to
907+ a function pointer would require allocation of a TOC entry in the
908+ inferior's memory space, with all its drawbacks. To be able to
909+ call C++ virtual methods in the inferior (which are called via
910+ function pointers), find_function_addr uses this function to get the
911+ function address from a function pointer. */
912+
913+/* Return real function address if ADDR (a function pointer) is in the data
914+ space and is therefore a special function pointer. */
915+
916+static CORE_ADDR
917+ppc64_linux_convert_from_func_ptr_addr (CORE_ADDR addr)
918+{
919+ struct obj_section *s;
920+
921+ s = find_pc_section (addr);
922+ if (s && s->the_bfd_section->flags & SEC_CODE)
923+ return addr;
924+
925+ /* ADDR is in the data space, so it's a special function pointer. */
926+ return ppc64_desc_entry_point (addr);
927+}
928+
929+
897930 /* On 64-bit PowerPC Linux, the ELF header's e_entry field is the
898931 address of a function descriptor for the entry point function, not
899932 the actual entry point itself. So to find the actual address at
@@ -1029,6 +1062,11 @@ ppc_linux_init_abi (struct gdbarch_info info,
10291062 {
10301063 set_gdbarch_long_double_bit (gdbarch, 16 * TARGET_CHAR_BIT);
10311064
1065+ /* Handle PPC64 Linux function pointers (which are really
1066+ function descriptors). */
1067+ set_gdbarch_convert_from_func_ptr_addr
1068+ (gdbarch, ppc64_linux_convert_from_func_ptr_addr);
1069+
10321070 set_gdbarch_call_dummy_address (gdbarch, ppc64_call_dummy_address);
10331071
10341072 set_gdbarch_in_solib_call_trampoline