Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] use gdbarch_addr_bits_remove for entry point address
@ 2012-11-20  9:36 Yao Qi
  2012-11-23 19:58 ` Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Yao Qi @ 2012-11-20  9:36 UTC (permalink / raw)
  To: gdb-patches

Hi,
This patch attempts to clear the lsb of the entry address, which might
be set by compiler for thumb code.

This patch does something similar to this one,

  RFC: Handle ISA bits for the entry point
  http://sourceware.org/ml/gdb-patches/2009-07/msg00682.html

Regression tested on arm-none-linux-gnueabi.  Is it OK?

gdb:

2012-11-20  Daniel Jacobowitz  <dan@codesourcery.com>
	    Kazu Hirata  <kazu@codesourcery.com>
	    Yao Qi  <yao@codesourcery.com>

	* objfiles.c (init_entry_point_info): Use gdbarch_addr_bits_remove.
	* solib-svr4.c (exec_entry_point): Likewise.
	* symfile.c (generic_load): Call gdbarch_addr_bits_remove on
	the entry address.
---
 gdb/objfiles.c   |    5 +++++
 gdb/solib-svr4.c |    5 ++++-
 gdb/symfile.c    |    1 +
 3 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index a1db8c6..3374c68 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -353,6 +353,11 @@ init_entry_point_info (struct objfile *objfile)
       /* Examination of non-executable.o files.  Short-circuit this stuff.  */
       objfile->ei.entry_point_p = 0;
     }
+
+  if (objfile->ei.entry_point_p)
+    objfile->ei.entry_point
+      = gdbarch_addr_bits_remove (objfile->gdbarch,
+				  objfile->ei.entry_point);
 }
 
 /* If there is a valid and known entry point, function fills *ENTRY_P with it
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 37cc654..02e45a3 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1388,6 +1388,8 @@ svr4_in_dynsym_resolve_code (CORE_ADDR pc)
 static CORE_ADDR
 exec_entry_point (struct bfd *abfd, struct target_ops *targ)
 {
+  CORE_ADDR addr;
+
   /* KevinB wrote ... 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
@@ -1396,9 +1398,10 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ)
      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.  */
-  return gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
+  addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (),
 					     bfd_get_start_address (abfd),
 					     targ);
+  return gdbarch_addr_bits_remove (target_gdbarch (), addr);
 }
 
 /* Helper function for gdb_bfd_lookup_symbol.  */
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 55af541..70f631f 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2132,6 +2132,7 @@ generic_load (char *args, int from_tty)
   gettimeofday (&end_time, NULL);
 
   entry = bfd_get_start_address (loadfile_bfd);
+  entry = gdbarch_addr_bits_remove (target_gdbarch (), entry);
   ui_out_text (uiout, "Start address ");
   ui_out_field_fmt (uiout, "address", "%s", paddress (target_gdbarch (), entry));
   ui_out_text (uiout, ", load size ");
-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-12-15 13:14 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-20  9:36 [PATCH] use gdbarch_addr_bits_remove for entry point address Yao Qi
2012-11-23 19:58 ` Pedro Alves
2012-11-24 11:14   ` Yao Qi
2012-11-26 11:57     ` Pedro Alves
2012-11-27  8:12       ` Yao Qi
2012-12-13 12:05     ` crash/regression with ia64 targets (was: "Re: [PATCH] use gdbarch_addr_bits_remove for entry point address") Joel Brobecker
2012-12-13 14:13       ` crash/regression with ia64 targets Yao Qi
2012-12-14 15:33         ` Joel Brobecker
2012-12-13 18:36       ` Pedro Alves
2012-12-14 15:14         ` Joel Brobecker
2012-12-15 13:12           ` checked in: " Joel Brobecker
2012-12-14 15:15       ` Tom Tromey
2012-12-14 15:33         ` Joel Brobecker
2012-12-15 13:14           ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox