/* Definitions for symbol file management in GDB.
- Copyright (C) 1992-2004, 2007-2012 Free Software Foundation, Inc.
+ Copyright (C) 1992-2013 Free Software Foundation, Inc.
This file is part of GDB.
#include "symfile.h" /* For struct psymbol_allocation_list. */
#include "progspace.h"
#include "registry.h"
+#include "gdb_bfd.h"
struct bcache;
struct htab;
/* Relocation offset applied to S. */
#define obj_section_offset(s) \
- (((s)->objfile->section_offsets)->offsets[(s)->the_bfd_section->index])
+ (((s)->objfile->section_offsets)->offsets[gdb_bfd_section_index ((s)->objfile->obfd, (s)->the_bfd_section)])
/* The memory address of section S (vma + offset). */
#define obj_section_addr(s) \
struct objfile *next;
- /* The object file's name, tilde-expanded and absolute. Malloc'd; free it
- if you free this struct. This pointer is never NULL. */
+ /* The object file's name, tilde-expanded and absolute. This
+ pointer is never NULL. This does not have to be freed; it is
+ guaranteed to have a lifetime at least as long as the objfile. */
char *name;
long mtime;
- /* Cached 32-bit CRC as computed by gnu_debuglink_crc32. CRC32 is valid
- iff CRC32_P. */
- unsigned long crc32;
- int crc32_p;
-
/* Obstack to hold objects that should be freed when we load a new symbol
table from this object file. */
struct entry_info ei;
- /* Information about stabs. Will be filled in with a dbx_symfile_info
- struct by those readers that need it. */
- /* NOTE: cagney/2004-10-23: This has been replaced by per-objfile
- data points implemented using "data" and "num_data" below. For
- an example of how to use this replacement, see "objfile_data"
- in "mips-tdep.c". */
-
- struct dbx_symfile_info *deprecated_sym_stab_info;
-
- /* Hook for information for use by the symbol reader (currently used
- for information shared by sym_init and sym_read). It is
- typically a pointer to malloc'd memory. The symbol reader's finish
- function is responsible for freeing the memory thusly allocated. */
- /* NOTE: cagney/2004-10-23: This has been replaced by per-objfile
- data points implemented using "data" and "num_data" below. For
- an example of how to use this replacement, see "objfile_data"
- in "mips-tdep.c". */
-
- void *deprecated_sym_private;
-
/* Per objfile data-pointers required by other GDB modules. */
- /* FIXME: kettenis/20030711: This mechanism could replace
- deprecated_sym_stab_info and deprecated_sym_private
- entirely. */
REGISTRY_FIELDS;
among other things, is used to map pc addresses into sections.
SECTIONS points to the first entry in the table, and
SECTIONS_END points to the first location past the last entry
- in the table. The table is stored on the objfile_obstack.
- There is no particular order to the sections in this table, and it
- only contains sections we care about (e.g. non-empty, SEC_ALLOC). */
+ in the table. The table is stored on the objfile_obstack. The
+ sections are indexed by the BFD section index; but the
+ structure data is only valid for certain sections
+ (e.g. non-empty, SEC_ALLOC). */
struct obj_section *sections, *sections_end;
extern struct gdbarch *get_objfile_arch (struct objfile *);
-extern void init_entry_point_info (struct objfile *);
-
extern int entry_point_address_query (CORE_ADDR *entry_p);
extern CORE_ADDR entry_point_address (void);
extern void free_all_objfiles (void);
-extern void objfile_relocate (struct objfile *, struct section_offsets *);
+extern void objfile_relocate (struct objfile *, const struct section_offsets *);
+extern void objfile_rebase (struct objfile *, CORE_ADDR);
extern int objfile_has_partial_symbols (struct objfile *objfile);
extern struct obj_section *find_pc_section (CORE_ADDR pc);
-extern int in_plt_section (CORE_ADDR, char *);
+/* Return non-zero if PC is in a section called NAME. */
+extern int pc_in_section (CORE_ADDR, char *);
+
+/* Return non-zero if PC is in a SVR4-style procedure linkage table
+ section. */
+
+static inline int
+in_plt_section (CORE_ADDR pc)
+{
+ return pc_in_section (pc, ".plt");
+}
/* Keep a registry of per-objfile data-pointers required by other GDB
modules. */
DECLARE_REGISTRY(objfile);
+/* In normal use, the section map will be rebuilt by find_pc_section
+ if objfiles have been added, removed or relocated since it was last
+ called. Calling inhibit_section_map_updates will inhibit this
+ behavior until resume_section_map_updates is called. If you call
+ inhibit_section_map_updates you must ensure that every call to
+ find_pc_section in the inhibited region relates to a section that
+ is already in the section map and has not since been removed or
+ relocated. */
+extern void inhibit_section_map_updates (struct program_space *pspace);
+
+/* Resume automatically rebuilding the section map as required. */
+extern void resume_section_map_updates (struct program_space *pspace);
+
+/* Version of the above suitable for use as a cleanup. */
+extern void resume_section_map_updates_cleanup (void *arg);
+
extern void default_iterate_over_objfiles_in_search_order
(struct gdbarch *gdbarch,
iterate_over_objfiles_in_search_order_cb_ftype *cb,
/* Traverse all object files in program space SS. */
#define ALL_PSPACE_OBJFILES(ss, obj) \
- for ((obj) = ss->objfiles; (obj) != NULL; (obj) = (obj)->next) \
+ for ((obj) = ss->objfiles; (obj) != NULL; (obj) = (obj)->next)
#define ALL_PSPACE_OBJFILES_SAFE(ss, obj, nxt) \
for ((obj) = ss->objfiles; \
ALL_OBJFILE_MSYMBOLS (objfile, m)
#define ALL_OBJFILE_OSECTIONS(objfile, osect) \
- for (osect = objfile->sections; osect < objfile->sections_end; osect++)
+ for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
+ if (osect->the_bfd_section == NULL) \
+ { \
+ /* Nothing. */ \
+ } \
+ else
/* Traverse all obj_sections in all objfiles in the current program
space.
? ((objfile) = (objfile)->next, \
(objfile) != NULL ? (osect) = (objfile)->sections_end : 0) \
: 0)) \
- for ((osect) = (objfile)->sections; \
- (osect) < (objfile)->sections_end; \
- (osect)++)
+ ALL_OBJFILE_OSECTIONS (objfile, osect)
#define SECT_OFF_DATA(objfile) \
((objfile->sect_index_data == -1) \