From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>
Cc: Yao Qi <yao@codesourcery.com>, Pedro Alves <alves.ped@gmail.com>,
gdb-patches@sourceware.org
Subject: Re: crash/regression with ia64 targets
Date: Sat, 15 Dec 2012 13:14:00 -0000 [thread overview]
Message-ID: <20121215131407.GE3654@adacore.com> (raw)
In-Reply-To: <20121214153326.GC3654@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
> > It seems like a good idea to me.
> > (I think you meant symfile.c here.)
Here is a patch. I don't think it would be controversial, so
I checked it in right away. It's easy to adjust or revert if
requested.
gdb/ChangeLog:
* objfiles.c (init_entry_point_info): Move function from here...
* symfile.c (init_entry_point_info): ... to there. Make static.
* objfiles.h (objfiles.h): Delete declaration.
--
Joel
[-- Attachment #2: 0002-Move-init_entry_point_info-to-symfile.c-and-make-it-.patch --]
[-- Type: text/x-diff, Size: 5059 bytes --]
From aa833475f7e589719e2dd59f8241096f925dc69f Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Sat, 15 Dec 2012 16:07:26 +0400
Subject: [PATCH 2/2] Move init_entry_point_info to symfile.c and make it
static.
gdb/ChangeLog:
* objfiles.c (init_entry_point_info): Move function from here...
* symfile.c (init_entry_point_info): ... to there. Make static.
* objfiles.h (objfiles.h): Delete declaration.
---
gdb/objfiles.c | 48 ------------------------------------------------
gdb/objfiles.h | 2 --
gdb/symfile.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 50 deletions(-)
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index e5681fa..feb387b 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -324,54 +324,6 @@ get_objfile_arch (struct objfile *objfile)
return objfile->gdbarch;
}
-/* Initialize entry point information for this objfile. */
-
-void
-init_entry_point_info (struct objfile *objfile)
-{
- /* Save startup file's range of PC addresses to help blockframe.c
- decide where the bottom of the stack is. */
-
- if (bfd_get_file_flags (objfile->obfd) & EXEC_P)
- {
- /* Executable file -- record its entry point so we'll recognize
- the startup file because it contains the entry point. */
- objfile->ei.entry_point = bfd_get_start_address (objfile->obfd);
- objfile->ei.entry_point_p = 1;
- }
- else if (bfd_get_file_flags (objfile->obfd) & DYNAMIC
- && bfd_get_start_address (objfile->obfd) != 0)
- {
- /* Some shared libraries may have entry points set and be
- runnable. There's no clear way to indicate this, so just check
- for values other than zero. */
- objfile->ei.entry_point = bfd_get_start_address (objfile->obfd);
- objfile->ei.entry_point_p = 1;
- }
- else
- {
- /* Examination of non-executable.o files. Short-circuit this stuff. */
- objfile->ei.entry_point_p = 0;
- }
-
- if (objfile->ei.entry_point_p)
- {
- CORE_ADDR entry_point = objfile->ei.entry_point;
-
- /* Make certain that the address points at real code, and not a
- function descriptor. */
- entry_point
- = gdbarch_convert_from_func_ptr_addr (objfile->gdbarch,
- entry_point,
- ¤t_target);
-
- /* Remove any ISA markers, so that this matches entries in the
- symbol table. */
- objfile->ei.entry_point
- = gdbarch_addr_bits_remove (objfile->gdbarch, entry_point);
- }
-}
-
/* If there is a valid and known entry point, function fills *ENTRY_P with it
and returns non-zero; otherwise it returns zero. */
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 877c9e0..c794598 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -443,8 +443,6 @@ extern struct objfile *allocate_objfile (bfd *, int);
extern struct gdbarch *get_objfile_arch (struct objfile *);
-extern void init_entry_point_info (struct objfile *);
-
extern int entry_point_address_query (CORE_ADDR *entry_p);
extern CORE_ADDR entry_point_address (void);
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 2a15293..fc908b3 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -893,6 +893,54 @@ read_symbols (struct objfile *objfile, int add_flags)
require_partial_symbols (objfile, 0);
}
+/* Initialize entry point information for this objfile. */
+
+static void
+init_entry_point_info (struct objfile *objfile)
+{
+ /* Save startup file's range of PC addresses to help blockframe.c
+ decide where the bottom of the stack is. */
+
+ if (bfd_get_file_flags (objfile->obfd) & EXEC_P)
+ {
+ /* Executable file -- record its entry point so we'll recognize
+ the startup file because it contains the entry point. */
+ objfile->ei.entry_point = bfd_get_start_address (objfile->obfd);
+ objfile->ei.entry_point_p = 1;
+ }
+ else if (bfd_get_file_flags (objfile->obfd) & DYNAMIC
+ && bfd_get_start_address (objfile->obfd) != 0)
+ {
+ /* Some shared libraries may have entry points set and be
+ runnable. There's no clear way to indicate this, so just check
+ for values other than zero. */
+ objfile->ei.entry_point = bfd_get_start_address (objfile->obfd);
+ objfile->ei.entry_point_p = 1;
+ }
+ else
+ {
+ /* Examination of non-executable.o files. Short-circuit this stuff. */
+ objfile->ei.entry_point_p = 0;
+ }
+
+ if (objfile->ei.entry_point_p)
+ {
+ CORE_ADDR entry_point = objfile->ei.entry_point;
+
+ /* Make certain that the address points at real code, and not a
+ function descriptor. */
+ entry_point
+ = gdbarch_convert_from_func_ptr_addr (objfile->gdbarch,
+ entry_point,
+ ¤t_target);
+
+ /* Remove any ISA markers, so that this matches entries in the
+ symbol table. */
+ objfile->ei.entry_point
+ = gdbarch_addr_bits_remove (objfile->gdbarch, entry_point);
+ }
+}
+
/* Process a symbol file, as either the main file or as a dynamically
loaded file.
--
1.7.10.4
prev parent reply other threads:[~2012-12-15 13:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=20121215131407.GE3654@adacore.com \
--to=brobecker@adacore.com \
--cc=alves.ped@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
--cc=yao@codesourcery.com \
/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