]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gdbarch.sh (gdbarch_bfd_entry_point): New gdbarch method.
authorJim Blandy <jimb@codesourcery.com>
Wed, 11 Jun 2003 13:20:06 +0000 (13:20 +0000)
committerJim Blandy <jimb@codesourcery.com>
Wed, 11 Jun 2003 13:20:06 +0000 (13:20 +0000)
* 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.

gdb/ChangeLog
gdb/arch-utils.c
gdb/arch-utils.h
gdb/gdbarch.c
gdb/gdbarch.h
gdb/gdbarch.sh
gdb/solib-svr4.c

index 8d013620adae6617693752d0b2d75211b2d0661d..eab6e25dcb52f8f8ab125d345b3618b20f84ad9b 100644 (file)
@@ -1,5 +1,12 @@
 2003-06-11  Jim Blandy  <jimb@redhat.com>
 
+       * 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.
+
        * solib-svr4.c (solib_break_names): Recognize the 64-bit PowerPC
        Linux entry point symbols for _dl_debug_state, too.
 
index bdf370b000378b93fe48bb424201d474c76a96a7..8d31ffe41de2fd2531a3d72d444746f13343a501 100644 (file)
@@ -375,6 +375,12 @@ cannot_register_not (int regnum)
   return 0;
 }
 
+CORE_ADDR
+generic_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd)
+{
+  return bfd_get_start_address (abfd);
+}
+
 /* Legacy version of target_virtual_frame_pointer().  Assumes that
    there is an DEPRECATED_FP_REGNUM and that it is the same, cooked or
    raw.  */
index 733bb3e866d53dfddade2e1f05f84cbf43de7e99..f62fa97df62df84059ff25ea77c2bb28d88739e8 100644 (file)
@@ -89,6 +89,10 @@ extern const struct floatformat *default_double_format (struct gdbarch *gdbarch)
    being passed */
 extern int frame_num_args_unknown (struct frame_info *fi);
 
+/* Return the start address of ABFD.  This is exactly like
+   bfd_get_start_address, except that it's a gdbarch function.  */
+extern CORE_ADDR generic_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd);
+
 
 /* The following DEPRECATED interfaces are for pre- multi-arch legacy
    targets. */
index 976ce59ae139ee31f403b943e56acd0df214f293..5c853361f1e2cf771b9869a039e3ddb9c99672aa 100644 (file)
@@ -263,6 +263,7 @@ struct gdbarch
   gdbarch_software_single_step_ftype *software_single_step;
   gdbarch_print_insn_ftype *print_insn;
   gdbarch_skip_trampoline_code_ftype *skip_trampoline_code;
+  gdbarch_bfd_entry_point_ftype *bfd_entry_point;
   gdbarch_in_solib_call_trampoline_ftype *in_solib_call_trampoline;
   gdbarch_in_solib_return_trampoline_ftype *in_solib_return_trampoline;
   gdbarch_pc_in_sigtramp_ftype *pc_in_sigtramp;
@@ -429,6 +430,7 @@ struct gdbarch startup_gdbarch =
   0,
   0,
   0,
+  generic_bfd_entry_point,
   0,
   0,
   0,
@@ -555,6 +557,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
   current_gdbarch->smash_text_address = core_addr_identity;
   current_gdbarch->print_insn = legacy_print_insn;
   current_gdbarch->skip_trampoline_code = generic_skip_trampoline_code;
+  current_gdbarch->bfd_entry_point = generic_bfd_entry_point;
   current_gdbarch->in_solib_call_trampoline = generic_in_solib_call_trampoline;
   current_gdbarch->in_solib_return_trampoline = generic_in_solib_return_trampoline;
   current_gdbarch->pc_in_sigtramp = legacy_pc_in_sigtramp;
@@ -745,6 +748,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
   /* Skip verify of software_single_step, has predicate */
   /* Skip verify of print_insn, invalid_p == 0 */
   /* Skip verify of skip_trampoline_code, invalid_p == 0 */
+  /* Skip verify of bfd_entry_point, invalid_p == 0 */
   /* Skip verify of in_solib_call_trampoline, invalid_p == 0 */
   /* Skip verify of in_solib_return_trampoline, invalid_p == 0 */
   /* Skip verify of pc_in_sigtramp, invalid_p == 0 */
@@ -786,6 +790,10 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
   fprintf_unfiltered (file,
                       "gdbarch_dump: GDB_MULTI_ARCH = %d\n",
                       GDB_MULTI_ARCH);
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: bfd_entry_point = 0x%08lx\n",
+                        (long) current_gdbarch->bfd_entry_point);
   if (GDB_MULTI_ARCH)
     fprintf_unfiltered (file,
                         "gdbarch_dump: gdbarch_frame_align_p() = %d\n",
@@ -5332,6 +5340,25 @@ set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch,
   gdbarch->skip_trampoline_code = skip_trampoline_code;
 }
 
+CORE_ADDR
+gdbarch_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd)
+{
+  gdb_assert (gdbarch != NULL);
+  if (gdbarch->bfd_entry_point == 0)
+    internal_error (__FILE__, __LINE__,
+                    "gdbarch: gdbarch_bfd_entry_point invalid");
+  if (gdbarch_debug >= 2)
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_bfd_entry_point called\n");
+  return gdbarch->bfd_entry_point (gdbarch, abfd);
+}
+
+void
+set_gdbarch_bfd_entry_point (struct gdbarch *gdbarch,
+                             gdbarch_bfd_entry_point_ftype bfd_entry_point)
+{
+  gdbarch->bfd_entry_point = bfd_entry_point;
+}
+
 int
 gdbarch_in_solib_call_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, char *name)
 {
index e80836f2a33eb0208dde6b5996061941560bf28c..c97f796d637858502eae23204888cb32143e8a8b 100644 (file)
@@ -2831,6 +2831,15 @@ extern void set_gdbarch_skip_trampoline_code (struct gdbarch *gdbarch, gdbarch_s
 #endif
 #endif
 
+/* The actual code address at which ABFD would begin execution.  Note
+   that on some architectures (like 64-bit PowerPC Linux),
+   bfd_get_start_address actually points to a function descriptor, not
+   the start function's entry point itself. */
+
+typedef CORE_ADDR (gdbarch_bfd_entry_point_ftype) (struct gdbarch *gdbarch, bfd *abfd);
+extern CORE_ADDR gdbarch_bfd_entry_point (struct gdbarch *gdbarch, bfd *abfd);
+extern void set_gdbarch_bfd_entry_point (struct gdbarch *gdbarch, gdbarch_bfd_entry_point_ftype *bfd_entry_point);
+
 /* For SVR4 shared libraries, each call goes through a small piece of
    trampoline code in the ".plt" section.  IN_SOLIB_CALL_TRAMPOLINE evaluates
    to nonzero if we are currently stopped in one of these. */
index f6106e4f372e887d71b5a7ae04f49de2e6ff031b..681d7e9c21385cc51d794eeab407d38ba2addf47 100755 (executable)
@@ -654,6 +654,11 @@ F:2:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int i
 f:2:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, disassemble_info *info:vma, info:::legacy_print_insn::0
 f:2:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0
 
+# The actual code address at which ABFD would begin execution.  Note
+# that on some architectures (like 64-bit PowerPC Linux),
+# bfd_get_start_address actually points to a function descriptor, not
+# the start function's entry point itself.
+m:1::CORE_ADDR:bfd_entry_point:bfd *abfd:abfd:::generic_bfd_entry_point::0
 
 # For SVR4 shared libraries, each call goes through a small piece of
 # trampoline code in the ".plt" section.  IN_SOLIB_CALL_TRAMPOLINE evaluates
index 7b0abfd011321e545b5a0794f9c0a097d051ea51..0f4542b6d93b7cf7c095343a46e251ec8b2c49d4 100644 (file)
@@ -1022,7 +1022,8 @@ enable_break (void)
         the current pc (which should point at the entry point for the
         dynamic linker) and subtracting the offset of the entry point.  */
       if (!load_addr_found)
-       load_addr = read_pc () - tmp_bfd->start_address;
+       load_addr = (read_pc ()
+                     - generic_bfd_entry_point (current_gdbarch, tmp_bfd));
 
       /* Record the relocated start and end address of the dynamic linker
          text and plt section for svr4_in_dynsym_resolve_code.  */