From: Tristan Gingold <gingold@adacore.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Regression on prelinked-sepdebug-shlibs
Date: Mon, 04 Jan 2010 15:22:00 -0000 [thread overview]
Message-ID: <1EA52AF6-6633-4D00-A3D7-842856D6C908@adacore.com> (raw)
In-Reply-To: <20091225200440.GA3747@host0.dyn.jankratochvil.net>
Jan,
can you try and/or comment this patch before I officially submit it ? No sepdebug.exp regressions.
Tristan.
2010-01-04 Tristan Gingold <gingold@adacore.com>
* symfile.c (build_section_addr_info_from_objfile): New function.
(symbol_file_add_separate): Don't use offsets from objfile but
built an addr info.
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 11bc2af..d6ecf0d 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -384,6 +384,38 @@ build_section_addr_info_from_section_table (const struct target_section *start,
return sap;
}
+/* Create a section_addr_info from section offsets in OBJFILE. Return NULL
+ if all offsets are 0. */
+
+static struct section_addr_info *
+build_section_addr_info_from_objfile (const struct objfile *objfile)
+{
+ struct section_addr_info *sap;
+ int i;
+ struct bfd_section *sec;
+
+ /* In most cases, the offsets are 0. In this case we return NULL to reduce
+ overhead. */
+ for (i = 0; i < objfile->num_sections; i++)
+ if (objfile->section_offsets->offsets[i])
+ break;
+ if (i >= objfile->num_sections)
+ return NULL;
+
+ sap = alloc_section_addr_info (objfile->num_sections);
+ for (i = 0, sec = objfile->obfd->sections;
+ i < objfile->num_sections;
+ i++, sec = sec->next)
+ {
+ gdb_assert (sec != NULL);
+ sap->other[i].addr = bfd_get_section_vma (objfile->obfd, sec)
+ + objfile->section_offsets->offsets[i];
+ sap->other[i].name = xstrdup (bfd_get_section_name (objfile->obfd, sec));
+ sap->other[i].sectindex = sec->index;
+ }
+ return sap;
+}
+
/* Free all memory allocated by build_section_addr_info_from_section_table. */
@@ -1042,16 +1074,26 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd,
void
symbol_file_add_separate (bfd *bfd, int symfile_flags, struct objfile *objfile)
{
+ struct section_addr_info *sap;
+ struct cleanup *my_cleanup;
+
/* Currently only one separate debug objfile is supported. */
gdb_assert (objfile && objfile->separate_debug_objfile == NULL);
+ sap = build_section_addr_info_from_objfile (objfile);
+ if (sap)
+ my_cleanup = make_cleanup_free_section_addr_info (sap);
+
objfile->separate_debug_objfile =
symbol_file_add_with_addrs_or_offsets
(bfd, symfile_flags,
- 0, /* No addr table. */
- objfile->section_offsets, objfile->num_sections,
+ sap, NULL, 0,
objfile->flags & (OBJF_REORDERED | OBJF_SHARED | OBJF_READNOW
| OBJF_USERLOADED));
+
+ if (sap)
+ do_cleanups (my_cleanup);
+
objfile->separate_debug_objfile->separate_debug_objfile_backlink
= objfile;
next prev parent reply other threads:[~2010-01-04 15:22 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-25 20:05 Jan Kratochvil
2010-01-04 9:50 ` Tristan Gingold
2010-01-04 10:24 ` Jan Kratochvil
2010-01-04 11:54 ` Tristan Gingold
2010-01-04 15:22 ` Tristan Gingold [this message]
2010-01-04 18:10 ` Jan Kratochvil
2010-01-05 11:02 ` Tristan Gingold
2010-01-05 16:15 ` Jan Kratochvil
2010-01-06 11:20 ` Tristan Gingold
2010-01-06 16:38 ` Tristan Gingold
2010-01-06 18:05 ` Jan Kratochvil
2010-01-06 19:16 ` Daniel Jacobowitz
2010-01-07 11:02 ` Tristan Gingold
2010-01-07 11:10 ` Jan Kratochvil
2010-01-07 11:18 ` Tristan Gingold
2010-01-07 13:42 ` Daniel Jacobowitz
2010-01-07 14:21 ` Tristan Gingold
2010-01-07 14:26 ` Daniel Jacobowitz
2010-01-07 14:37 ` Tristan Gingold
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=1EA52AF6-6633-4D00-A3D7-842856D6C908@adacore.com \
--to=gingold@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.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