This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[commit] Fix incorrect relocation of blockvector address maps
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 14 Jul 2009 16:57:41 +0200 (CEST)
- Subject: [commit] Fix incorrect relocation of blockvector address maps
Hello,
objfile_relocate handles relocation of blockvector address maps incorrectly.
The current code calls addrmap_relocate in a loop, once for every block.
However, the address map is located at the block *vector*, which means
the same map is being relocated multiple times by that loop. As the
relocation consists of adding a delta, doing this multiple times leads
to an incorrect result.
The following patch fixes this by applying the relocation only once.
Tested on powerpc64-linux, applied to mainline.
Bye,
Ulrich
ChangeLog:
* objfiles.c (objfile_relocate): Do not relocate the same
BLOCKVECTOR_MAP address map multiple times.
Index: src/gdb/objfiles.c
===================================================================
--- src.orig/gdb/objfiles.c
+++ src/gdb/objfiles.c
@@ -570,6 +570,10 @@ objfile_relocate (struct objfile *objfil
continue;
bv = BLOCKVECTOR (s);
+ if (BLOCKVECTOR_MAP (bv))
+ addrmap_relocate (BLOCKVECTOR_MAP (bv),
+ ANOFFSET (delta, s->block_line_section));
+
for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
{
struct block *b;
@@ -579,9 +583,6 @@ objfile_relocate (struct objfile *objfil
b = BLOCKVECTOR_BLOCK (bv, i);
BLOCK_START (b) += ANOFFSET (delta, s->block_line_section);
BLOCK_END (b) += ANOFFSET (delta, s->block_line_section);
- if (BLOCKVECTOR_MAP (bv))
- addrmap_relocate (BLOCKVECTOR_MAP (bv),
- ANOFFSET (delta, s->block_line_section));
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com