X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fdstread.c;h=abcce097a2743b327db8c10860cb462489dfc472;hb=de4112fa387b662c7c7a1dd3e334a1274ca54d28;hp=8ed415bc6c50c9241a82ebb0a9116592c5550685;hpb=96baa820df8126165bd3c4a33c561556b21203af;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/dstread.c b/gdb/dstread.c index 8ed415bc6c..abcce097a2 100644 --- a/gdb/dstread.c +++ b/gdb/dstread.c @@ -1,6 +1,7 @@ /* Read apollo DST symbol tables and convert to internal format, for GDB. Contributed by Troy Rollo, University of NSW (troy@cbme.unsw.edu.au). - Copyright 1993 Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 + Free Software Foundation, Inc. This file is part of GDB. @@ -52,46 +53,33 @@ static int prev_line_number; static int line_vector_length; -static int -init_dst_sections PARAMS ((int)); +static int init_dst_sections (int); -static void -read_dst_symtab PARAMS ((struct objfile *)); +static void read_dst_symtab (struct objfile *); -static void -find_dst_sections PARAMS ((bfd *, sec_ptr, PTR)); +static void find_dst_sections (bfd *, sec_ptr, PTR); -static void -dst_symfile_init PARAMS ((struct objfile *)); +static void dst_symfile_init (struct objfile *); -static void -dst_new_init PARAMS ((struct objfile *)); +static void dst_new_init (struct objfile *); -static void -dst_symfile_read PARAMS ((struct objfile *, int)); +static void dst_symfile_read (struct objfile *, int); -static void -dst_symfile_finish PARAMS ((struct objfile *)); +static void dst_symfile_finish (struct objfile *); -static void -dst_end_symtab PARAMS ((struct objfile *)); +static void dst_end_symtab (struct objfile *); -static void -complete_symtab PARAMS ((char *, CORE_ADDR, unsigned int)); +static void complete_symtab (char *, CORE_ADDR, unsigned int); -static void -dst_start_symtab PARAMS ((void)); +static void dst_start_symtab (void); -static void -dst_record_line PARAMS ((int, CORE_ADDR)); +static void dst_record_line (int, CORE_ADDR); /* Manage the vector of line numbers. */ /* FIXME: Use record_line instead. */ static void -dst_record_line (line, pc) - int line; - CORE_ADDR pc; +dst_record_line (int line, CORE_ADDR pc) { struct linetable_entry *e; /* Make sure line vector is big enough. */ @@ -115,12 +103,12 @@ dst_record_line (line, pc) /* FIXME: use start_symtab, like coffread.c now does. */ static void -dst_start_symtab () +dst_start_symtab (void) { /* Initialize the source file line number information for this file. */ if (line_vector) /* Unlikely, but maybe possible? */ - free ((PTR) line_vector); + xfree (line_vector); line_vector_index = 0; line_vector_length = 1000; prev_line_number = -2; /* Force first line number to be explicit */ @@ -135,10 +123,7 @@ dst_start_symtab () text address for the file, and SIZE is the number of bytes of text. */ static void -complete_symtab (name, start_addr, size) - char *name; - CORE_ADDR start_addr; - unsigned int size; +complete_symtab (char *name, CORE_ADDR start_addr, unsigned int size) { last_source_file = savestring (name, strlen (name)); cur_src_start_addr = start_addr; @@ -159,8 +144,7 @@ complete_symtab (name, start_addr, size) /* FIXME: Use end_symtab, like coffread.c now does. */ static void -dst_end_symtab (objfile) - struct objfile *objfile; +dst_end_symtab (struct objfile *objfile) { register struct symtab *symtab; register struct blockvector *blockvector; @@ -205,8 +189,7 @@ dst_end_symtab (objfile) The ultimate result is a new symtab (or, FIXME, eventually a psymtab). */ static void -dst_symfile_init (objfile) - struct objfile *objfile; +dst_symfile_init (struct objfile *objfile) { asection *section; bfd *abfd = objfile->obfd; @@ -221,10 +204,7 @@ dst_symfile_init (objfile) /* ARGSUSED */ static void -find_dst_sections (abfd, asect, vpinfo) - bfd *abfd; - sec_ptr asect; - PTR vpinfo; +find_dst_sections (bfd *abfd, sec_ptr asect, PTR vpinfo) { int size, count; long base; @@ -263,9 +243,7 @@ static bfd *symfile_bfd; /* ARGSUSED */ static void -dst_symfile_read (objfile, mainline) - struct objfile *objfile; - int mainline; +dst_symfile_read (struct objfile *objfile, int mainline) { bfd *abfd = objfile->obfd; char *name = bfd_get_filename (abfd); @@ -288,7 +266,7 @@ dst_symfile_read (objfile, mainline) error ("\"%s\": error reading debugging symbol tables\n", name); init_minimal_symbol_collection (); - make_cleanup (discard_minimal_symbols, 0); + make_cleanup_discard_minimal_symbols (); /* Now that the executable file is positioned at symbol table, process it and define symbols accordingly. */ @@ -312,8 +290,7 @@ dst_symfile_read (objfile, mainline) } static void -dst_new_init (ignore) - struct objfile *ignore; +dst_new_init (struct objfile *ignore) { /* Nothin' to do */ } @@ -324,8 +301,7 @@ dst_new_init (ignore) objfile struct from the global list of known objfiles. */ static void -dst_symfile_finish (objfile) - struct objfile *objfile; +dst_symfile_finish (struct objfile *objfile) { /* Nothing to do */ } @@ -338,9 +314,7 @@ dst_symfile_finish (objfile) * this is what was really intended. */ static int -get_dst_line (buffer, pc) - signed char **buffer; - long *pc; +get_dst_line (signed char **buffer, long *pc) { static last_pc = 0; static long last_line = 0; @@ -444,18 +418,14 @@ get_dst_line (buffer, pc) } static void -enter_all_lines (buffer, address) - char *buffer; - long address; +enter_all_lines (char *buffer, long address) { if (buffer) while (get_dst_line (&buffer, &address)); } static int -get_dst_entry (buffer, ret_entry) - char *buffer; - dst_rec_ptr_t *ret_entry; +get_dst_entry (char *buffer, dst_rec_ptr_t *ret_entry) { int size; dst_rec_ptr_t entry; @@ -677,10 +647,7 @@ get_dst_entry (buffer, ret_entry) } static int -next_dst_entry (buffer, entry, table) - char **buffer; - dst_rec_ptr_t *entry; - dst_sec *table; +next_dst_entry (char **buffer, dst_rec_ptr_t *entry, dst_sec *table) { if (*buffer - table->buffer >= table->size) { @@ -698,8 +665,7 @@ next_dst_entry (buffer, entry, table) static dst_rec_ptr_t section_table = NULL; char * -get_sec_ref (ref) - dst_sect_ref_t *ref; +get_sec_ref (dst_sect_ref_t *ref) { dst_sec *section = NULL; long offset; @@ -731,8 +697,7 @@ dst_get_addr (int section, long offset) } CORE_ADDR -dst_sym_addr (ref) - dst_sect_ref_t *ref; +dst_sym_addr (dst_sect_ref_t *ref) { if (!section_table || !ref->sect_index) return 0; @@ -740,22 +705,8 @@ dst_sym_addr (ref) + ref->sect_offset; } -static struct type * -create_new_type (objfile) - struct objfile *objfile; -{ - struct type *type; - - type = (struct type *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct type)); - memset (type, 0, sizeof (struct type)); - return type; -} - static struct symbol * -create_new_symbol (objfile, name) - struct objfile *objfile; - char *name; +create_new_symbol (struct objfile *objfile, char *name) { struct symbol *sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); @@ -769,14 +720,11 @@ create_new_symbol (objfile, name) return sym; }; -static struct type * - decode_dst_type PARAMS ((struct objfile *, dst_rec_ptr_t)); +static struct type *decode_dst_type (struct objfile *, dst_rec_ptr_t); static struct type * -decode_type_desc (objfile, type_desc, base) - struct objfile *objfile; - dst_type_t *type_desc; - dst_rec_ptr_t base; +decode_type_desc (struct objfile *objfile, dst_type_t *type_desc, + dst_rec_ptr_t base) { struct type *type; dst_rec_ptr_t entry; @@ -874,8 +822,7 @@ struct structure_list static struct structure_list *struct_list = NULL; static struct type * -find_dst_structure (name) - char *name; +find_dst_structure (char *name) { struct structure_list *element; @@ -887,11 +834,8 @@ find_dst_structure (name) static struct type * -decode_dst_structure (objfile, entry, code, version) - struct objfile *objfile; - dst_rec_ptr_t entry; - int code; - int version; +decode_dst_structure (struct objfile *objfile, dst_rec_ptr_t entry, int code, + int version) { struct type *type, *child_type; char *struct_name; @@ -907,13 +851,13 @@ decode_dst_structure (objfile, entry, code, version) type = find_dst_structure (name); if (type) { - free ((PTR) name); + xfree (name); return type; } - type = create_new_type (objfile); + type = alloc_type (objfile); TYPE_NAME (type) = obstack_copy0 (&objfile->symbol_obstack, name, strlen (name)); - free ((PTR) name); + xfree (name); TYPE_CODE (type) = code; TYPE_LENGTH (type) = DST_record (entry).size; TYPE_NFIELDS (type) = DST_record (entry).nfields; @@ -993,9 +937,7 @@ decode_dst_structure (objfile, entry, code, version) } static struct type * -decode_dst_type (objfile, entry) - struct objfile *objfile; - dst_rec_ptr_t entry; +decode_dst_type (struct objfile *objfile, dst_rec_ptr_t entry) { struct type *child_type, *type, *range_type, *index_type; @@ -1059,9 +1001,7 @@ static struct symbol_list *dst_global_symbols = NULL; static int total_globals = 0; static void -decode_dst_locstring (locstr, sym) - char *locstr; - struct symbol *sym; +decode_dst_locstring (char *locstr, struct symbol *sym) { dst_loc_entry_t *entry, *next_entry; CORE_ADDR temp; @@ -1178,11 +1118,8 @@ decode_dst_locstring (locstr, sym) } static struct symbol_list * -process_dst_symbols (objfile, entry, name, nsyms_ret) - struct objfile *objfile; - dst_rec_ptr_t entry; - char *name; - int *nsyms_ret; +process_dst_symbols (struct objfile *objfile, dst_rec_ptr_t entry, char *name, + int *nsyms_ret) { struct symbol_list *list = NULL, *element; struct symbol *sym; @@ -1320,11 +1257,8 @@ process_dst_symbols (objfile, entry, name, nsyms_ret) static struct symbol * -process_dst_function (objfile, entry, name, address) - struct objfile *objfile; - dst_rec_ptr_t entry; - char *name; - CORE_ADDR address; +process_dst_function (struct objfile *objfile, dst_rec_ptr_t entry, char *name, + CORE_ADDR address) { struct symbol *sym; struct type *type, *ftype; @@ -1361,10 +1295,10 @@ process_dst_function (objfile, entry, name, address) if (!type->function_type) { - ftype = create_new_type (objfile); + ftype = alloc_type (objfile); type->function_type = ftype; - ftype->target_type = type; - ftype->code = TYPE_CODE_FUNC; + TYPE_TARGET_TYPE (ftype) = type; + TYPE_CODE (ftype) = TYPE_CODE_FUNC; } SYMBOL_TYPE (sym) = type->function_type; @@ -1381,9 +1315,7 @@ process_dst_function (objfile, entry, name, address) } static struct block * -process_dst_block (objfile, entry) - struct objfile *objfile; - dst_rec_ptr_t entry; +process_dst_block (struct objfile *objfile, dst_rec_ptr_t entry) { struct block *block; struct symbol *function = NULL; @@ -1459,7 +1391,7 @@ process_dst_block (objfile, entry) block->sym[symnum] = symlist->symbol; - free ((PTR) symlist); + xfree (symlist); symlist = nextsym; symnum++; } @@ -1510,8 +1442,7 @@ process_dst_block (objfile, entry) static void -read_dst_symtab (objfile) - struct objfile *objfile; +read_dst_symtab (struct objfile *objfile) { char *buffer; dst_rec_ptr_t entry, file_table, root_block; @@ -1556,7 +1487,7 @@ read_dst_symtab (objfile) global_block->sym[symnum] = dst_global_symbols->symbol; - free ((PTR) dst_global_symbols); + xfree (dst_global_symbols); dst_global_symbols = nextsym; } dst_global_symbols = NULL; @@ -1593,7 +1524,7 @@ read_dst_symtab (objfile) { element = struct_list; struct_list = element->next; - free ((PTR) element); + xfree (element); } } @@ -1607,9 +1538,7 @@ static unsigned long linetab_size; external (unswapped) format in memory; we'll swap them as we enter them into GDB's data structures. */ static int -init_one_section (chan, secinfo) - int chan; - dst_sec *secinfo; +init_one_section (int chan, dst_sec *secinfo) { if (secinfo->size == 0 || lseek (chan, secinfo->position, 0) == -1 @@ -1621,8 +1550,7 @@ init_one_section (chan, secinfo) } static int -init_dst_sections (chan) - int chan; +init_dst_sections (int chan) { if (!init_one_section (chan, &blocks_info) || @@ -1638,13 +1566,11 @@ init_dst_sections (chan) struct section_offsets dst_symfile_faker = {0}; -struct section_offsets * -dst_symfile_offsets (objfile, addr) - struct objfile *objfile; - CORE_ADDR addr; +void +dst_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs) { objfile->num_sections = 1; - return &dst_symfile_faker; + objfile->section_offsets = &dst_symfile_faker; } /* Register our ability to parse symbols for DST BFD files */ @@ -1664,7 +1590,7 @@ static struct sym_fns dst_sym_fns = }; void -_initialize_dstread () +_initialize_dstread (void) { add_symtab_fns (&dst_sym_fns); }