* [RFC] Remove addr, endaddr, offset from obj_section
@ 2008-05-16 20:42 Pedro Alves
2008-05-17 0:11 ` Ulrich Weigand
2008-06-05 19:16 ` Daniel Jacobowitz
0 siblings, 2 replies; 8+ messages in thread
From: Pedro Alves @ 2008-05-16 20:42 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 4518 bytes --]
Hi,
I've been meaning to test this on Cygwin/MinGW/Dwarf before
posting, but since the subject came up, here it goes anyway.
GDB has currently several places where section addresses/offsets
are stored: bfd, so_list, exec_ops, and objfile->section_offsets[],
and obj_section.
We should be consolidating most of these. As a first step, the place
that looks most redundant is the one in obj_section.
This patch removes the addresses in obj_section, in objfiles.h:
> /* Sections in an objfile.
>
> It is strange that we have both this notion of "sections"
> and the one used by section_offsets. Section as used
> here, (currently at least) means a BFD section, and the sections
> are set up from the BFD sections in allocate_objfile.
>
> The sections in section_offsets have their meaning determined by
> the symbol format, and they are set up by the sym_offsets function
> for that symbol file format.
>
> I'm not sure this could or should be changed, however. */
>
> struct obj_section
> {
> CORE_ADDR addr; /* lowest address in section */
> CORE_ADDR endaddr; /* 1+highest address in section */
>
> /* This field is being used for nefarious purposes by syms_from_objfile.
> It is said to be redundant with section_offsets; it's not really
being
> used that way, however, it's some sort of hack I don't understand
> and am not going to try to eliminate (yet, anyway). FIXME.
>
> It was documented as "offset between (end)addr and actual memory
> addresses", but that's not true; addr & endaddr are actual memory
> addresses. */
> CORE_ADDR offset;
>
> struct bfd_section *the_bfd_section; /* BFD section pointer */
>
> /* Objfile this section is part of. */
> struct objfile *objfile;
>
> /* True if this "overlay section" is mapped into an "overlay region". */
> int ovly_mapped;
> };
- When using a relocatable object as an exec_file, we adjust all
allocatable sections to not have overlapping vma's by adjusting the bfd_vma
and the objfile->section_offsets[] and the exec_ops.to_sections. The
obj_section->(addr,endaddr,offset) are not. Although this ends up
being harmless, it is still bad for consistency.
- There the hack in symfile.c guarded by the
DEPRECATED_IBM6000_TARGET macro, which sets the
objfile->section_offsets[] back to obj_section->(addr,endaddr,offset),
but even that looks wrong:
ADDR is the memory address (after relocation), OFFSET is the
relocation offset that was applied (comments mine),
s->addr -= s->offset; /* revert offset, so we get the VMA on file. */
s->addr += s_addr; /* (addr has been converted to offsets,
so s_addr is now the new offset.) */
s->endaddr -= s->offset;
s->endaddr += s_addr;
s->offset += s_addr; /* This looks wrong. It should be '=', not '+=' ?? */
See patch for context.
- The DEPRECATED_IBM6000_TARGET guard is there, to the best of my
knowledge, because xcoffread.c ignores the offsets that are passed to
xcoff_symfile_offsets (sym->fns->sym_offsets), and sets the
objfile->sections_offsets[] all to 0. By merging the obj_section offsets
with objfile->section_offsets[], we just get rid of that block, and things
should work. I have no means to test it, though, so this worries be me.
xcoff_symfile_offsets:
for (i = 0; i < objfile->num_sections; ++i)
{
/* syms_from_objfile kindly subtracts from addr the
bfd_section_vma of the .text section. This strikes me as
wrong--whether the offset to be applied to symbol reading is
relative to the start address of the section depends on the
symbol format. In any event, this whole "addr" concept is
pretty broken (it doesn't handle any section but .text
sensibly), so just ignore the addr parameter and use 0.
rs6000-nat.c will set the correct section offsets via
objfile_relocate. */
(objfile->section_offsets)->offsets[i] = 0;
}
I seems the comment is a bit offbase. The reader still applies
ANOFFSET to the symbols, so psymtab->symtab expansion time sees
the correct section offsets. It feels like the xcoff reader
should cope with the section offsets != 0 internally, and not
do this ignoring, but since I don't have access to any AIX system,
I didn't investigate that further. But I do think things should
still work as they used to.
I just gave it another testsuite run on on x86-64-unknown-linux-gnu.
No changes recorded.
--
Pedro Alves
[-- Attachment #2: obj_section_remove_addrs.diff --]
[-- Type: text/x-diff, Size: 12590 bytes --]
2008-05-16 Pedro Alves <pedro@codesourcery.com>
* objfiles.h (struct obj_section): Remove addr and endaddr fields.
(obj_section_offset, obj_section_addr, obj_section_endaddr): New
macros.
* objfiles.c (add_to_objfile_sections): Don't addr, endaddr and
offset. Use size_t instead of unsigned long.
(build_objfile_section_table): Use size_t instead of unsigned
long.
(objfile_relocate): Don't relocate s->addr and s->endaddr, they're
gone.
(find_pc_sect_section): Use obj_section_addr and
obj_section_endaddr.
* symfile.c (symfile.c): Remove code that maps sections
offsets in "addr" to the object's sections.
* blockframe.c (find_pc_partial_function): Use obj_section_endaddr.
* gcore.c (gcore_create_callback): Use obj_section_addr and
obj_section_endaddr.
* maint.c (print_objfile_section_info): Likewise.
* printcmd.c (sym_info): Use obj_section_addr and
obj_section_endaddr.
* symtab.c (fixup_section): Likewise.
---
gdb/blockframe.c | 4 ++--
gdb/gcore.c | 6 +++---
gdb/maint.c | 6 ++++--
gdb/objfiles.c | 33 ++++++++-------------------------
gdb/objfiles.h | 42 +++++++++++++++++-------------------------
gdb/printcmd.c | 5 +++--
gdb/symfile.c | 50 --------------------------------------------------
gdb/symtab.c | 3 ++-
8 files changed, 39 insertions(+), 110 deletions(-)
Index: src/gdb/objfiles.h
===================================================================
--- src.orig/gdb/objfiles.h 2008-05-16 17:03:10.000000000 +0100
+++ src/gdb/objfiles.h 2008-05-16 17:03:12.000000000 +0100
@@ -110,34 +110,11 @@ struct entry_info
};
-/* Sections in an objfile.
-
- It is strange that we have both this notion of "sections"
- and the one used by section_offsets. Section as used
- here, (currently at least) means a BFD section, and the sections
- are set up from the BFD sections in allocate_objfile.
-
- The sections in section_offsets have their meaning determined by
- the symbol format, and they are set up by the sym_offsets function
- for that symbol file format.
-
- I'm not sure this could or should be changed, however. */
+/* Sections in an objfile. The section offsets are stored in the
+ OBJFILE. */
struct obj_section
{
- CORE_ADDR addr; /* lowest address in section */
- CORE_ADDR endaddr; /* 1+highest address in section */
-
- /* This field is being used for nefarious purposes by syms_from_objfile.
- It is said to be redundant with section_offsets; it's not really being
- used that way, however, it's some sort of hack I don't understand
- and am not going to try to eliminate (yet, anyway). FIXME.
-
- It was documented as "offset between (end)addr and actual memory
- addresses", but that's not true; addr & endaddr are actual memory
- addresses. */
- CORE_ADDR offset;
-
struct bfd_section *the_bfd_section; /* BFD section pointer */
/* Objfile this section is part of. */
@@ -147,6 +124,21 @@ struct obj_section
int ovly_mapped;
};
+/* Relocation offset applied to S. */
+#define obj_section_offset(s) \
+ (((s)->objfile->section_offsets)->offsets[(s)->the_bfd_section->index])
+
+/* The memory address of section S (vma + offset). */
+#define obj_section_addr(s) \
+ (bfd_get_section_vma ((s)->objfile->abfd, s->the_bfd_section) \
+ + obj_section_offset (s))
+
+/* The one-passed-the-end memory address of section S
+ (vma + size + offset). */
+#define obj_section_endaddr(s) \
+ (bfd_get_section_vma ((s)->objfile->abfd, s->the_bfd_section) \
+ + bfd_get_section_size ((s)->the_bfd_section) \
+ + obj_section_offset (s))
/* The "objstats" structure provides a place for gdb to record some
interesting information about its internal state at runtime, on a
Index: src/gdb/objfiles.c
===================================================================
--- src.orig/gdb/objfiles.c 2008-05-16 17:03:10.000000000 +0100
+++ src/gdb/objfiles.c 2008-05-16 17:03:12.000000000 +0100
@@ -91,14 +91,12 @@ add_to_objfile_sections (struct bfd *abf
if (0 == bfd_section_size (abfd, asect))
return;
- section.offset = 0;
section.objfile = objfile;
section.the_bfd_section = asect;
section.ovly_mapped = 0;
- section.addr = bfd_section_vma (abfd, asect);
- section.endaddr = section.addr + bfd_section_size (abfd, asect);
obstack_grow (&objfile->objfile_obstack, (char *) §ion, sizeof (section));
- objfile->sections_end = (struct obj_section *) (((unsigned long) objfile->sections_end) + 1);
+ objfile->sections_end
+ = (struct obj_section *) (((size_t) objfile->sections_end) + 1);
}
/* Builds a section table for OBJFILE.
@@ -127,10 +125,10 @@ build_objfile_section_table (struct objf
waste some memory. */
objfile->sections_end = 0;
- bfd_map_over_sections (objfile->obfd, add_to_objfile_sections, (char *) objfile);
- objfile->sections = (struct obj_section *)
- obstack_finish (&objfile->objfile_obstack);
- objfile->sections_end = objfile->sections + (unsigned long) objfile->sections_end;
+ bfd_map_over_sections (objfile->obfd,
+ add_to_objfile_sections, (void *) objfile);
+ objfile->sections = obstack_finish (&objfile->objfile_obstack);
+ objfile->sections_end = objfile->sections + (size_t) objfile->sections_end;
return (0);
}
@@ -662,21 +660,6 @@ objfile_relocate (struct objfile *objfil
objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
}
- {
- struct obj_section *s;
- bfd *abfd;
-
- abfd = objfile->obfd;
-
- ALL_OBJFILE_OSECTIONS (objfile, s)
- {
- int idx = s->the_bfd_section->index;
-
- s->addr += ANOFFSET (delta, idx);
- s->endaddr += ANOFFSET (delta, idx);
- }
- }
-
/* Relocate breakpoints as necessary, after things are relocated. */
breakpoint_re_set ();
}
@@ -773,8 +756,8 @@ find_pc_sect_section (CORE_ADDR pc, stru
struct objfile *objfile;
ALL_OBJSECTIONS (objfile, s)
- if ((section == 0 || section == s->the_bfd_section) &&
- s->addr <= pc && pc < s->endaddr)
+ if ((section == 0 || section == s->the_bfd_section)
+ && obj_section_addr (s) <= pc && pc < obj_section_endaddr (s))
return (s);
return (NULL);
Index: src/gdb/symfile.c
===================================================================
--- src.orig/gdb/symfile.c 2008-05-16 17:03:10.000000000 +0100
+++ src/gdb/symfile.c 2008-05-16 17:03:12.000000000 +0100
@@ -889,56 +889,6 @@ syms_from_objfile (struct objfile *objfi
init_objfile_sect_indices (objfile);
}
-#ifndef DEPRECATED_IBM6000_TARGET
- /* This is a SVR4/SunOS specific hack, I think. In any event, it
- screws RS/6000. sym_offsets should be doing this sort of thing,
- because it knows the mapping between bfd sections and
- section_offsets. */
- /* This is a hack. As far as I can tell, section offsets are not
- target dependent. They are all set to addr with a couple of
- exceptions. The exceptions are sysvr4 shared libraries, whose
- offsets are kept in solib structures anyway and rs6000 xcoff
- which handles shared libraries in a completely unique way.
-
- Section offsets are built similarly, except that they are built
- by adding addr in all cases because there is no clear mapping
- from section_offsets into actual sections. Note that solib.c
- has a different algorithm for finding section offsets.
-
- These should probably all be collapsed into some target
- independent form of shared library support. FIXME. */
-
- if (addrs)
- {
- struct obj_section *s;
-
- /* Map section offsets in "addr" back to the object's
- sections by comparing the section names with bfd's
- section names. Then adjust the section address by
- the offset. */ /* for gdb/13815 */
-
- ALL_OBJFILE_OSECTIONS (objfile, s)
- {
- CORE_ADDR s_addr = 0;
- int i;
-
- for (i = 0;
- !s_addr && i < addrs->num_sections && addrs->other[i].name;
- i++)
- if (strcmp (bfd_section_name (s->objfile->obfd,
- s->the_bfd_section),
- addrs->other[i].name) == 0)
- s_addr = addrs->other[i].addr; /* end added for gdb/13815 */
-
- s->addr -= s->offset;
- s->addr += s_addr;
- s->endaddr -= s->offset;
- s->endaddr += s_addr;
- s->offset += s_addr;
- }
- }
-#endif /* not DEPRECATED_IBM6000_TARGET */
-
(*objfile->sf->sym_read) (objfile, mainline);
/* Don't allow char * to have a typename (else would get caddr_t).
Index: src/gdb/blockframe.c
===================================================================
--- src.orig/gdb/blockframe.c 2008-05-16 17:03:10.000000000 +0100
+++ src/gdb/blockframe.c 2008-05-16 17:03:12.000000000 +0100
@@ -299,12 +299,12 @@ find_pc_partial_function (CORE_ADDR pc,
}
if (DEPRECATED_SYMBOL_NAME (msymbol + i) != NULL
- && SYMBOL_VALUE_ADDRESS (msymbol + i) < osect->endaddr)
+ && SYMBOL_VALUE_ADDRESS (msymbol + i) < obj_section_endaddr (osect))
cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + i);
else
/* We got the start address from the last msymbol in the objfile.
So the end address is the end of the section. */
- cache_pc_function_high = osect->endaddr;
+ cache_pc_function_high = obj_section_endaddr (osect);
}
return_cached_value:
Index: src/gdb/gcore.c
===================================================================
--- src.orig/gdb/gcore.c 2008-05-16 17:03:10.000000000 +0100
+++ src/gdb/gcore.c 2008-05-16 17:03:12.000000000 +0100
@@ -344,8 +344,8 @@ gcore_create_callback (CORE_ADDR vaddr,
asection *asec = objsec->the_bfd_section;
bfd_vma align = (bfd_vma) 1 << bfd_get_section_alignment (abfd,
asec);
- bfd_vma start = objsec->addr & -align;
- bfd_vma end = (objsec->endaddr + align - 1) & -align;
+ bfd_vma start = obj_section_addr (objsec) & -align;
+ bfd_vma end = (obj_section_endaddr (objsec) + align - 1) & -align;
/* Match if either the entire memory region lies inside the
section (i.e. a mapping covering some pages of a large
segment) or the entire section lies inside the memory region
@@ -415,7 +415,7 @@ objfile_find_memory_regions (int (*func)
int size = bfd_section_size (ibfd, isec);
int ret;
- ret = (*func) (objsec->addr, bfd_section_size (ibfd, isec),
+ ret = (*func) (obj_section_addr (objsec), bfd_section_size (ibfd, isec),
1, /* All sections will be readable. */
(flags & SEC_READONLY) == 0, /* Writable. */
(flags & SEC_CODE) != 0, /* Executable. */
Index: src/gdb/maint.c
===================================================================
--- src.orig/gdb/maint.c 2008-05-16 17:03:10.000000000 +0100
+++ src/gdb/maint.c 2008-05-16 17:03:12.000000000 +0100
@@ -349,8 +349,10 @@ print_objfile_section_info (bfd *abfd,
|| match_substring (string, name)
|| match_bfd_flags (string, flags))
{
- maint_print_section_info (name, flags, asect->addr, asect->endaddr,
- asect->the_bfd_section->filepos);
+ maint_print_section_info (name, flags,
+ obj_section_addr (asect),
+ obj_section_endaddr (asect),
+ asect->the_bfd_section->filepos);
}
}
Index: src/gdb/printcmd.c
===================================================================
--- src.orig/gdb/printcmd.c 2008-05-16 17:03:10.000000000 +0100
+++ src/gdb/printcmd.c 2008-05-16 17:03:12.000000000 +0100
@@ -1003,8 +1003,9 @@ sym_info (char *arg, int from_tty)
sect = osect->the_bfd_section;
sect_addr = overlay_mapped_address (addr, sect);
- if (osect->addr <= sect_addr && sect_addr < osect->endaddr &&
- (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, sect)))
+ if (obj_section_addr (osect) <= sect_addr
+ && sect_addr < obj_section_endaddr (osect)
+ && (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, sect)))
{
matches = 1;
offset = sect_addr - SYMBOL_VALUE_ADDRESS (msymbol);
Index: src/gdb/symtab.c
===================================================================
--- src.orig/gdb/symtab.c 2008-05-16 17:03:10.000000000 +0100
+++ src/gdb/symtab.c 2008-05-16 17:03:12.000000000 +0100
@@ -1051,7 +1051,8 @@ fixup_section (struct general_symbol_inf
int idx = s->the_bfd_section->index;
CORE_ADDR offset = ANOFFSET (objfile->section_offsets, idx);
- if (s->addr - offset <= addr && addr < s->endaddr - offset)
+ if (obj_section_addr (s) - offset <= addr
+ && addr < obj_section_endaddr (s) - offset)
{
ginfo->bfd_section = s->the_bfd_section;
ginfo->section = idx;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Remove addr, endaddr, offset from obj_section
2008-05-16 20:42 [RFC] Remove addr, endaddr, offset from obj_section Pedro Alves
@ 2008-05-17 0:11 ` Ulrich Weigand
2008-05-17 2:17 ` Pedro Alves
2008-06-05 19:16 ` Daniel Jacobowitz
1 sibling, 1 reply; 8+ messages in thread
From: Ulrich Weigand @ 2008-05-17 0:11 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
Pedro Alves wrote:
> I've been meaning to test this on Cygwin/MinGW/Dwarf before
> posting, but since the subject came up, here it goes anyway.
Thanks!
> I seems the comment is a bit offbase. The reader still applies
> ANOFFSET to the symbols, so psymtab->symtab expansion time sees
> the correct section offsets. It feels like the xcoff reader
> should cope with the section offsets != 0 internally, and not
> do this ignoring, but since I don't have access to any AIX system,
> I didn't investigate that further. But I do think things should
> still work as they used to.
I haven't looked into the patch in detail, but just one comment here:
The guard on this block of code is
#ifndef DEPRECATED_IBM6000_TARGET
so it is executed on every target *but* AIX. Removing it doesn't
change the behaviour on AIX, so there should be no need to specially
test on AIX.
(In any case, I'll be happy to test patches on AIX if necessary.)
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Remove addr, endaddr, offset from obj_section
2008-05-17 0:11 ` Ulrich Weigand
@ 2008-05-17 2:17 ` Pedro Alves
0 siblings, 0 replies; 8+ messages in thread
From: Pedro Alves @ 2008-05-17 2:17 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
A Friday 16 May 2008 19:32:28, Ulrich Weigand wrote:
> Pedro Alves wrote:
>
> > I seems the comment is a bit offbase. The reader still applies
> > ANOFFSET to the symbols, so psymtab->symtab expansion time sees
> > the correct section offsets. It feels like the xcoff reader
> > should cope with the section offsets != 0 internally, and not
> > do this ignoring, but since I don't have access to any AIX system,
> > I didn't investigate that further. But I do think things should
> > still work as they used to.
>
> I haven't looked into the patch in detail, but just one comment here:
> The guard on this block of code is
> #ifndef DEPRECATED_IBM6000_TARGET
> so it is executed on every target *but* AIX. Removing it doesn't
> change the behaviour on AIX, so there should be no need to specially
> test on AIX.
>
Yes, I believe that's right. To make it clear, I was refering
to investigating why xcoff_symfile_offsets ignores the passed-in
offsets (which can come from a add-symbol-file command from the
user), and make it not do that. I don't know much xcoff, and why
that was needed, but I had the impression we could get around
needing to do that.
> (In any case, I'll be happy to test patches on AIX if necessary.)
(Thanks! Nice to know that.)
--
Pedro Alves
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Remove addr, endaddr, offset from obj_section
2008-05-16 20:42 [RFC] Remove addr, endaddr, offset from obj_section Pedro Alves
2008-05-17 0:11 ` Ulrich Weigand
@ 2008-06-05 19:16 ` Daniel Jacobowitz
2008-08-20 11:23 ` Pedro Alves
1 sibling, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2008-06-05 19:16 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Fri, May 16, 2008 at 05:21:15PM +0100, Pedro Alves wrote:
> Hi,
>
> I've been meaning to test this on Cygwin/MinGW/Dwarf before
> posting, but since the subject came up, here it goes anyway.
I looked through the patch, and I can't see anything wrong with it.
It's OK to commit, though you might want to do that Cygwin test
first...
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Remove addr, endaddr, offset from obj_section
2008-06-05 19:16 ` Daniel Jacobowitz
@ 2008-08-20 11:23 ` Pedro Alves
2008-08-21 13:28 ` Pedro Alves
0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2008-08-20 11:23 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 5307 bytes --]
On Thursday 05 June 2008 20:16:02, Daniel Jacobowitz wrote:
> On Fri, May 16, 2008 at 05:21:15PM +0100, Pedro Alves wrote:
> > I've been meaning to test this on Cygwin/MinGW/Dwarf before
> > posting, but since the subject came up, here it goes anyway.
>
> I looked through the patch, and I can't see anything wrong with it.
> It's OK to commit, though you might want to do that Cygwin test
> first...
I've finally passed this through the testsuite on mingw32 + dwarf, and
found no regressions.
I checked it in after also retesting on x86_64-unknown-linux-gnu.
--
Pedro Alves
On Friday 16 May 2008 17:21:15, Pedro Alves wrote:
> Hi,
>
> I've been meaning to test this on Cygwin/MinGW/Dwarf before
> posting, but since the subject came up, here it goes anyway.
>
> GDB has currently several places where section addresses/offsets
> are stored: bfd, so_list, exec_ops, and objfile->section_offsets[],
> and obj_section.
>
> We should be consolidating most of these. As a first step, the place
> that looks most redundant is the one in obj_section.
>
> This patch removes the addresses in obj_section, in objfiles.h:
> > /* Sections in an objfile.
> >
> > It is strange that we have both this notion of "sections"
> > and the one used by section_offsets. Section as used
> > here, (currently at least) means a BFD section, and the sections
> > are set up from the BFD sections in allocate_objfile.
> >
> > The sections in section_offsets have their meaning determined by
> > the symbol format, and they are set up by the sym_offsets function
> > for that symbol file format.
> >
> > I'm not sure this could or should be changed, however. */
> >
> > struct obj_section
> > {
> > CORE_ADDR addr; /* lowest address in section */
> > CORE_ADDR endaddr; /* 1+highest address in section */
> >
> > /* This field is being used for nefarious purposes by
> > syms_from_objfile. It is said to be redundant with section_offsets; it's
> > not really
>
> being
>
> > used that way, however, it's some sort of hack I don't understand
> > and am not going to try to eliminate (yet, anyway). FIXME.
> >
> > It was documented as "offset between (end)addr and actual memory
> > addresses", but that's not true; addr & endaddr are actual memory
> > addresses. */
> > CORE_ADDR offset;
> >
> > struct bfd_section *the_bfd_section; /* BFD section pointer */
> >
> > /* Objfile this section is part of. */
> > struct objfile *objfile;
> >
> > /* True if this "overlay section" is mapped into an "overlay region".
> > */ int ovly_mapped;
> > };
>
> - When using a relocatable object as an exec_file, we adjust all
> allocatable sections to not have overlapping vma's by adjusting the
> bfd_vma and the objfile->section_offsets[] and the exec_ops.to_sections.
> The obj_section->(addr,endaddr,offset) are not. Although this ends up
> being harmless, it is still bad for consistency.
>
> - There the hack in symfile.c guarded by the
> DEPRECATED_IBM6000_TARGET macro, which sets the
> objfile->section_offsets[] back to obj_section->(addr,endaddr,offset),
> but even that looks wrong:
>
> ADDR is the memory address (after relocation), OFFSET is the
> relocation offset that was applied (comments mine),
>
> s->addr -= s->offset; /* revert offset, so we get the VMA on file. */
> s->addr += s_addr; /* (addr has been converted to offsets,
> so s_addr is now the new offset.) */
> s->endaddr -= s->offset;
> s->endaddr += s_addr;
>
> s->offset += s_addr; /* This looks wrong. It should be '=', not '+=' ??
> */
>
> See patch for context.
>
> - The DEPRECATED_IBM6000_TARGET guard is there, to the best of my
> knowledge, because xcoffread.c ignores the offsets that are passed to
> xcoff_symfile_offsets (sym->fns->sym_offsets), and sets the
> objfile->sections_offsets[] all to 0. By merging the obj_section offsets
> with objfile->section_offsets[], we just get rid of that block, and
> things should work. I have no means to test it, though, so this worries be
> me.
>
> xcoff_symfile_offsets:
>
> for (i = 0; i < objfile->num_sections; ++i)
> {
> /* syms_from_objfile kindly subtracts from addr the
> bfd_section_vma of the .text section. This strikes me as
> wrong--whether the offset to be applied to symbol reading is
> relative to the start address of the section depends on the
> symbol format. In any event, this whole "addr" concept is
> pretty broken (it doesn't handle any section but .text
> sensibly), so just ignore the addr parameter and use 0.
> rs6000-nat.c will set the correct section offsets via
> objfile_relocate. */
> (objfile->section_offsets)->offsets[i] = 0;
> }
>
> I seems the comment is a bit offbase. The reader still applies
> ANOFFSET to the symbols, so psymtab->symtab expansion time sees
> the correct section offsets. It feels like the xcoff reader
> should cope with the section offsets != 0 internally, and not
> do this ignoring, but since I don't have access to any AIX system,
> I didn't investigate that further. But I do think things should
> still work as they used to.
>
> I just gave it another testsuite run on on x86-64-unknown-linux-gnu.
> No changes recorded.
[-- Attachment #2: obj_section_remove_addrs.diff --]
[-- Type: text/x-diff, Size: 12843 bytes --]
2008-08-20 Pedro Alves <pedro@codesourcery.com>
* objfiles.h (struct obj_section): Remove addr and endaddr fields.
(obj_section_offset, obj_section_addr, obj_section_endaddr): New
macros.
* objfiles.c (add_to_objfile_sections): Don't set addr, endaddr
and offset. Use size_t instead of unsigned long.
(build_objfile_section_table): Use size_t instead of unsigned
long.
(objfile_relocate): Don't relocate s->addr and s->endaddr, they're
gone.
(find_pc_sect_section): Use obj_section_addr and
obj_section_endaddr.
* symfile.c (symfile.c): Remove code that maps sections
offsets in "addr" to the object's sections.
* blockframe.c (find_pc_partial_function): Use obj_section_endaddr.
* gcore.c (gcore_create_callback): Use obj_section_addr and
obj_section_endaddr.
* maint.c (print_objfile_section_info): Likewise.
* printcmd.c (sym_info): Use obj_section_addr and
obj_section_endaddr.
* symtab.c (fixup_section): Likewise.
---
gdb/blockframe.c | 4 ++--
gdb/gcore.c | 6 +++---
gdb/maint.c | 6 ++++--
gdb/objfiles.c | 35 +++++++++--------------------------
gdb/objfiles.h | 42 +++++++++++++++++-------------------------
gdb/printcmd.c | 5 +++--
gdb/symfile.c | 50 --------------------------------------------------
gdb/symtab.c | 3 ++-
8 files changed, 40 insertions(+), 111 deletions(-)
Index: src/gdb/objfiles.h
===================================================================
--- src.orig/gdb/objfiles.h 2008-08-20 11:52:06.000000000 +0100
+++ src/gdb/objfiles.h 2008-08-20 11:52:37.000000000 +0100
@@ -110,34 +110,11 @@ struct entry_info
};
-/* Sections in an objfile.
-
- It is strange that we have both this notion of "sections"
- and the one used by section_offsets. Section as used
- here, (currently at least) means a BFD section, and the sections
- are set up from the BFD sections in allocate_objfile.
-
- The sections in section_offsets have their meaning determined by
- the symbol format, and they are set up by the sym_offsets function
- for that symbol file format.
-
- I'm not sure this could or should be changed, however. */
+/* Sections in an objfile. The section offsets are stored in the
+ OBJFILE. */
struct obj_section
{
- CORE_ADDR addr; /* lowest address in section */
- CORE_ADDR endaddr; /* 1+highest address in section */
-
- /* This field is being used for nefarious purposes by syms_from_objfile.
- It is said to be redundant with section_offsets; it's not really being
- used that way, however, it's some sort of hack I don't understand
- and am not going to try to eliminate (yet, anyway). FIXME.
-
- It was documented as "offset between (end)addr and actual memory
- addresses", but that's not true; addr & endaddr are actual memory
- addresses. */
- CORE_ADDR offset;
-
struct bfd_section *the_bfd_section; /* BFD section pointer */
/* Objfile this section is part of. */
@@ -147,6 +124,21 @@ struct obj_section
int ovly_mapped;
};
+/* Relocation offset applied to S. */
+#define obj_section_offset(s) \
+ (((s)->objfile->section_offsets)->offsets[(s)->the_bfd_section->index])
+
+/* The memory address of section S (vma + offset). */
+#define obj_section_addr(s) \
+ (bfd_get_section_vma ((s)->objfile->abfd, s->the_bfd_section) \
+ + obj_section_offset (s))
+
+/* The one-passed-the-end memory address of section S
+ (vma + size + offset). */
+#define obj_section_endaddr(s) \
+ (bfd_get_section_vma ((s)->objfile->abfd, s->the_bfd_section) \
+ + bfd_get_section_size ((s)->the_bfd_section) \
+ + obj_section_offset (s))
/* The "objstats" structure provides a place for gdb to record some
interesting information about its internal state at runtime, on a
Index: src/gdb/objfiles.c
===================================================================
--- src.orig/gdb/objfiles.c 2008-08-20 11:52:06.000000000 +0100
+++ src/gdb/objfiles.c 2008-08-20 11:52:37.000000000 +0100
@@ -88,14 +88,12 @@ add_to_objfile_sections (struct bfd *abf
if (0 == bfd_section_size (abfd, asect))
return;
- section.offset = 0;
section.objfile = objfile;
section.the_bfd_section = asect;
section.ovly_mapped = 0;
- section.addr = bfd_section_vma (abfd, asect);
- section.endaddr = section.addr + bfd_section_size (abfd, asect);
obstack_grow (&objfile->objfile_obstack, (char *) §ion, sizeof (section));
- objfile->sections_end = (struct obj_section *) (((unsigned long) objfile->sections_end) + 1);
+ objfile->sections_end
+ = (struct obj_section *) (((size_t) objfile->sections_end) + 1);
}
/* Builds a section table for OBJFILE.
@@ -124,10 +122,10 @@ build_objfile_section_table (struct objf
waste some memory. */
objfile->sections_end = 0;
- bfd_map_over_sections (objfile->obfd, add_to_objfile_sections, (char *) objfile);
- objfile->sections = (struct obj_section *)
- obstack_finish (&objfile->objfile_obstack);
- objfile->sections_end = objfile->sections + (unsigned long) objfile->sections_end;
+ bfd_map_over_sections (objfile->obfd,
+ add_to_objfile_sections, (void *) objfile);
+ objfile->sections = obstack_finish (&objfile->objfile_obstack);
+ objfile->sections_end = objfile->sections + (size_t) objfile->sections_end;
return (0);
}
@@ -664,28 +662,13 @@ objfile_relocate (struct objfile *objfil
objfile->ei.entry_point += ANOFFSET (delta, SECT_OFF_TEXT (objfile));
}
- {
- struct obj_section *s;
- bfd *abfd;
-
- abfd = objfile->obfd;
-
- ALL_OBJFILE_OSECTIONS (objfile, s)
- {
- int idx = s->the_bfd_section->index;
-
- s->addr += ANOFFSET (delta, idx);
- s->endaddr += ANOFFSET (delta, idx);
- }
- }
-
/* Update the table in exec_ops, used to read memory. */
ALL_OBJFILE_OSECTIONS (objfile, s)
{
int idx = s->the_bfd_section->index;
exec_set_section_address (bfd_get_filename (objfile->obfd), idx,
- s->addr);
+ obj_section_addr (s));
}
/* Relocate breakpoints as necessary, after things are relocated. */
@@ -784,8 +767,8 @@ find_pc_sect_section (CORE_ADDR pc, stru
struct objfile *objfile;
ALL_OBJSECTIONS (objfile, s)
- if ((section == 0 || section == s->the_bfd_section) &&
- s->addr <= pc && pc < s->endaddr)
+ if ((section == 0 || section == s->the_bfd_section)
+ && obj_section_addr (s) <= pc && pc < obj_section_endaddr (s))
return (s);
return (NULL);
Index: src/gdb/symfile.c
===================================================================
--- src.orig/gdb/symfile.c 2008-08-20 11:52:06.000000000 +0100
+++ src/gdb/symfile.c 2008-08-20 11:52:37.000000000 +0100
@@ -895,56 +895,6 @@ syms_from_objfile (struct objfile *objfi
init_objfile_sect_indices (objfile);
}
-#ifndef DEPRECATED_IBM6000_TARGET
- /* This is a SVR4/SunOS specific hack, I think. In any event, it
- screws RS/6000. sym_offsets should be doing this sort of thing,
- because it knows the mapping between bfd sections and
- section_offsets. */
- /* This is a hack. As far as I can tell, section offsets are not
- target dependent. They are all set to addr with a couple of
- exceptions. The exceptions are sysvr4 shared libraries, whose
- offsets are kept in solib structures anyway and rs6000 xcoff
- which handles shared libraries in a completely unique way.
-
- Section offsets are built similarly, except that they are built
- by adding addr in all cases because there is no clear mapping
- from section_offsets into actual sections. Note that solib.c
- has a different algorithm for finding section offsets.
-
- These should probably all be collapsed into some target
- independent form of shared library support. FIXME. */
-
- if (addrs)
- {
- struct obj_section *s;
-
- /* Map section offsets in "addr" back to the object's
- sections by comparing the section names with bfd's
- section names. Then adjust the section address by
- the offset. */ /* for gdb/13815 */
-
- ALL_OBJFILE_OSECTIONS (objfile, s)
- {
- CORE_ADDR s_addr = 0;
- int i;
-
- for (i = 0;
- !s_addr && i < addrs->num_sections && addrs->other[i].name;
- i++)
- if (strcmp (bfd_section_name (s->objfile->obfd,
- s->the_bfd_section),
- addrs->other[i].name) == 0)
- s_addr = addrs->other[i].addr; /* end added for gdb/13815 */
-
- s->addr -= s->offset;
- s->addr += s_addr;
- s->endaddr -= s->offset;
- s->endaddr += s_addr;
- s->offset += s_addr;
- }
- }
-#endif /* not DEPRECATED_IBM6000_TARGET */
-
(*objfile->sf->sym_read) (objfile, mainline);
/* Don't allow char * to have a typename (else would get caddr_t).
Index: src/gdb/blockframe.c
===================================================================
--- src.orig/gdb/blockframe.c 2008-08-20 11:52:06.000000000 +0100
+++ src/gdb/blockframe.c 2008-08-20 11:52:37.000000000 +0100
@@ -299,12 +299,12 @@ find_pc_partial_function (CORE_ADDR pc,
}
if (DEPRECATED_SYMBOL_NAME (msymbol + i) != NULL
- && SYMBOL_VALUE_ADDRESS (msymbol + i) < osect->endaddr)
+ && SYMBOL_VALUE_ADDRESS (msymbol + i) < obj_section_endaddr (osect))
cache_pc_function_high = SYMBOL_VALUE_ADDRESS (msymbol + i);
else
/* We got the start address from the last msymbol in the objfile.
So the end address is the end of the section. */
- cache_pc_function_high = osect->endaddr;
+ cache_pc_function_high = obj_section_endaddr (osect);
}
return_cached_value:
Index: src/gdb/gcore.c
===================================================================
--- src.orig/gdb/gcore.c 2008-08-20 11:52:06.000000000 +0100
+++ src/gdb/gcore.c 2008-08-20 11:52:37.000000000 +0100
@@ -344,8 +344,8 @@ gcore_create_callback (CORE_ADDR vaddr,
asection *asec = objsec->the_bfd_section;
bfd_vma align = (bfd_vma) 1 << bfd_get_section_alignment (abfd,
asec);
- bfd_vma start = objsec->addr & -align;
- bfd_vma end = (objsec->endaddr + align - 1) & -align;
+ bfd_vma start = obj_section_addr (objsec) & -align;
+ bfd_vma end = (obj_section_endaddr (objsec) + align - 1) & -align;
/* Match if either the entire memory region lies inside the
section (i.e. a mapping covering some pages of a large
segment) or the entire section lies inside the memory region
@@ -415,7 +415,7 @@ objfile_find_memory_regions (int (*func)
int size = bfd_section_size (ibfd, isec);
int ret;
- ret = (*func) (objsec->addr, bfd_section_size (ibfd, isec),
+ ret = (*func) (obj_section_addr (objsec), bfd_section_size (ibfd, isec),
1, /* All sections will be readable. */
(flags & SEC_READONLY) == 0, /* Writable. */
(flags & SEC_CODE) != 0, /* Executable. */
Index: src/gdb/maint.c
===================================================================
--- src.orig/gdb/maint.c 2008-08-20 11:52:06.000000000 +0100
+++ src/gdb/maint.c 2008-08-20 11:52:37.000000000 +0100
@@ -348,8 +348,10 @@ print_objfile_section_info (bfd *abfd,
|| match_substring (string, name)
|| match_bfd_flags (string, flags))
{
- maint_print_section_info (name, flags, asect->addr, asect->endaddr,
- asect->the_bfd_section->filepos);
+ maint_print_section_info (name, flags,
+ obj_section_addr (asect),
+ obj_section_endaddr (asect),
+ asect->the_bfd_section->filepos);
}
}
Index: src/gdb/printcmd.c
===================================================================
--- src.orig/gdb/printcmd.c 2008-08-20 11:52:06.000000000 +0100
+++ src/gdb/printcmd.c 2008-08-20 11:52:37.000000000 +0100
@@ -995,8 +995,9 @@ sym_info (char *arg, int from_tty)
sect = osect->the_bfd_section;
sect_addr = overlay_mapped_address (addr, sect);
- if (osect->addr <= sect_addr && sect_addr < osect->endaddr &&
- (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, sect)))
+ if (obj_section_addr (osect) <= sect_addr
+ && sect_addr < obj_section_endaddr (osect)
+ && (msymbol = lookup_minimal_symbol_by_pc_section (sect_addr, sect)))
{
matches = 1;
offset = sect_addr - SYMBOL_VALUE_ADDRESS (msymbol);
Index: src/gdb/symtab.c
===================================================================
--- src.orig/gdb/symtab.c 2008-08-20 11:52:06.000000000 +0100
+++ src/gdb/symtab.c 2008-08-20 11:52:37.000000000 +0100
@@ -1081,7 +1081,8 @@ fixup_section (struct general_symbol_inf
int idx = s->the_bfd_section->index;
CORE_ADDR offset = ANOFFSET (objfile->section_offsets, idx);
- if (s->addr - offset <= addr && addr < s->endaddr - offset)
+ if (obj_section_addr (s) - offset <= addr
+ && addr < obj_section_endaddr (s) - offset)
{
ginfo->bfd_section = s->the_bfd_section;
ginfo->section = idx;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Remove addr, endaddr, offset from obj_section
2008-08-20 11:23 ` Pedro Alves
@ 2008-08-21 13:28 ` Pedro Alves
2008-09-02 9:33 ` Andreas Schwab
0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2008-08-21 13:28 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 895 bytes --]
On Wednesday 20 August 2008 12:23:16, Pedro Alves wrote:
> On Thursday 05 June 2008 20:16:02, Daniel Jacobowitz wrote:
> > On Fri, May 16, 2008 at 05:21:15PM +0100, Pedro Alves wrote:
> > > I've been meaning to test this on Cygwin/MinGW/Dwarf before
> > > posting, but since the subject came up, here it goes anyway.
> >
> > I looked through the patch, and I can't see anything wrong with it.
> > It's OK to commit, though you might want to do that Cygwin test
> > first...
>
> I've finally passed this through the testsuite on mingw32 + dwarf, and
> found no regressions.
>
> I checked it in after also retesting on x86_64-unknown-linux-gnu.
I missed that a several tdep files access obj_section->[addr|endaddr]
directly.
I checked in this patch to adjusts them. --enable-targets=all &&
make -k builds all files sucessfully, except m88k-tdep.c which needs
unwinder updates.
--
Pedro Alves
[-- Attachment #2: obj_section.diff --]
[-- Type: text/x-diff, Size: 6967 bytes --]
2008-08-21 Pedro Alves <pedro@codesourcery.com>
* arm-tdep.c (arm_pc_is_thumb): Use obj_section_addr.
* hppa-hpux-tdep.c (hppa_hpux_find_dummy_bpaddr): Likewise.
* hppa-linux-tdep.c (hppa_linux_find_global_pointer): Use
obj_section_addr and obj_section_endaddr.
* hppa-tdep.c (hppa64_convert_code_addr_to_fptr): Likewise.
* hppabsd-tdep.c (hppabsd_find_global_pointer): Likewise.
* ia64-tdep.c (ia64_find_global_pointer): Likewise.
(find_extant_func_descr): Likewise.
* solib-frv.c (frv_relocate_main_executable): Use
obj_section_addr.
* xstormy16-tdep.c (xstormy16_find_jmp_table_entry): Use
obj_section_addr and obj_section_endaddr.
---
gdb/arm-tdep.c | 3 ++-
gdb/hppa-hpux-tdep.c | 4 ++--
gdb/hppa-linux-tdep.c | 8 +++++---
gdb/hppa-tdep.c | 10 ++++++----
gdb/hppabsd-tdep.c | 5 +++--
gdb/ia64-tdep.c | 16 ++++++++++------
gdb/solib-frv.c | 2 +-
gdb/xstormy16-tdep.c | 9 ++++++---
8 files changed, 35 insertions(+), 22 deletions(-)
Index: src/gdb/arm-tdep.c
===================================================================
--- src.orig/gdb/arm-tdep.c 2008-08-21 14:16:07.000000000 +0100
+++ src/gdb/arm-tdep.c 2008-08-21 14:17:12.000000000 +0100
@@ -303,7 +303,8 @@ arm_pc_is_thumb (CORE_ADDR memaddr)
{
struct arm_per_objfile *data;
VEC(arm_mapping_symbol_s) *map;
- struct arm_mapping_symbol map_key = { memaddr - sec->addr, 0 };
+ struct arm_mapping_symbol map_key = { memaddr - obj_section_addr (sec),
+ 0 };
unsigned int idx;
data = objfile_data (sec->objfile, arm_objfile_data_key);
Index: src/gdb/hppa-hpux-tdep.c
===================================================================
--- src.orig/gdb/hppa-hpux-tdep.c 2008-08-21 14:16:07.000000000 +0100
+++ src/gdb/hppa-hpux-tdep.c 2008-08-21 14:17:12.000000000 +0100
@@ -1068,9 +1068,9 @@ hppa_hpux_find_dummy_bpaddr (CORE_ADDR a
{
/* First try the lowest address in the section; we can use it as long
as it is "regular" code (i.e. not a stub) */
- u = find_unwind_entry (sec->addr);
+ u = find_unwind_entry (obj_section_addr (sec));
if (!u || u->stub_unwind.stub_type == 0)
- return sec->addr;
+ return obj_section_addr (sec);
/* Otherwise, we need to find a symbol for a regular function. We
do this by walking the list of msymbols in the objfile. The symbol
Index: src/gdb/hppa-linux-tdep.c
===================================================================
--- src.orig/gdb/hppa-linux-tdep.c 2008-08-21 14:16:07.000000000 +0100
+++ src/gdb/hppa-linux-tdep.c 2008-08-21 14:17:12.000000000 +0100
@@ -365,10 +365,12 @@ hppa_linux_find_global_pointer (struct g
if (osect < faddr_sect->objfile->sections_end)
{
- CORE_ADDR addr;
+ CORE_ADDR addr, endaddr;
- addr = osect->addr;
- while (addr < osect->endaddr)
+ addr = obj_section_addr (osect);
+ endaddr = obj_section_endaddr (osect);
+
+ while (addr < endaddr)
{
int status;
LONGEST tag;
Index: src/gdb/hppa-tdep.c
===================================================================
--- src.orig/gdb/hppa-tdep.c 2008-08-21 14:16:07.000000000 +0100
+++ src/gdb/hppa-tdep.c 2008-08-21 14:17:12.000000000 +0100
@@ -912,15 +912,17 @@ hppa64_convert_code_addr_to_fptr (CORE_A
ALL_OBJFILE_OSECTIONS (sec->objfile, opd)
{
if (strcmp (opd->the_bfd_section->name, ".opd") == 0)
- break;
+ break;
}
if (opd < sec->objfile->sections_end)
{
CORE_ADDR addr;
- for (addr = opd->addr; addr < opd->endaddr; addr += 2 * 8)
- {
+ for (addr = obj_section_addr (opd);
+ addr < obj_section_endaddr (opd);
+ addr += 2 * 8)
+ {
ULONGEST opdaddr;
char tmp[8];
@@ -928,7 +930,7 @@ hppa64_convert_code_addr_to_fptr (CORE_A
break;
opdaddr = extract_unsigned_integer (tmp, sizeof (tmp));
- if (opdaddr == code)
+ if (opdaddr == code)
return addr - 16;
}
}
Index: src/gdb/hppabsd-tdep.c
===================================================================
--- src.orig/gdb/hppabsd-tdep.c 2008-08-21 14:16:07.000000000 +0100
+++ src/gdb/hppabsd-tdep.c 2008-08-21 14:17:12.000000000 +0100
@@ -61,9 +61,10 @@ hppabsd_find_global_pointer (struct gdba
if (sec < faddr_sec->objfile->sections_end)
{
- CORE_ADDR addr = sec->addr;
+ CORE_ADDR addr = obj_section_addr (sec);
+ CORE_ADDR endaddr = obj_section_endaddr (sec);
- while (addr < sec->endaddr)
+ while (addr < endaddr)
{
gdb_byte buf[4];
LONGEST tag;
Index: src/gdb/ia64-tdep.c
===================================================================
--- src.orig/gdb/ia64-tdep.c 2008-08-21 14:16:07.000000000 +0100
+++ src/gdb/ia64-tdep.c 2008-08-21 14:17:12.000000000 +0100
@@ -3095,10 +3095,12 @@ ia64_find_global_pointer (CORE_ADDR fadd
if (osect < faddr_sect->objfile->sections_end)
{
- CORE_ADDR addr;
+ CORE_ADDR addr, endaddr;
- addr = osect->addr;
- while (addr < osect->endaddr)
+ addr = obj_section_addr (osect);
+ endaddr = obj_section_endaddr (osect);
+
+ while (addr < endaddr)
{
int status;
LONGEST tag;
@@ -3156,10 +3158,12 @@ find_extant_func_descr (CORE_ADDR faddr)
if (osect < faddr_sect->objfile->sections_end)
{
- CORE_ADDR addr;
+ CORE_ADDR addr, endaddr;
+
+ addr = obj_section_addr (osect);
+ endaddr = obj_section_endaddr (osect);
- addr = osect->addr;
- while (addr < osect->endaddr)
+ while (addr < endaddr)
{
int status;
LONGEST faddr2;
Index: src/gdb/solib-frv.c
===================================================================
--- src.orig/gdb/solib-frv.c 2008-08-21 14:16:07.000000000 +0100
+++ src/gdb/solib-frv.c 2008-08-21 14:17:12.000000000 +0100
@@ -908,7 +908,7 @@ frv_relocate_main_executable (void)
osect_idx = osect->the_bfd_section->index;
/* Current address of section. */
- addr = osect->addr;
+ addr = obj_section_addr (osect);
/* Offset from where this section started. */
offset = ANOFFSET (symfile_objfile->section_offsets, osect_idx);
/* Original address prior to any past relocations. */
Index: src/gdb/xstormy16-tdep.c
===================================================================
--- src.orig/gdb/xstormy16-tdep.c 2008-08-21 14:16:07.000000000 +0100
+++ src/gdb/xstormy16-tdep.c 2008-08-21 14:17:12.000000000 +0100
@@ -550,9 +550,12 @@ xstormy16_find_jmp_table_entry (CORE_ADD
if (osect < faddr_sect->objfile->sections_end)
{
- CORE_ADDR addr;
- for (addr = osect->addr;
- addr < osect->endaddr; addr += 2 * xstormy16_inst_size)
+ CORE_ADDR addr, endaddr;
+
+ addr = obj_section_addr (osect);
+ endaddr = obj_section_endaddr (osect);
+
+ for (; addr < endaddr; addr += 2 * xstormy16_inst_size)
{
LONGEST inst, inst2, faddr2;
char buf[2 * xstormy16_inst_size];
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Remove addr, endaddr, offset from obj_section
2008-08-21 13:28 ` Pedro Alves
@ 2008-09-02 9:33 ` Andreas Schwab
2008-09-02 21:09 ` Joel Brobecker
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2008-09-02 9:33 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
2008-09-02 Andreas Schwab <schwab@suse.de>
* ia64-tdep.c (ia64_get_dyn_info_list): Use obj_section_addr.
Index: gdb/ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.181
diff -u -a -p -u -p -a -r1.181 gdb/ia64-tdep.c
--- gdb/ia64-tdep.c 21 Aug 2008 13:19:18 -0000 1.181
+++ gdb/ia64-tdep.c 2 Sep 2008 09:31:50 -0000
@@ -2563,7 +2563,7 @@ ia64_get_dyn_info_list (unw_addr_space_t
void *buf = NULL;
text_sec = objfile->sections + SECT_OFF_TEXT (objfile);
- ip = text_sec->addr;
+ ip = obj_section_addr (text_sec);
ret = ia64_find_unwind_table (objfile, ip, &di, &buf);
if (ret >= 0)
{
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC] Remove addr, endaddr, offset from obj_section
2008-09-02 9:33 ` Andreas Schwab
@ 2008-09-02 21:09 ` Joel Brobecker
0 siblings, 0 replies; 8+ messages in thread
From: Joel Brobecker @ 2008-09-02 21:09 UTC (permalink / raw)
To: Andreas Schwab; +Cc: Pedro Alves, gdb-patches
> 2008-09-02 Andreas Schwab <schwab@suse.de>
>
> * ia64-tdep.c (ia64_get_dyn_info_list): Use obj_section_addr.
Hmmm, it would have been nice to give some indication that the patch
has already been applied. Next time, I will check first...
Many thanks for fixing the problem, though.
--
Joel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-09-02 21:09 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-16 20:42 [RFC] Remove addr, endaddr, offset from obj_section Pedro Alves
2008-05-17 0:11 ` Ulrich Weigand
2008-05-17 2:17 ` Pedro Alves
2008-06-05 19:16 ` Daniel Jacobowitz
2008-08-20 11:23 ` Pedro Alves
2008-08-21 13:28 ` Pedro Alves
2008-09-02 9:33 ` Andreas Schwab
2008-09-02 21:09 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox