82 #include "filenames.h"
104 struct buildsym_compunit
207 #define INITIAL_CONTEXT_STACK_SIZE 10
208 #define INITIAL_LINE_VECTOR_LENGTH 1000
231 free_pendings = link->
next;
238 link->
next = *listhead;
243 (*listhead)->symbol[(*listhead)->nsyms++] =
symbol;
257 for (j = list->
nsyms; --j >= 0;)
260 if (*pp == *name && strncmp (pp, name, length) == 0
261 && pp[length] ==
'\0')
283 for (next = free_pendings;
next; next = next1)
286 xfree ((
void *) next);
288 free_pendings = NULL;
295 xfree ((
void *) next);
302 xfree ((
void *) next);
308 pending_macros = NULL;
312 pending_addrmap = NULL;
322 if (pending_blocks != NULL)
325 pending_blocks = NULL;
333 static struct block *
337 int is_global,
int expandable)
386 int nparams = 0, iparams;
407 if (iparams == nparams)
427 for (next = *listhead; next; next = next1)
431 free_pendings = next;
443 _(
"block end address less than block "
444 "start address in %s (patched it)"),
450 _(
"block end address %s less than block "
451 "start address %s (patched it)"),
463 for (pblock = pending_blocks;
464 pblock && pblock != old_blocks;
465 pblock = pblock->
next)
483 _(
"inner block not inside outer block in %s"),
489 _(
"inner block (%s-%s) not "
490 "inside outer block (%s-%s)"),
536 if (pending_blocks == NULL)
545 opblock->
next = pblock;
550 pending_blocks = pblock;
573 || end_inclusive + 1 !=
BLOCK_END (block))
576 if (! pending_addrmap)
595 for (next = pending_blocks, i = 0; next; next = next->
next, i++)
599 blockvector = (
struct blockvector *)
601 (sizeof (
struct blockvector)
602 + (i - 1) *
sizeof (
struct block *)));
611 for (next = pending_blocks; next; next = next->
next)
648 return (blockvector);
658 const char *subfile_dirname;
663 subfile_dirname = buildsym_compunit->
comp_dir;
667 for (subfile = buildsym_compunit->
subfiles; subfile; subfile = subfile->
next)
673 if (IS_ABSOLUTE_PATH (name)
674 && !IS_ABSOLUTE_PATH (subfile->
name)
675 && subfile_dirname != NULL)
677 subfile->
name, (
char *) NULL);
679 subfile_name = subfile->
name;
681 if (FILENAME_CMP (subfile_name, name) == 0)
684 if (subfile_name != subfile->
name)
685 xfree (subfile_name);
688 if (subfile_name != subfile->
name)
689 xfree (subfile_name);
694 subfile = (
struct subfile *)
xmalloc (
sizeof (
struct subfile));
695 memset (subfile, 0,
sizeof (
struct subfile));
699 buildsym_compunit->
subfiles = subfile;
703 subfile->
name = xstrdup (name);
721 && subfile->
next != NULL)
737 for (s = buildsym_compunit->
subfiles; s != NULL; s = s->
next)
744 && subfile->
next != NULL
757 static struct buildsym_compunit *
760 struct buildsym_compunit *bscu;
762 bscu = (
struct buildsym_compunit *)
763 xmalloc (
sizeof (
struct buildsym_compunit));
764 memset (bscu, 0,
sizeof (
struct buildsym_compunit));
767 bscu->
comp_dir = (comp_dir == NULL) ? NULL : xstrdup (comp_dir);
786 if (buildsym_compunit == NULL)
788 for (subfile = buildsym_compunit->
subfiles;
792 nextsub = subfile->
next;
798 xfree (buildsym_compunit);
799 buildsym_compunit = NULL;
819 && buildsym_compunit->
comp_dir == NULL
820 && subfile->
name != NULL
821 && IS_DIR_SEPARATOR (subfile->
name[strlen (subfile->
name) - 1]))
824 subfile->
name = xstrdup (name);
840 && subfile->
next != NULL)
855 struct subfile_stack *tem
856 = (
struct subfile_stack *)
xmalloc (
sizeof (
struct subfile_stack));
863 _(
"failed internal consistency check"));
877 _(
"failed internal consistency check"));
880 subfile_stack = link->
next;
881 xfree ((
void *) link);
916 + (subfile->line_vector_length
958 if (ln1->
pc < ln2->
pc)
961 if (ln1->
pc > ln2->
pc)
988 objfile = buildsym_compunit->
objfile;
990 if (! pending_macros)
1099 if (buildsym_compunit == NULL)
1109 && mainsub->
symtab == NULL)
1111 const char *mainbase = lbasename (mainsub->
name);
1113 struct subfile *prevsub;
1114 struct subfile *mainsub_alias = NULL;
1115 struct subfile *prev_mainsub_alias = NULL;
1118 for (subfile = buildsym_compunit->
subfiles;
1120 subfile = subfile->
next)
1122 if (subfile == mainsub)
1124 if (filename_cmp (lbasename (subfile->
name), mainbase) == 0)
1127 mainsub_alias = subfile;
1128 prev_mainsub_alias = prevsub;
1133 if (nr_matches == 1)
1135 gdb_assert (mainsub_alias != NULL && mainsub_alias != mainsub);
1145 if (prev_mainsub_alias == NULL)
1148 prev_mainsub_alias->
next = mainsub_alias->
next;
1150 xfree (mainsub_alias);
1161 const struct block *a = *(
const struct block **) ap;
1162 const struct block *b = *(
const struct block **) bp;
1185 pending_macros = NULL;
1187 if (pending_addrmap)
1189 pending_addrmap = NULL;
1232 _(
"Context stack not empty in end_symtab"));
1244 struct block **barray, **bp;
1247 for (pb = pending_blocks; pb != NULL; pb = pb->
next)
1250 barray =
xmalloc (
sizeof (*barray) * count);
1254 for (pb = pending_blocks; pb != NULL; pb = pb->
next)
1260 for (pb = pending_blocks; pb != NULL; pb = pb->
next)
1280 && pending_blocks == NULL
1284 && pending_macros == NULL)
1304 int section,
int expandable)
1338 for (subfile = buildsym_compunit->
subfiles;
1340 subfile = subfile->
next)
1342 int linetablesize = 0;
1346 linetablesize =
sizeof (
struct linetable) +
1354 subfile->line_vector->
nitems,
1359 if (subfile->
symtab == NULL)
1361 symtab = subfile->
symtab;
1389 struct symtab *main_symtab, *prev_symtab;
1395 if (symtab == main_symtab)
1397 if (prev_symtab != NULL)
1399 prev_symtab->
next = main_symtab->
next;
1405 prev_symtab = symtab;
1412 if (buildsym_compunit->
comp_dir != NULL)
1418 strlen (buildsym_compunit->
comp_dir));
1482 int section,
int expandable)
1486 if (static_block == NULL)
1531 struct block *static_block;
1542 struct block *static_block;
1559 for (pending = pending_list; pending != NULL; pending = pending->
next)
1561 for (i = 0; i < pending->
nsyms; ++i)
1582 _(
"Context stack not empty in augment_type_symtab"));
1585 if (pending_blocks != NULL)
1587 if (pending_macros != NULL)
1591 _(
"Line numbers recorded in a type symtab"));
1636 newobj->
depth = desc;
1641 newobj->
name = NULL;
1679 buildsym_compunit->
producer = producer;
1695 if (!srclist || !*srclist)
1699 for (i = 0; i < (*srclist)->nsyms; i++)
1707 free_pendings = (*srclist);
1744 subfile_stack = NULL;
static struct buildsym_compunit * buildsym_compunit
EXTERN struct context_stack * context_stack
char * hex_string(LONGEST num)
struct dictionary * dict_create_hashed(struct obstack *obstack, const struct pending *symbol_list)
static void prepare_for_building(const char *name, CORE_ADDR start_addr)
static int block_compar(const void *ap, const void *bp)
struct using_direct * using_directives
static void set_missing_symtab(struct pending *pending_list, struct compunit_symtab *cu)
#define COMPUNIT_DEBUGFORMAT(cust)
#define SYMBOL_PRINT_NAME(symbol)
void symbol_set_symtab(struct symbol *symbol, struct symtab *symtab)
struct obstack storage_obstack
struct linetable_entry item[1]
void record_block_range(struct block *block, CORE_ADDR start, CORE_ADDR end_inclusive)
static int compare_line_numbers(const void *ln1p, const void *ln2p)
int hashname(const char *name)
struct subfile * main_subfile
void add_symbol_to_list(struct symbol *symbol, struct pending **listhead)
#define TYPE_FIELD_ARTIFICIAL(thistype, n)
void set_last_source_file(const char *name)
struct compunit_symtab * allocate_compunit_symtab(struct objfile *objfile, const char *name)
static int pending_addrmap_interesting
struct compunit_symtab * end_symtab(CORE_ADDR end_addr, int section)
#define COMPUNIT_MACRO_TABLE(cust)
void internal_error(const char *file, int line, const char *fmt,...)
EXTERN struct pending * file_symbols
#define ALL_DICT_SYMBOLS(dict, iter, sym)
struct symbol * symbol[PENDINGSIZE]
void augment_type_symtab(void)
static void reset_symtab_globals(void)
#define BLOCKVECTOR_BLOCK(blocklist, n)
static struct pending * free_pendings
EXTERN int context_stack_depth
void record_line(struct subfile *subfile, int line, CORE_ADDR pc)
#define COMPUNIT_DIRNAME(cust)
static void free_buildsym_compunit(void)
#define TYPE_FIELD_TYPE(thistype, n)
void free_pending_blocks(void)
struct objfile_per_bfd_storage * per_bfd
struct macro_table * get_macro_table(void)
struct compunit_symtab * buildsym_compunit_symtab(void)
void restart_symtab(struct compunit_symtab *cust, const char *name, CORE_ADDR start_addr)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
struct compunit_symtab * compunit_symtab
struct block * end_symtab_get_static_block(CORE_ADDR end_addr, int expandable, int required)
#define BLOCK_FUNCTION(bl)
EXTERN struct subfile * current_subfile
struct obstack objfile_obstack
void block_set_using(struct block *block, struct using_direct *using_decl, struct obstack *obstack)
static struct addrmap * pending_addrmap
void finish_global_stabs(struct objfile *objfile)
EXTERN struct using_direct * using_directives
static struct obstack pending_block_obstack
void merge_symbol_lists(struct pending **srclist, struct pending **targetlist)
#define INITIAL_LINE_VECTOR_LENGTH
EXTERN struct pending * global_symbols
struct pending_block * old_blocks
void dict_add_pending(struct dictionary *dict, const struct pending *symbol_list)
struct compunit_symtab * end_symtab_from_static_block(struct block *static_block, int section, int expandable)
#define INITIAL_CONTEXT_STACK_SIZE
void patch_subfile_names(struct subfile *subfile, char *name)
struct buildsym_compunit * buildsym_compunit
void cleanup_undefined_stabs_types(struct objfile *objfile)
const struct sym_fns * sf
void buildsym_new_init(void)
static int have_line_numbers
void complaint(struct complaints **complaints, const char *fmt,...)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
struct gdbarch * get_objfile_arch(const struct objfile *objfile)
EXTERN struct pending * local_symbols
struct addrmap * addrmap_create_mutable(struct obstack *obstack)
void add_compunit_symtab_to_objfile(struct compunit_symtab *cu)
struct compunit_symtab * end_expandable_symtab(CORE_ADDR end_addr, int section)
struct dictionary * dict_create_linear(struct obstack *obstack, const struct pending *symbol_list)
#define BLOCK_SUPERBLOCK(bl)
struct pending_block * next
struct context_stack * pop_context(void)
#define COMPUNIT_PRODUCER(cust)
const char * get_last_source_file(void)
#define SYMBOL_LINKAGE_NAME(symbol)
static void record_pending_block(struct objfile *objfile, struct block *block, struct pending_block *opblock)
struct block * allocate_block(struct obstack *obstack)
#define TYPE_FIELDS(thistype)
void addrmap_set_empty(struct addrmap *map, CORE_ADDR start, CORE_ADDR end_inclusive, void *obj)
struct subfile_stack * next
struct compunit_symtab * start_symtab(struct objfile *objfile, const char *name, const char *comp_dir, CORE_ADDR start_addr)
static struct block * finish_block_internal(struct symbol *symbol, struct pending **listhead, struct pending_block *old_blocks, CORE_ADDR start, CORE_ADDR end, int is_global, int expandable)
unsigned long hash(const void *addr, int length)
struct bcache * macro_cache
PTR xrealloc(PTR ptr, size_t size)
#define COMPUNIT_BLOCKVECTOR(cust)
static struct mdebug_pending ** pending_list
void(* sym_read_linetable)(struct objfile *)
EXTERN int context_stack_size
enum language deduce_language_from_filename(const char *filename)
#define SYMBOL_BLOCK_VALUE(symbol)
static void watch_main_source_file_lossage(void)
struct subfile * subfiles
static struct obstack pending_addrmap_obstack
void record_debugformat(const char *format)
struct complaints * symfile_complaints
#define COMPUNIT_BLOCK_LINE_SECTION(cust)
void really_free_pendings(void *dummy)
#define COMPUNIT_OBJFILE(cust)
struct dictionary * dict_create_hashed_expandable(void)
struct symtab * allocate_symtab(struct compunit_symtab *cust, const char *filename)
#define TYPE_NFIELDS(thistype)
struct general_symbol_info ginfo
EXTERN CORE_ADDR last_source_start_addr
struct addrmap * addrmap_create_fixed(struct addrmap *original, struct obstack *obstack)
#define COMPUNIT_FILETABS(cust)
static struct macro_table * pending_macros
#define BLOCKVECTOR_NBLOCKS(blocklist)
void start_subfile(const char *name)
void free_macro_table(struct macro_table *table)
static struct pending_block * pending_blocks
void set_block_compunit_symtab(struct block *block, struct compunit_symtab *cu)
static struct compunit_symtab * end_symtab_with_blockvector(struct block *static_block, int section, int expandable)
#define TYPE_ALLOC(t, size)
#define SYMBOL_TYPE(symbol)
struct symbol * find_symbol_in_list(struct pending *list, char *name, int length)
struct context_stack * push_context(int desc, CORE_ADDR valu)
#define ALL_COMPUNIT_FILETABS(cu, s)
#define BLOCKVECTOR_MAP(blocklist)
static struct subfile_stack * subfile_stack
struct block * allocate_global_block(struct obstack *obstack)
static struct blockvector * make_blockvector(void)
EXTERN int within_function
struct symtab * symbol_symtab(const struct symbol *symbol)
void record_producer(const char *producer)
#define SYMTAB_LINETABLE(symtab)
struct linetable * line_vector
struct macro_table * new_macro_table(struct obstack *obstack, struct bcache *b, struct compunit_symtab *cust)
static char * last_source_file
void do_cleanups(struct cleanup *old_chain)
#define SYMBOL_IS_ARGUMENT(symbol)
struct block * finish_block(struct symbol *symbol, struct pending **listhead, struct pending_block *old_blocks, CORE_ADDR start, CORE_ADDR end)
static struct buildsym_compunit * start_buildsym_compunit(struct objfile *objfile, const char *comp_dir)