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: [rfa:solib] Handle start-address descriptors


On Oct 27, 1:45pm, Andrew Cagney wrote:


Index: solib-svr4.c

...


+#include "bfd-target.h"
+#include "exec.h"


I'm surprised that you needed to include exec.h.  solib-svr4.c already
includes target.h and I would've thought this to be sufficient.  If
exec.h isn't needed, please take it out.  (Don't forget to fix Makefile.in.)

They are both needed.


+/* Given an executable's ABFD and target, compute the entry-point
+   address.  */
+
+static CORE_ADDR
+exec_entry_point (struct bfd *abfd, struct target_ops *targ)
+{


Could you add a comment here telling why
gdbarch_convert_from_func_ptr_addr() is needed.  Maybe something like
this?

I'll add your comment.


  /* For most targets, the address returned by bfd_get_start_address()
     is the entry point for the start function.  But, for some targets,
     bfd_get_start_address() returns the address of a function descriptor
     from which the entry point address may be extracted.  This address
     is extracted by gdbarch_convert_from_func_ptr_addr().  The method
     gdbarch_convert_from_func_ptr_addr() is the merely the identify
     function for targets which don't use function descriptors.  */

Hmm, a possible problem...  What happens when the target uses function
descriptors, but not for the exec file's start address?  I'm wondering
(ugh) if a separate gdbarch method is required for obtaining the start
address.

Fortunatly a previous patch addressed that problem. The convert function is only applied to positively identified descriptors.


+  return gdbarch_convert_from_func_ptr_addr (current_gdbarch,
+					     bfd_get_start_address (abfd),
+					     targ);
+}

Andrew



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