GNU Binutils with patches for OS216
Revision | a8c4c3829b0f867890150dec379ca0e8281d0ca1 (tree) |
---|---|
Time | 2003-06-14 08:18:30 |
Author | Jim Blandy <jimb@code...> |
Commiter | Jim Blandy |
* 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.
@@ -1,5 +1,12 @@ | ||
1 | 1 | 2003-06-13 Jim Blandy <jimb@redhat.com> |
2 | 2 | |
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 | + | |
3 | 10 | * ppc-linux-tdep.c (ppc64_linux_convert_from_func_ptr_addr): New |
4 | 11 | function. |
5 | 12 | (ppc_linux_init_abi): Register it as the |
@@ -368,6 +368,12 @@ cannot_register_not (int regnum) | ||
368 | 368 | return 0; |
369 | 369 | } |
370 | 370 | |
371 | +CORE_ADDR | |
372 | +generic_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd) | |
373 | +{ | |
374 | + return bfd_get_start_address (abfd); | |
375 | +} | |
376 | + | |
371 | 377 | /* Legacy version of target_virtual_frame_pointer(). Assumes that |
372 | 378 | there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or |
373 | 379 | raw. */ |
@@ -81,6 +81,10 @@ extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs); | ||
81 | 81 | extern const struct floatformat *default_float_format (struct gdbarch *gdbarch); |
82 | 82 | extern const struct floatformat *default_double_format (struct gdbarch *gdbarch); |
83 | 83 | |
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 | + | |
84 | 88 | /* The following DEPRECATED interfaces are for pre- multi-arch legacy |
85 | 89 | targets. */ |
86 | 90 |
@@ -264,6 +264,7 @@ struct gdbarch | ||
264 | 264 | gdbarch_software_single_step_ftype *software_single_step; |
265 | 265 | gdbarch_print_insn_ftype *print_insn; |
266 | 266 | gdbarch_skip_trampoline_code_ftype *skip_trampoline_code; |
267 | + gdbarch_bfd_entry_point_ftype *bfd_entry_point; | |
267 | 268 | gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline; |
268 | 269 | gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline; |
269 | 270 | gdbarch_pc_in_sigtramp_ftype *pc_in_sigtramp; |
@@ -432,6 +433,7 @@ struct gdbarch startup_gdbarch = | ||
432 | 433 | 0, /* software_single_step */ |
433 | 434 | 0, /* print_insn */ |
434 | 435 | 0, /* skip_trampoline_code */ |
436 | + generic_bfd_entry_point, /* bfd_entry_point */ | |
435 | 437 | 0, /* in_solib_call_trampoline */ |
436 | 438 | 0, /* in_solib_return_trampoline */ |
437 | 439 | 0, /* pc_in_sigtramp */ |
@@ -557,6 +559,7 @@ gdbarch_alloc (const struct gdbarch_info *info, | ||
557 | 559 | current_gdbarch->smash_text_address = core_addr_identity; |
558 | 560 | current_gdbarch->print_insn = legacy_print_insn; |
559 | 561 | current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code; |
562 | + current_gdbarch->bfd_entry_point = generic_bfd_entry_point; | |
560 | 563 | current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline; |
561 | 564 | current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline; |
562 | 565 | current_gdbarch->pc_in_sigtramp = legacy_pc_in_sigtramp; |
@@ -746,6 +749,7 @@ verify_gdbarch (struct gdbarch *gdbarch) | ||
746 | 749 | /* Skip verify of software_single_step, has predicate */ |
747 | 750 | /* Skip verify of print_insn, invalid_p == 0 */ |
748 | 751 | /* Skip verify of skip_trampoline_code, invalid_p == 0 */ |
752 | + /* Skip verify of bfd_entry_point, invalid_p == 0 */ | |
749 | 753 | /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */ |
750 | 754 | /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */ |
751 | 755 | /* Skip verify of pc_in_sigtramp, invalid_p == 0 */ |
@@ -790,6 +794,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) | ||
790 | 794 | GDB_MULTI_ARCH); |
791 | 795 | if (GDB_MULTI_ARCH) |
792 | 796 | 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, | |
793 | 801 | "gdbarch_dump: gdbarch_frame_align_p() = %d\n", |
794 | 802 | gdbarch_frame_align_p (current_gdbarch)); |
795 | 803 | if (GDB_MULTI_ARCH) |
@@ -5436,6 +5444,25 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, | ||
5436 | 5444 | gdbarch->skip_trampoline_code = skip_trampoline_code; |
5437 | 5445 | } |
5438 | 5446 | |
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 | + | |
5439 | 5466 | int |
5440 | 5467 | gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name) |
5441 | 5468 | { |
@@ -2699,6 +2699,20 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s | ||
2699 | 2699 | #define SKIP_TRAMPOLINE_CODE(pc) (gdbarch_skip_trampoline_code (current_gdbarch, pc)) |
2700 | 2700 | #endif |
2701 | 2701 | |
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 | + | |
2702 | 2716 | /* For SVR4 shared libraries, each call goes through a small piece of |
2703 | 2717 | trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates |
2704 | 2718 | to nonzero if we are currently stopped in one of these. */ |
@@ -666,6 +666,16 @@ F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int i | ||
666 | 666 | f:2:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::legacy_print_insn::0 |
667 | 667 | f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0 |
668 | 668 | |
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 | |
669 | 679 | |
670 | 680 | # For SVR4 shared libraries, each call goes through a small piece of |
671 | 681 | # trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates |
@@ -1036,7 +1036,8 @@ enable_break (void) | ||
1036 | 1036 | the current pc (which should point at the entry point for the |
1037 | 1037 | dynamic linker) and subtracting the offset of the entry point. */ |
1038 | 1038 | 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)); | |
1040 | 1041 | |
1041 | 1042 | /* Record the relocated start and end address of the dynamic linker |
1042 | 1043 | text and plt section for svr4_in_dynsym_resolve_code. */ |