From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH] use gdbarch_addr_bits_remove for entry point address
Date: Tue, 20 Nov 2012 09:36:00 -0000 [thread overview]
Message-ID: <1353404184-22073-1-git-send-email-yao@codesourcery.com> (raw)
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
next reply other threads:[~2012-11-20 9:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-20 9:36 Yao Qi [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353404184-22073-1-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox