* target.h (struct section_table): Rename to ...

(struct target_section): ... this.
	* exec.c: Adjust all references.
	* exec.h: Adjust all references.
	* nto-tdep.c: Adjust all references.
	* nto-tdep.h: Adjust all references.
	* ppc-linux-tdep.c: Adjust all references.
	* rs6000-nat.c: Adjust all references.
	* s390-tdep.c: Adjust all references.
	* solib-darwin.c: Adjust all references.
	* solib-frv.c: Adjust all references.
	* solib-irix.c: Adjust all references.
	* solib-null.c: Adjust all references.
	* solib-osf.c: Adjust all references.
	* solib-pa64.c: Adjust all references.
	* solib-som.c: Adjust all references.
	* solib-sunos.c: Adjust all references.
	* solib-svr4.c: Adjust all references.
	* solib-target.c: Adjust all references.
	* solib.c: Adjust all references.
	* solist.h: Adjust all references.
	* symfile.c: Adjust all references.
	* symfile.h: Adjust all references.
	* target.c: Adjust all references.
This commit is contained in:
Pedro Alves 2009-05-22 23:49:14 +00:00
parent 4daadc0d02
commit 0542c86dbb
24 changed files with 85 additions and 59 deletions

View file

@ -1,3 +1,30 @@
2009-05-22 Pedro Alves <pedro@codesourcery.com>
* target.h (struct section_table): Rename to ...
(struct target_section): ... this.
* exec.c: Adjust all references.
* exec.h: Adjust all references.
* nto-tdep.c: Adjust all references.
* nto-tdep.h: Adjust all references.
* ppc-linux-tdep.c: Adjust all references.
* rs6000-nat.c: Adjust all references.
* s390-tdep.c: Adjust all references.
* solib-darwin.c: Adjust all references.
* solib-frv.c: Adjust all references.
* solib-irix.c: Adjust all references.
* solib-null.c: Adjust all references.
* solib-osf.c: Adjust all references.
* solib-pa64.c: Adjust all references.
* solib-som.c: Adjust all references.
* solib-sunos.c: Adjust all references.
* solib-svr4.c: Adjust all references.
* solib-target.c: Adjust all references.
* solib.c: Adjust all references.
* solist.h: Adjust all references.
* symfile.c: Adjust all references.
* symfile.h: Adjust all references.
* target.c: Adjust all references.
2009-05-22 Hui Zhu <teawater@gmail.com> 2009-05-22 Hui Zhu <teawater@gmail.com>
Add sys_fcntl argument interfaces to linux_record_tdep. Add sys_fcntl argument interfaces to linux_record_tdep.

View file

@ -351,7 +351,7 @@ static void
add_to_section_table (bfd *abfd, struct bfd_section *asect, add_to_section_table (bfd *abfd, struct bfd_section *asect,
void *table_pp_char) void *table_pp_char)
{ {
struct section_table **table_pp = (struct section_table **) table_pp_char; struct target_section **table_pp = (struct target_section **) table_pp_char;
flagword aflag; flagword aflag;
/* Check the section flags, but do not discard zero-length sections, since /* Check the section flags, but do not discard zero-length sections, since
@ -374,15 +374,15 @@ add_to_section_table (bfd *abfd, struct bfd_section *asect,
Returns 0 if OK, 1 on error. */ Returns 0 if OK, 1 on error. */
int int
build_section_table (struct bfd *some_bfd, struct section_table **start, build_section_table (struct bfd *some_bfd, struct target_section **start,
struct section_table **end) struct target_section **end)
{ {
unsigned count; unsigned count;
count = bfd_count_sections (some_bfd); count = bfd_count_sections (some_bfd);
if (*start) if (*start)
xfree (* start); xfree (* start);
*start = (struct section_table *) xmalloc (count * sizeof (**start)); *start = (struct target_section *) xmalloc (count * sizeof (**start));
*end = *start; *end = *start;
bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end); bfd_map_over_sections (some_bfd, add_to_section_table, (char *) end);
if (*end > *start + count) if (*end > *start + count)
@ -470,12 +470,12 @@ map_vmap (bfd *abfd, bfd *arch)
static int static int
section_table_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, section_table_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
int len, int write, int len, int write,
struct section_table *sections, struct target_section *sections,
struct section_table *sections_end, struct target_section *sections_end,
const char *section_name) const char *section_name)
{ {
int res; int res;
struct section_table *p; struct target_section *p;
CORE_ADDR nextsectaddr, memend; CORE_ADDR nextsectaddr, memend;
if (len <= 0) if (len <= 0)
@ -536,8 +536,8 @@ section_table_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
int int
section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf, section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
ULONGEST offset, LONGEST len, ULONGEST offset, LONGEST len,
struct section_table *sections, struct target_section *sections,
struct section_table *sections_end) struct target_section *sections_end)
{ {
if (readbuf != NULL) if (readbuf != NULL)
return section_table_xfer_memory (offset, readbuf, len, 0, return section_table_xfer_memory (offset, readbuf, len, 0,
@ -597,7 +597,7 @@ xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
void void
print_section_info (struct target_ops *t, bfd *abfd) print_section_info (struct target_ops *t, bfd *abfd)
{ {
struct section_table *p; struct target_section *p;
/* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */ /* FIXME: 16 is not wide enough when gdbarch_addr_bit > 64. */
int wid = gdbarch_addr_bit (gdbarch_from_bfd (abfd)) <= 32 ? 8 : 16; int wid = gdbarch_addr_bit (gdbarch_from_bfd (abfd)) <= 32 ? 8 : 16;
@ -661,7 +661,7 @@ exec_files_info (struct target_ops *t)
static void static void
set_section_command (char *args, int from_tty) set_section_command (char *args, int from_tty)
{ {
struct section_table *p; struct target_section *p;
char *secname; char *secname;
unsigned seclen; unsigned seclen;
unsigned long secaddr; unsigned long secaddr;
@ -704,7 +704,7 @@ set_section_command (char *args, int from_tty)
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)
{ {
struct section_table *p; struct target_section *p;
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++)
{ {

View file

@ -22,7 +22,7 @@
#include "target.h" #include "target.h"
struct section_table; struct target_section;
struct target_ops; struct target_ops;
struct bfd; struct bfd;
@ -31,8 +31,8 @@ extern struct target_ops exec_ops;
/* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR. /* Builds a section table, given args BFD, SECTABLE_PTR, SECEND_PTR.
Returns 0 if OK, 1 on error. */ Returns 0 if OK, 1 on error. */
extern int build_section_table (struct bfd *, struct section_table **, extern int build_section_table (struct bfd *, struct target_section **,
struct section_table **); struct target_section **);
/* Request to transfer up to LEN 8-bit bytes of the target sections /* Request to transfer up to LEN 8-bit bytes of the target sections
defined by SECTIONS and SECTIONS_END. The OFFSET specifies the defined by SECTIONS and SECTIONS_END. The OFFSET specifies the
@ -49,8 +49,8 @@ extern int build_section_table (struct bfd *, struct section_table **,
extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *, extern int section_table_xfer_memory_partial (gdb_byte *, const gdb_byte *,
ULONGEST, LONGEST, ULONGEST, LONGEST,
struct section_table *, struct target_section *,
struct section_table *); struct target_section *);
/* Set the loaded address of a section. */ /* Set the loaded address of a section. */
extern void exec_set_section_address (const char *, int, CORE_ADDR); extern void exec_set_section_address (const char *, int, CORE_ADDR);

View file

@ -318,7 +318,7 @@ find_load_phdr (bfd *abfd)
} }
void void
nto_relocate_section_addresses (struct so_list *so, struct section_table *sec) nto_relocate_section_addresses (struct so_list *so, struct target_section *sec)
{ {
/* Neutrino treats the l_addr base address field in link.h as different than /* Neutrino treats the l_addr base address field in link.h as different than
the base address in the System V ABI and so the offset needs to be the base address in the System V ABI and so the offset needs to be

View file

@ -150,7 +150,7 @@ char **nto_parse_redirection (char *start_argv[], const char **in,
int proc_iterate_over_mappings (int (*func) (int, CORE_ADDR)); int proc_iterate_over_mappings (int (*func) (int, CORE_ADDR));
void nto_relocate_section_addresses (struct so_list *, void nto_relocate_section_addresses (struct so_list *,
struct section_table *); struct target_section *);
int nto_map_arch_to_cputype (const char *); int nto_map_arch_to_cputype (const char *);

View file

@ -621,7 +621,7 @@ ppc64_linux_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
CORE_ADDR addr, CORE_ADDR addr,
struct target_ops *targ) struct target_ops *targ)
{ {
struct section_table *s = target_section_by_addr (targ, addr); struct target_section *s = target_section_by_addr (targ, addr);
/* Check if ADDR points to a function descriptor. */ /* Check if ADDR points to a function descriptor. */
if (s && strcmp (s->the_bfd_section->name, ".opd") == 0) if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)

View file

@ -1158,7 +1158,7 @@ xcoff_relocate_core (struct target_ops *target)
add our sections to the section table for the core target. */ add our sections to the section table for the core target. */
if (vp != vmap) if (vp != vmap)
{ {
struct section_table *stp; struct target_section *stp;
target_resize_to_sections (target, 2); target_resize_to_sections (target, 2);
stp = target->to_sections_end - 2; stp = target->to_sections_end - 2;

View file

@ -772,7 +772,7 @@ s390_load (struct s390_prologue_data *data,
we're analyzing the code to unwind past that frame. */ we're analyzing the code to unwind past that frame. */
if (pv_is_constant (addr)) if (pv_is_constant (addr))
{ {
struct section_table *secp; struct target_section *secp;
secp = target_section_by_addr (&current_target, addr.k); secp = target_section_by_addr (&current_target, addr.k);
if (secp != NULL if (secp != NULL
&& (bfd_get_section_flags (secp->bfd, secp->the_bfd_section) && (bfd_get_section_flags (secp->bfd, secp->the_bfd_section)

View file

@ -379,7 +379,7 @@ darwin_free_so (struct so_list *so)
Relocate these VMAs according to solib info. */ Relocate these VMAs according to solib info. */
static void static void
darwin_relocate_section_addresses (struct so_list *so, darwin_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
sec->addr += so->lm_info->lm_addr; sec->addr += so->lm_info->lm_addr;
sec->endaddr += so->lm_info->lm_addr; sec->endaddr += so->lm_info->lm_addr;

View file

@ -998,7 +998,7 @@ frv_free_so (struct so_list *so)
static void static void
frv_relocate_section_addresses (struct so_list *so, frv_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
int seg; int seg;
struct int_elf32_fdpic_loadmap *map; struct int_elf32_fdpic_loadmap *map;

View file

@ -687,7 +687,7 @@ irix_special_symbol_handling (void)
static void static void
irix_relocate_section_addresses (struct so_list *so, irix_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
sec->addr += so->lm_info->reloc_offset; sec->addr += so->lm_info->reloc_offset;
sec->endaddr += so->lm_info->reloc_offset; sec->endaddr += so->lm_info->reloc_offset;

View file

@ -50,7 +50,7 @@ null_free_so (struct so_list *so)
static void static void
null_relocate_section_addresses (struct so_list *so, null_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
} }

View file

@ -234,7 +234,7 @@ fetch_sec_names (struct lm_info *lmi)
static void static void
osf_relocate_section_addresses (struct so_list *so, osf_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
struct lm_info *lmi; struct lm_info *lmi;
struct lm_sec lms_key, *lms; struct lm_sec lms_key, *lms;

View file

@ -80,7 +80,7 @@ read_dynamic_info (asection *dyninfo_sect, dld_cache_t *dld_cache_p);
static void static void
pa64_relocate_section_addresses (struct so_list *so, pa64_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
asection *asec = sec->the_bfd_section; asection *asec = sec->the_bfd_section;
CORE_ADDR load_offset; CORE_ADDR load_offset;

View file

@ -111,7 +111,7 @@ dld_cache;
static void static void
som_relocate_section_addresses (struct so_list *so, som_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
flagword aflag = bfd_get_section_flags(so->abfd, sec->the_bfd_section); flagword aflag = bfd_get_section_flags(so->abfd, sec->the_bfd_section);

View file

@ -817,7 +817,7 @@ sunos_free_so (struct so_list *so)
static void static void
sunos_relocate_section_addresses (struct so_list *so, sunos_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
sec->addr += LM_ADDR (so); sec->addr += LM_ADDR (so);
sec->endaddr += LM_ADDR (so); sec->endaddr += LM_ADDR (so);

View file

@ -1747,7 +1747,7 @@ svr4_truncate_ptr (CORE_ADDR addr)
static void static void
svr4_relocate_section_addresses (struct so_list *so, svr4_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
sec->addr = svr4_truncate_ptr (sec->addr + LM_ADDR_CHECK (so, sec->addr = svr4_truncate_ptr (sec->addr + LM_ADDR_CHECK (so,
sec->bfd)); sec->bfd));

View file

@ -328,7 +328,7 @@ solib_target_free_so (struct so_list *so)
static void static void
solib_target_relocate_section_addresses (struct so_list *so, solib_target_relocate_section_addresses (struct so_list *so,
struct section_table *sec) struct target_section *sec)
{ {
int flags = bfd_get_section_flags (sec->bfd, sec->the_bfd_section); int flags = bfd_get_section_flags (sec->bfd, sec->the_bfd_section);
CORE_ADDR offset; CORE_ADDR offset;

View file

@ -347,7 +347,7 @@ solib_map_sections (void *arg)
{ {
struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */ struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
char *filename; char *filename;
struct section_table *p; struct target_section *p;
struct cleanup *old_chain; struct cleanup *old_chain;
bfd *abfd; bfd *abfd;
@ -849,7 +849,7 @@ int
solib_contains_address_p (const struct so_list *const solib, solib_contains_address_p (const struct so_list *const solib,
CORE_ADDR address) CORE_ADDR address)
{ {
struct section_table *p; struct target_section *p;
for (p = solib->sections; p < solib->sections_end; p++) for (p = solib->sections; p < solib->sections_end; p++)
if (p->addr <= address && address < p->endaddr) if (p->addr <= address && address < p->endaddr)

View file

@ -62,8 +62,8 @@ struct so_list
char symbols_loaded; /* flag: symbols read in yet? */ char symbols_loaded; /* flag: symbols read in yet? */
char from_tty; /* flag: print msgs? */ char from_tty; /* flag: print msgs? */
struct objfile *objfile; /* objfile for loaded lib */ struct objfile *objfile; /* objfile for loaded lib */
struct section_table *sections; struct target_section *sections;
struct section_table *sections_end; struct target_section *sections_end;
/* Record the range of addresses belonging to this shared library. /* Record the range of addresses belonging to this shared library.
There may not be just one (e.g. if two segments are relocated There may not be just one (e.g. if two segments are relocated
@ -76,7 +76,7 @@ struct target_so_ops
/* Adjust the section binding addresses by the base address at /* Adjust the section binding addresses by the base address at
which the object was actually mapped. */ which the object was actually mapped. */
void (*relocate_section_addresses) (struct so_list *so, void (*relocate_section_addresses) (struct so_list *so,
struct section_table *); struct target_section *);
/* Free the the link map info and any other private data /* Free the the link map info and any other private data
structures associated with a so_list entry. */ structures associated with a so_list entry. */

View file

@ -369,11 +369,11 @@ copy_section_addr_info (struct section_addr_info *addrs)
an existing section table. */ an existing section table. */
extern struct section_addr_info * extern struct section_addr_info *
build_section_addr_info_from_section_table (const struct section_table *start, build_section_addr_info_from_section_table (const struct target_section *start,
const struct section_table *end) const struct target_section *end)
{ {
struct section_addr_info *sap; struct section_addr_info *sap;
const struct section_table *stp; const struct target_section *stp;
int oidx; int oidx;
sap = alloc_section_addr_info (end - start); sap = alloc_section_addr_info (end - start);

View file

@ -26,7 +26,7 @@
#include "symtab.h" #include "symtab.h"
/* Opaque declarations. */ /* Opaque declarations. */
struct section_table; struct target_section;
struct objfile; struct objfile;
struct obj_section; struct obj_section;
struct obstack; struct obstack;
@ -237,9 +237,9 @@ extern struct section_addr_info *(copy_section_addr_info
existing section table. */ existing section table. */
extern struct section_addr_info extern struct section_addr_info
*build_section_addr_info_from_section_table (const struct section_table *build_section_addr_info_from_section_table (const struct target_section
*start, *start,
const struct section_table const struct target_section
*end); *end);
/* Free all memory allocated by /* Free all memory allocated by

View file

@ -1017,10 +1017,10 @@ done:
} }
/* Find a section containing ADDR. */ /* Find a section containing ADDR. */
struct section_table * struct target_section *
target_section_by_addr (struct target_ops *target, CORE_ADDR addr) target_section_by_addr (struct target_ops *target, CORE_ADDR addr)
{ {
struct section_table *secp; struct target_section *secp;
for (secp = target->to_sections; for (secp = target->to_sections;
secp < target->to_sections_end; secp < target->to_sections_end;
secp++) secp++)
@ -1049,7 +1049,7 @@ memory_xfer_partial (struct target_ops *ops, void *readbuf, const void *writebuf
/* Try the executable file, if "trust-readonly-sections" is set. */ /* Try the executable file, if "trust-readonly-sections" is set. */
if (readbuf != NULL && trust_readonly) if (readbuf != NULL && trust_readonly)
{ {
struct section_table *secp; struct target_section *secp;
secp = target_section_by_addr (ops, memaddr); secp = target_section_by_addr (ops, memaddr);
if (secp != NULL if (secp != NULL
@ -2348,7 +2348,7 @@ int
target_resize_to_sections (struct target_ops *target, int num_added) target_resize_to_sections (struct target_ops *target, int num_added)
{ {
struct target_ops **t; struct target_ops **t;
struct section_table *old_value; struct target_section *old_value;
int old_count; int old_count;
old_value = target->to_sections; old_value = target->to_sections;
@ -2356,15 +2356,15 @@ target_resize_to_sections (struct target_ops *target, int num_added)
if (target->to_sections) if (target->to_sections)
{ {
old_count = target->to_sections_end - target->to_sections; old_count = target->to_sections_end - target->to_sections;
target->to_sections = (struct section_table *) target->to_sections = (struct target_section *)
xrealloc ((char *) target->to_sections, xrealloc ((char *) target->to_sections,
(sizeof (struct section_table)) * (num_added + old_count)); (sizeof (struct target_section)) * (num_added + old_count));
} }
else else
{ {
old_count = 0; old_count = 0;
target->to_sections = (struct section_table *) target->to_sections = (struct target_section *)
xmalloc ((sizeof (struct section_table)) * num_added); xmalloc ((sizeof (struct target_section)) * num_added);
} }
target->to_sections_end = target->to_sections + (num_added + old_count); target->to_sections_end = target->to_sections + (num_added + old_count);
@ -2408,7 +2408,7 @@ remove_target_sections (bfd *abfd)
for (t = target_structs; t < target_structs + target_struct_size; t++) for (t = target_structs; t < target_structs + target_struct_size; t++)
{ {
struct section_table *src, *dest; struct target_section *src, *dest;
dest = (*t)->to_sections; dest = (*t)->to_sections;
for (src = (*t)->to_sections; src < (*t)->to_sections_end; src++) for (src = (*t)->to_sections; src < (*t)->to_sections_end; src++)

View file

@ -420,9 +420,9 @@ struct target_ops
int to_has_execution; int to_has_execution;
int to_has_thread_control; /* control thread execution */ int to_has_thread_control; /* control thread execution */
int to_attach_no_wait; int to_attach_no_wait;
struct section_table struct target_section
*to_sections; *to_sections;
struct section_table struct target_section
*to_sections_end; *to_sections_end;
/* ASYNC target controls */ /* ASYNC target controls */
int (*to_can_async_p) (void); int (*to_can_async_p) (void);
@ -1194,11 +1194,11 @@ void target_mark_running (struct target_ops *);
void target_mark_exited (struct target_ops *); void target_mark_exited (struct target_ops *);
/* Struct section_table maps address ranges to file sections. It is /* Struct target_section maps address ranges to file sections. It is
mostly used with BFD files, but can be used without (e.g. for handling mostly used with BFD files, but can be used without (e.g. for handling
raw disks, or files not in formats handled by BFD). */ raw disks, or files not in formats handled by BFD). */
struct section_table struct target_section
{ {
CORE_ADDR addr; /* Lowest address in section */ CORE_ADDR addr; /* Lowest address in section */
CORE_ADDR endaddr; /* 1+highest address in section */ CORE_ADDR endaddr; /* 1+highest address in section */
@ -1209,9 +1209,8 @@ struct section_table
}; };
/* Return the "section" containing the specified address. */ /* Return the "section" containing the specified address. */
struct section_table *target_section_by_addr (struct target_ops *target, struct target_section *target_section_by_addr (struct target_ops *target,
CORE_ADDR addr); CORE_ADDR addr);
/* From mem-break.c */ /* From mem-break.c */