• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

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

Revisiona8c4c3829b0f867890150dec379ca0e8281d0ca1 (tree)
Time2003-06-14 08:18:30
AuthorJim Blandy <jimb@code...>
CommiterJim Blandy

Log Message

* gdbarch.sh (gdbarch_bfd_entry_point): New gdbarch method.
* arch-utils.c (generic_bfd_entry_point): New function.
* arch-utils.h (generic_bfd_entry_point): New declaration.
* gdbarch.c, gdbarch.h: Regenerated.
* solib-svr4.c (enable_break): Call it, instead of accessing
tmp_bfd->start_address directly.

Change Summary

Incremental Difference

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
11 2003-06-13 Jim Blandy <jimb@redhat.com>
22
3+ * gdbarch.sh (gdbarch_bfd_entry_point): New gdbarch method.
4+ * arch-utils.c (generic_bfd_entry_point): New function.
5+ * arch-utils.h (generic_bfd_entry_point): New declaration.
6+ * gdbarch.c, gdbarch.h: Regenerated.
7+ * solib-svr4.c (enable_break): Call it, instead of accessing
8+ tmp_bfd->start_address directly.
9+
310 * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): New
411 function.
512 (ppc_linux_init_abi): Register it as the
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -368,6 +368,12 @@ cannot_register_not (int regnum)
368368 return 0;
369369 }
370370
371+CORE_ADDR
372+generic_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd)
373+{
374+ return bfd_get_start_address (abfd);
375+}
376+
371377 /* Legacy version of target_virtual_frame_pointer(). Assumes that
372378 there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or
373379 raw. */
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -81,6 +81,10 @@ extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs);
8181 extern const struct floatformat *default_float_format (struct gdbarch *gdbarch);
8282 extern const struct floatformat *default_double_format (struct gdbarch *gdbarch);
8383
84+/* Return the start address of ABFD. This is exactly like
85+ bfd_get_start_address, except that it's a gdbarch function. */
86+extern CORE_ADDR generic_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd);
87+
8488 /* The following DEPRECATED interfaces are for pre- multi-arch legacy
8589 targets. */
8690
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -264,6 +264,7 @@ struct gdbarch
264264 gdbarch_software_single_step_ftype *software_single_step;
265265 gdbarch_print_insn_ftype *print_insn;
266266 gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
267+ gdbarch_bfd_entry_point_ftype *bfd_entry_point;
267268 gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline;
268269 gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline;
269270 gdbarch_pc_in_sigtramp_ftype *pc_in_sigtramp;
@@ -432,6 +433,7 @@ struct gdbarch startup_gdbarch =
432433 0, /* software_single_step */
433434 0, /* print_insn */
434435 0, /* skip_trampoline_code */
436+ generic_bfd_entry_point, /* bfd_entry_point */
435437 0, /* in_solib_call_trampoline */
436438 0, /* in_solib_return_trampoline */
437439 0, /* pc_in_sigtramp */
@@ -557,6 +559,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
557559 current_gdbarch->smash_text_address = core_addr_identity;
558560 current_gdbarch->print_insn = legacy_print_insn;
559561 current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
562+ current_gdbarch->bfd_entry_point = generic_bfd_entry_point;
560563 current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline;
561564 current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
562565 current_gdbarch->pc_in_sigtramp = legacy_pc_in_sigtramp;
@@ -746,6 +749,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
746749 /* Skip verify of software_single_step, has predicate */
747750 /* Skip verify of print_insn, invalid_p == 0 */
748751 /* Skip verify of skip_trampoline_code, invalid_p == 0 */
752+ /* Skip verify of bfd_entry_point, invalid_p == 0 */
749753 /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */
750754 /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
751755 /* Skip verify of pc_in_sigtramp, invalid_p == 0 */
@@ -790,6 +794,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
790794 GDB_MULTI_ARCH);
791795 if (GDB_MULTI_ARCH)
792796 fprintf_unfiltered (file,
797+ "gdbarch_dump: bfd_entry_point = 0x%08lx\n",
798+ (long) current_gdbarch->bfd_entry_point);
799+ if (GDB_MULTI_ARCH)
800+ fprintf_unfiltered (file,
793801 "gdbarch_dump: gdbarch_frame_align_p() = %d\n",
794802 gdbarch_frame_align_p (current_gdbarch));
795803 if (GDB_MULTI_ARCH)
@@ -5436,6 +5444,25 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
54365444 gdbarch->skip_trampoline_code = skip_trampoline_code;
54375445 }
54385446
5447+CORE_ADDR
5448+gdbarch_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd)
5449+{
5450+ gdb_assert (gdbarch != NULL);
5451+ if (gdbarch->bfd_entry_point == 0)
5452+ internal_error (__FILE__, __LINE__,
5453+ "gdbarch: gdbarch_bfd_entry_point invalid");
5454+ if (gdbarch_debug >= 2)
5455+ fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_entry_point called\n");
5456+ return gdbarch->bfd_entry_point (gdbarch, abfd);
5457+}
5458+
5459+void
5460+set_gdbarch_bfd_entry_point (struct gdbarch *gdbarch,
5461+ gdbarch_bfd_entry_point_ftype bfd_entry_point)
5462+{
5463+ gdbarch->bfd_entry_point = bfd_entry_point;
5464+}
5465+
54395466 int
54405467 gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
54415468 {
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -2699,6 +2699,20 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s
26992699 #define SKIP_TRAMPOLINE_CODE(pc) (gdbarch_skip_trampoline_code (current_gdbarch, pc))
27002700 #endif
27012701
2702+/* The actual instruction address at which ABFD would begin execution.
2703+ If ABFD is position-independent code, this address is not relocated;
2704+ it's the address at which execution would begin if the file were
2705+ loaded at its sections' vmas.
2706+
2707+ On most architectures, this is simply bfd_get_start_address. But on
2708+ some (like 64-bit PPC), that points to a function descriptor, not an
2709+ instruction. The descriptor contains the actual entry point, and
2710+ other pointers needed to call the function. */
2711+
2712+typedef CORE_ADDR (gdbarch_bfd_entry_point_ftype) (struct gdbarch *gdbarch, bfd *abfd);
2713+extern CORE_ADDR gdbarch_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd);
2714+extern void set_gdbarch_bfd_entry_point (struct gdbarch *gdbarch, gdbarch_bfd_entry_point_ftype *bfd_entry_point);
2715+
27022716 /* For SVR4 shared libraries, each call goes through a small piece of
27032717 trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates
27042718 to nonzero if we are currently stopped in one of these. */
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -666,6 +666,16 @@ F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int i
666666 f:2:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::legacy_print_insn::0
667667 f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0
668668
669+# The actual instruction address at which ABFD would begin execution.
670+# If ABFD is position-independent code, this address is not relocated;
671+# it's the address at which execution would begin if the file were
672+# loaded at its sections' vmas.
673+#
674+# On most architectures, this is simply bfd_get_start_address. But on
675+# some (like 64-bit PPC), that points to a function descriptor, not an
676+# instruction. The descriptor contains the actual entry point, and
677+# other pointers needed to call the function.
678+m:1::CORE_ADDR:bfd_entry_point:bfd *abfd:abfd:::generic_bfd_entry_point::0
669679
670680 # For SVR4 shared libraries, each call goes through a small piece of
671681 # trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1036,7 +1036,8 @@ enable_break (void)
10361036 the current pc (which should point at the entry point for the
10371037 dynamic linker) and subtracting the offset of the entry point. */
10381038 if (!load_addr_found)
1039- load_addr = read_pc () - tmp_bfd->start_address;
1039+ load_addr = (read_pc ()
1040+ - gdbarch_bfd_entry_point (current_gdbarch, tmp_bfd));
10401041
10411042 /* Record the relocated start and end address of the dynamic linker
10421043 text and plt section for svr4_in_dynsym_resolve_code. */