/* GDB routines for manipulating objfiles.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1992-2004, 2007-2012 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules.
return info;
}
-/* Records whether any objfiles appeared or disappeared since we last updated
- address to obj section map. */
-
-/* Locate all mappable sections of a BFD file.
- objfile_p_char is a char * to get it through
- bfd_map_over_sections; we cast it back to its proper type. */
-
/* Called via bfd_map_over_sections to build up the section table that
the objfile references. The objfile contains pointers to the start
of the table (objfile->sections) and to the first location after
static void
add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect,
- void *objfile_p_char)
+ void *objfilep)
{
- struct objfile *objfile = (struct objfile *) objfile_p_char;
+ struct objfile *objfile = (struct objfile *) objfilep;
struct obj_section section;
flagword aflag;
aflag = bfd_get_section_flags (abfd, asect);
-
if (!(aflag & SEC_ALLOC))
return;
-
- if (0 == bfd_section_size (abfd, asect))
+ if (bfd_section_size (abfd, asect) == 0)
return;
+
section.objfile = objfile;
section.the_bfd_section = asect;
section.ovly_mapped = 0;
}
/* Builds a section table for OBJFILE.
- Returns 0 if OK, 1 on error (in which case bfd_error contains the
- error).
Note that while we are building the table, which goes into the
- psymbol obstack, we hijack the sections_end pointer to instead hold
+ objfile obstack, we hijack the sections_end pointer to instead hold
a count of the number of sections. When bfd_map_over_sections
returns, this count is used to compute the pointer to the end of
the sections table, which then overwrites the count.
Also note that the OFFSET and OVLY_MAPPED in each table entry
are initialized to zero.
- Also note that if anything else writes to the psymbol obstack while
+ Also note that if anything else writes to the objfile obstack while
we are building the table, we're pretty much hosed. */
-int
+void
build_objfile_section_table (struct objfile *objfile)
{
objfile->sections_end = 0;
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);
}
/* Given a pointer to an initialized bfd (ABFD) and some flag bits
objfile->mtime = bfd_get_mtime (abfd);
/* Build section table. */
-
- if (build_objfile_section_table (objfile))
- {
- error (_("Can't find the file sections in `%s': %s"),
- objfile->name, bfd_errmsg (bfd_get_error ()));
- }
+ build_objfile_section_table (objfile);
}
else
{
obj_section_addr (s));
}
+ /* Relocating probes. */
+ if (objfile->sf && objfile->sf->sym_probe_fns)
+ objfile->sf->sym_probe_fns->sym_relocate_probe (objfile,
+ new_offsets, delta);
+
/* Data changed. */
return 1;
}