* Makefile.in (objfiles.o): Update.
* exec.c (exec_set_section_address): Support p->addr != 0. * objfiles.c (objfile_relocate): Update exec_ops section addresses. * symfile.c (place_section): Move exec_set_section_address call... (default_symfile_offsets): ...to here.
This commit is contained in:
parent
7284e1bed8
commit
30510692eb
5 changed files with 28 additions and 9 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2008-05-03 Daniel Jacobowitz <dan@codesourcery.com>
|
||||||
|
|
||||||
|
* Makefile.in (objfiles.o): Update.
|
||||||
|
* exec.c (exec_set_section_address): Support p->addr != 0.
|
||||||
|
* objfiles.c (objfile_relocate): Update exec_ops section
|
||||||
|
addresses.
|
||||||
|
* symfile.c (place_section): Move exec_set_section_address call...
|
||||||
|
(default_symfile_offsets): ...to here.
|
||||||
|
|
||||||
2008-05-03 Ulrich Weigand <uweigand@de.ibm.com>
|
2008-05-03 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
* Makefile.in (ppc_linux_tdep_h): New macro.
|
* Makefile.in (ppc_linux_tdep_h): New macro.
|
||||||
|
|
|
@ -2578,7 +2578,8 @@ objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
|
||||||
$(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(mdebugread_h) \
|
$(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(mdebugread_h) \
|
||||||
$(gdb_assert_h) $(gdb_stat_h) $(gdb_obstack_h) $(gdb_string_h) \
|
$(gdb_assert_h) $(gdb_stat_h) $(gdb_obstack_h) $(gdb_string_h) \
|
||||||
$(hashtab_h) $(breakpoint_h) $(block_h) $(dictionary_h) $(source_h) \
|
$(hashtab_h) $(breakpoint_h) $(block_h) $(dictionary_h) $(source_h) \
|
||||||
$(parser_defs_h) $(expression_h) $(addrmap_h) $(arch_utils_h)
|
$(parser_defs_h) $(expression_h) $(addrmap_h) $(arch_utils_h) \
|
||||||
|
$(exec_h)
|
||||||
observer.o: observer.c $(defs_h) $(observer_h) $(command_h) $(gdbcmd_h) \
|
observer.o: observer.c $(defs_h) $(observer_h) $(command_h) $(gdbcmd_h) \
|
||||||
$(observer_inc)
|
$(observer_inc)
|
||||||
obsd-tdep.o: obsd-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(obsd_tdep_h)
|
obsd-tdep.o: obsd-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(obsd_tdep_h)
|
||||||
|
|
10
gdb/exec.c
10
gdb/exec.c
|
@ -636,9 +636,8 @@ set_section_command (char *args, int from_tty)
|
||||||
error (_("Section %s not found"), secprint);
|
error (_("Section %s not found"), secprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we can find a section in FILENAME with BFD index INDEX, and the
|
/* If we can find a section in FILENAME with BFD index INDEX, adjust
|
||||||
user has not assigned an address to it yet (via "set section"), adjust it
|
it to ADDRESS. */
|
||||||
to ADDRESS. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
exec_set_section_address (const char *filename, int index, CORE_ADDR address)
|
exec_set_section_address (const char *filename, int index, CORE_ADDR address)
|
||||||
|
@ -648,11 +647,10 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
|
||||||
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
|
for (p = exec_ops.to_sections; p < exec_ops.to_sections_end; p++)
|
||||||
{
|
{
|
||||||
if (strcmp (filename, p->bfd->filename) == 0
|
if (strcmp (filename, p->bfd->filename) == 0
|
||||||
&& index == p->the_bfd_section->index
|
&& index == p->the_bfd_section->index)
|
||||||
&& p->addr == 0)
|
|
||||||
{
|
{
|
||||||
|
p->endaddr += address - p->addr;
|
||||||
p->addr = address;
|
p->addr = address;
|
||||||
p->endaddr += address;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "addrmap.h"
|
#include "addrmap.h"
|
||||||
#include "arch-utils.h"
|
#include "arch-utils.h"
|
||||||
|
#include "exec.h"
|
||||||
|
|
||||||
/* Prototypes for local functions */
|
/* Prototypes for local functions */
|
||||||
|
|
||||||
|
@ -532,6 +533,7 @@ free_all_objfiles (void)
|
||||||
void
|
void
|
||||||
objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
|
objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
|
||||||
{
|
{
|
||||||
|
struct obj_section *s;
|
||||||
struct section_offsets *delta =
|
struct section_offsets *delta =
|
||||||
((struct section_offsets *)
|
((struct section_offsets *)
|
||||||
alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)));
|
alloca (SIZEOF_N_SECTION_OFFSETS (objfile->num_sections)));
|
||||||
|
@ -683,6 +685,15 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
}
|
||||||
|
|
||||||
/* Relocate breakpoints as necessary, after things are relocated. */
|
/* Relocate breakpoints as necessary, after things are relocated. */
|
||||||
breakpoint_re_set ();
|
breakpoint_re_set ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -535,8 +535,6 @@ place_section (bfd *abfd, asection *sect, void *obj)
|
||||||
|
|
||||||
offsets[sect->index] = start_addr;
|
offsets[sect->index] = start_addr;
|
||||||
arg->lowest = start_addr + bfd_get_section_size (sect);
|
arg->lowest = start_addr + bfd_get_section_size (sect);
|
||||||
|
|
||||||
exec_set_section_address (bfd_get_filename (abfd), sect->index, start_addr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the user's idea of an offset for dynamic linking, into our idea
|
/* Parse the user's idea of an offset for dynamic linking, into our idea
|
||||||
|
@ -635,6 +633,8 @@ default_symfile_offsets (struct objfile *objfile,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bfd_set_section_vma (abfd, cur_sec, offsets[cur_sec->index]);
|
bfd_set_section_vma (abfd, cur_sec, offsets[cur_sec->index]);
|
||||||
|
exec_set_section_address (bfd_get_filename (abfd), cur_sec->index,
|
||||||
|
offsets[cur_sec->index]);
|
||||||
offsets[cur_sec->index] = 0;
|
offsets[cur_sec->index] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue