From: Kevin Buettner Date: Tue, 17 Dec 2002 00:39:08 +0000 (+0000) Subject: Replace complain() with complaint(). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=231367095d5e01a7e3489d8333b43b94d2e1c58a;p=binutils-gdb.git Replace complain() with complaint(). --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b7e6d203a21..555027b40be 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,136 @@ +2002-12-16 Kevin Buettner + + * buildsym.c (block_end_complaint, anon_block_end_complaint) + (innerblock_complaint, innerblock_anon_complaint) + (blockvector_complaint): Delete deprecated complaint structs. + (finish_block, make_blockvector, end_symtab): Replace calls + to complain() with calls to complaint(). + * coffread.c (ef_complaint, ef_stack_complaint, eb_stack_complaint) + (bf_no_aux_complaint, ef_no_aux_complaint, lineno_complaint) + (unexpected_type_complaint, bad_sclass_complaint) + (misordered_blocks_complaint, tagndx_bad_complaint, eb_complaint): + Delete deprecated complaint structs. + (coff_symtab_read, enter_linenos, decode_type, decode_base_type): + Replace calls to complain() with calls to complaint(). + * dbxread.c (lbrac_complaint, string_table_offset_complaint) + (unknown_symtype_complaint, unknown_symchar_complaint) + (lbrac_rbrac_complaint, lbrac_unmatched_complaint) + (lbrac_mismatch_complaint, repeated_header_complaint) + (unclaimed_bincl_complaint, discarding_local_symbols_complaint): + Delete deprecated complaint structs. + (unknown_symtype_complaint, lbrac_mismatch_complaint) + (repeated_header_complaint) + (function_outside_compiliation_unit_complaint): New functions. + (add_old_header_file, find_corresponding_bincl_psymtab) + (set_namestring, find_stab_function_addr, read_dbx_symtab) + (process_one_symbol): Replace calls to complain() with, possibly + indirect, calls to complaint(). + * dwarfread.c (no_bfd_get_N, malformed_die, bad_die_ref) + (unknown_attribute_form, unknown_attribute_length) + (unexpected_fund_type, unknown_type_modifier, volatile_ignored) + (const_ignored, botched_modified_type, op_deref2, op_deref4) + (basereg_not_handled, dup_user_type_allocation) + (dup_user_type_definition, missing_tag, bad_array_element_type) + (subscript_data_items, unhandled_array_subscript_format) + (unknown_array_subscript_format, not_row_major) + (missing_at_name): Delete deprecated complaint structs. + (bad_die_ref_complaint, unknown_attribute_form_complaint) + (dup_user_type_definition_complaint) + (bad_array_element_type_complaint): New functions. + (lookup_utype, alloc_utype, struct_type, decode_array_element_type) + (decode_subscript_data_item, dwarf_read_array_type) + (read_tag_string_type, read_subroutine_type, read_func_scope) + (locval, scan_partial_symbols, decode_modified_type) + (decode_func_type, basicdieinfo, completeddieinfo, target_to_host) + (attribute_size): Replace calls to complain() with, possibly + indirect, calls to complaint(). + * elfread.c (section_info_complaint, section_info_dup_complaint) + (stab_info_mismatch_complaint, stab_info_questionable_complaint): + Delete deprecated complaint structs. + (elf_symtab_read, elfstab_offset_sections): Replace calls to + complain() with calls to complaint(). + * gdbtypes.c (stub_noname_complaint): Delete deprecated complaint + struct. + (stub_noname_complaint): New function. + (check_typedef, add_mangled_type): Replace calls to complain() + with calls to complaint(). + * hpread.c (string_table_offset_complaint, lbrac_unmatched_complaint) + (lbrac_mismatch_complaint, hpread_unhandled_end_common_complaint) + (hpread_unhandled_type_complaint, hpread_struct_complaint) + (hpread_array_complaint, hpread_type_lookup_complaint) + (hpread_unexpected_end_complaint, hpread_tagdef_complaint) + (hpread_unhandled_common_complaint) + (hpread_unhandled_blockdata_complaint): Delete deprecated complaint + struct definitions and declarations. + (lbrac_unmatched_complaint, lbrac_mismatch_complaint): New functions. + (SET_NAMESTRING, hpread_type_lookup, hpread_process_one_debug_symbol): + Replace calls to complain() with, possibly indirect, calls to + complaint(). + * macrotab.c (macro_include, check_for_redefinition, macro_undef): + Likewise. + * mdebugread.c (bad_file_number_complaint, index_complaint) + (aux_index_complaint, block_index_complaint) + (unknown_ext_complaint, unknown_sym_complaint) + (unknown_st_complaint, block_overflow_complaint) + (basic_type_complaint, unknown_type_qual_complaint) + (array_index_type_complaint, bad_tag_guess_complaint) + (block_member_complaint, stEnd_complaint) + (unknown_mdebug_symtype_complaint, stab_unknown_complaint) + (pdr_for_nonsymbol_complaint, pdr_static_symbol_complaint) + (bad_setjmp_pdr_complaint, bad_fbitfield_complaint) + (bad_continued_complaint, bad_rfd_entry_complaint) + (unexpected_type_code_complaint, unable_to_cross_ref_complaint) + (bad_indirect_xref_complaint, illegal_forward_tq0_complaint) + (illegal_forward_bt_complaint, bad_linetable_guess_complaint) + (bad_ext_ifd_complaint, bad_ext_iss_complaint): Delete deprecated + complaint structs. + (index_complaint, unknown_ext_complaint, basic_type_complaint) + (bad_tag_guess_complaint, bad_rfd_entry_complaint) + (unexpected_type_code_complaint) + (function_outside_compilation_unit_complaint): New functions. + (parse_symbol, parse_type, upgrade_type, parse_procedure) + (parse_partial_symbols, psymtab_to_symtab_1, cross_ref, add_symbol): + Replace calls to complain() with, possibly indirect calls to + complaint(). + * objc-lang.c (noclass_lookup_complaint, nosel_lookup_complaint): + Delete deprecated complaint structs. + (lookup__objc_class, lookup_child_selector): Replace complain() + with complaint(). + * remote-vx.c (cant_contact_target): Delete deprecated complaint + struct. + (vx_lookup_symbol): Replace complain() with complaint(). + * stabsread.c (invalid_cpp_abbrev_complaint) + (invalid_cpp_type_complaint, member_fn_complaint) + (const_vol_complaint, error_type_complaint) + (invalid_member_complaint, range_type_base_complaint) + (reg_value_complaint, vtbl_notfound_complaint) + (unrecognized_cplus_name_complaint, rs6000_builtin_complaint) + (unresolved_sym_chain_complaint, stabs_general_complaint) + (lrs_general_complaint, multiply_defined_struct): Delete + deprecated complaint structs. + (invalid_cpp_abbrev_complaint, ref_value_complaint) + (stabs_general_complaint, lrs_general_complaint) + (msg_unknown_complaint): New functions. + (dbx_lookup_type, read_cfront_baseclasses) + (read_cfront_member_functions, resolve_symbol_reference) + (define_symbol, resolve_live_range, add_live_range, read_type) + (rs6000_builtin_type, read_member_functions, read_cpp_abbrev) + (read_one_struct_field, read_baseclasses, read_tilde_fields) + (read_cfront_static_fields, attach_fields_to_type) + (complain_about_struct_wipeout, read_range_type) + (common_block_start, common_block_end, cleanup_undefined_types) + (scan_file_globals): Replace complain() with complaint(). + * stabsread.h (unknown_symtype_complaint, unknown_symchar_complaint): + Delete deprecated complaint struct declarations. + * xcoffread.c (storclass_complaint, bf_notfound_complaint) + (ef_complaint, eb_complaint): Delete deprecated complaint structs. + (bf_not_found_complaint, ef_complaint, eb_complaint) + (function_outside_compilation_unit_complaint): New functions. + (record_include_begin, record_include_end, enter_line_range) + (xcoff_next_symbol_text, read_xcoff_symtab, process_xcoff_symbol) + (read_symbol, read_symbol_lineno, scan_xcoff_symtab) Replace + complain() with complaint(). + 2002-12-16 Andrew Cagney * config/arc/arc.mt, config/arc/tm-arc.h: Delete. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index fb2d5a0ad86..8fdba5e28e0 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -73,23 +73,6 @@ static int compare_line_numbers (const void *ln1p, const void *ln2p); #define INITIAL_LINE_VECTOR_LENGTH 1000 -/* Complaints about the symbols we have encountered. */ - -struct deprecated_complaint block_end_complaint = -{"block end address less than block start address in %s (patched it)", 0, 0}; - -struct deprecated_complaint anon_block_end_complaint = -{"block end address 0x%lx less than block start address 0x%lx (patched it)", 0, 0}; - -struct deprecated_complaint innerblock_complaint = -{"inner block not inside outer block in %s", 0, 0}; - -struct deprecated_complaint innerblock_anon_complaint = -{"inner block (0x%lx-0x%lx) not inside outer block (0x%lx-0x%lx)", 0, 0}; - -struct deprecated_complaint blockvector_complaint = -{"block at %s out of order", 0, 0}; - /* maintain the lists of symbols and blocks */ /* Add a pending list to free_pendings. */ @@ -408,11 +391,15 @@ finish_block (struct symbol *symbol, struct pending **listhead, { if (symbol) { - complain (&block_end_complaint, SYMBOL_SOURCE_NAME (symbol)); + complaint (&symfile_complaints, + "block end address less than block start address in %s (patched it)", + SYMBOL_SOURCE_NAME (symbol)); } else { - complain (&anon_block_end_complaint, BLOCK_END (block), BLOCK_START (block)); + complaint (&symfile_complaints, + "block end address 0x%s less than block start address 0x%s (patched it)", + paddr_nz (BLOCK_END (block)), paddr_nz (BLOCK_START (block))); } /* Better than nothing */ BLOCK_END (block) = BLOCK_START (block); @@ -438,14 +425,18 @@ finish_block (struct symbol *symbol, struct pending **listhead, { if (symbol) { - complain (&innerblock_complaint, - SYMBOL_SOURCE_NAME (symbol)); + complaint (&symfile_complaints, + "inner block not inside outer block in %s", + SYMBOL_SOURCE_NAME (symbol)); } else { - complain (&innerblock_anon_complaint, BLOCK_START (pblock->block), - BLOCK_END (pblock->block), BLOCK_START (block), - BLOCK_END (block)); + complaint (&symfile_complaints, + "inner block (0x%s-0x%s) not inside outer block (0x%s-0x%s)", + paddr_nz (BLOCK_START (pblock->block)), + paddr_nz (BLOCK_END (pblock->block)), + paddr_nz (BLOCK_START (block)), + paddr_nz (BLOCK_END (block))); } if (BLOCK_START (pblock->block) < BLOCK_START (block)) BLOCK_START (pblock->block) = BLOCK_START (block); @@ -550,8 +541,8 @@ make_blockvector (struct objfile *objfile) CORE_ADDR start = BLOCK_START (BLOCKVECTOR_BLOCK (blockvector, i)); - complain (&blockvector_complaint, - local_hex_string ((LONGEST) start)); + complaint (&symfile_complaints, "block at %s out of order", + local_hex_string ((LONGEST) start)); } } } @@ -870,9 +861,8 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) same. FIXME: Find out why it is happening. This is not believed to happen in most cases (even for coffread.c); it used to be an abort(). */ - static struct deprecated_complaint msg = - {"Context stack not empty in end_symtab", 0, 0}; - complain (&msg); + complaint (&symfile_complaints, + "Context stack not empty in end_symtab"); context_stack_depth = 0; } } diff --git a/gdb/coffread.c b/gdb/coffread.c index 7872624b682..573306d6e0a 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -122,41 +122,6 @@ static int pe_file; static struct symbol *opaque_type_chain[HASHSIZE]; -/* Complaints about various problems in the file being read */ - -struct deprecated_complaint ef_complaint = -{"Unmatched .ef symbol(s) ignored starting at symnum %d", 0, 0}; - -struct deprecated_complaint ef_stack_complaint = -{"`.ef' symbol without matching `.bf' symbol ignored starting at symnum %d", 0, 0}; - -struct deprecated_complaint eb_stack_complaint = -{"`.eb' symbol without matching `.bb' symbol ignored starting at symnum %d", 0, 0}; - -struct deprecated_complaint bf_no_aux_complaint = -{"`.bf' symbol %d has no aux entry", 0, 0}; - -struct deprecated_complaint ef_no_aux_complaint = -{"`.ef' symbol %d has no aux entry", 0, 0}; - -struct deprecated_complaint lineno_complaint = -{"Line number pointer %d lower than start of line numbers", 0, 0}; - -struct deprecated_complaint unexpected_type_complaint = -{"Unexpected type for symbol %s", 0, 0}; - -struct deprecated_complaint bad_sclass_complaint = -{"Bad n_sclass for symbol %s", 0, 0}; - -struct deprecated_complaint misordered_blocks_complaint = -{"Blocks out of order at address %x", 0, 0}; - -struct deprecated_complaint tagndx_bad_complaint = -{"Symbol table entry for %s has bad tagndx value", 0, 0}; - -struct deprecated_complaint eb_complaint = -{"Mismatched .eb symbol ignored starting at symnum %d", 0, 0}; - /* Simplified internal version of coff symbol table information */ struct coff_symbol @@ -821,7 +786,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, case C_LINE: case C_ALIAS: case C_HIDDEN: - complain (&bad_sclass_complaint, cs->c_name); + complaint (&symfile_complaints, "Bad n_sclass for symbol %s", + cs->c_name); break; case C_FILE: @@ -987,7 +953,8 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, /* main_aux.x_sym.x_misc.x_lnsz.x_lnno contains line number of '{' } */ if (cs->c_naux != 1) - complain (&bf_no_aux_complaint, cs->c_symnum); + complaint (&symfile_complaints, + "`.bf' symbol %d has no aux entry", cs->c_symnum); fcn_first_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno; fcn_first_line_addr = cs->c_value; @@ -1011,7 +978,9 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, if (context_stack_depth <= 0) { /* We attempted to pop an empty context stack */ - complain (&ef_stack_complaint, cs->c_symnum); + complaint (&symfile_complaints, + "`.ef' symbol without matching `.bf' symbol ignored starting at symnum %d", + cs->c_symnum); within_function = 0; break; } @@ -1020,13 +989,16 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, /* Stack must be empty now. */ if (context_stack_depth > 0 || new == NULL) { - complain (&ef_complaint, cs->c_symnum); + complaint (&symfile_complaints, + "Unmatched .ef symbol(s) ignored starting at symnum %d", + cs->c_symnum); within_function = 0; break; } if (cs->c_naux != 1) { - complain (&ef_no_aux_complaint, cs->c_symnum); + complaint (&symfile_complaints, + "`.ef' symbol %d has no aux entry", cs->c_symnum); fcn_last_line = 0x7FFFFFFF; } else @@ -1081,14 +1053,18 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms, { if (context_stack_depth <= 0) { /* We attempted to pop an empty context stack */ - complain (&eb_stack_complaint, cs->c_symnum); + complaint (&symfile_complaints, + "`.eb' symbol without matching `.bb' symbol ignored starting at symnum %d", + cs->c_symnum); break; } new = pop_context (); if (depth-- != new->depth) { - complain (&eb_complaint, symnum); + complaint (&symfile_complaints, + "Mismatched .eb symbol ignored starting at symnum %d", + symnum); break; } if (local_symbols && context_stack_depth > 0) @@ -1367,7 +1343,9 @@ enter_linenos (long file_offset, register int first_line, return; if (file_offset < linetab_offset) { - complain (&lineno_complaint, file_offset); + complaint (&symfile_complaints, + "Line number pointer %ld lower than start of line numbers", + file_offset); if (file_offset > linetab_size) /* Too big to be an offset? */ return; file_offset += linetab_offset; /* Try reading at that linetab offset */ @@ -1772,7 +1750,9 @@ decode_type (register struct coff_symbol *cs, unsigned int c_type, } else { - complain (&tagndx_bad_complaint, cs->c_name); + complaint (&symfile_complaints, + "Symbol table entry for %s has bad tagndx value", + cs->c_name); /* And fall through to decode_base_type... */ } } @@ -1938,7 +1918,7 @@ decode_base_type (register struct coff_symbol *cs, unsigned int c_type, else return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG); } - complain (&unexpected_type_complaint, cs->c_name); + complaint (&symfile_complaints, "Unexpected type for symbol %s", cs->c_name); return lookup_fundamental_type (current_objfile, FT_VOID); } diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 538f076a6f7..4fcb96889ed 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -167,36 +167,27 @@ static int has_line_numbers; /* Complaints about the symbols we have encountered. */ -struct deprecated_complaint lbrac_complaint = -{"bad block start address patched", 0, 0}; - -struct deprecated_complaint string_table_offset_complaint = -{"bad string table offset in symbol %d", 0, 0}; - -struct deprecated_complaint unknown_symtype_complaint = -{"unknown symbol type %s", 0, 0}; - -struct deprecated_complaint unknown_symchar_complaint = -{"unknown symbol descriptor `%c'", 0, 0}; - -struct deprecated_complaint lbrac_rbrac_complaint = -{"block start larger than block end", 0, 0}; - -struct deprecated_complaint lbrac_unmatched_complaint = -{"unmatched N_LBRAC before symtab pos %d", 0, 0}; - -struct deprecated_complaint lbrac_mismatch_complaint = -{"N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d", 0, 0}; +static void +unknown_symtype_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "unknown symbol type %s", arg1); +} -struct deprecated_complaint repeated_header_complaint = -{"\"repeated\" header file %s not previously seen, at symtab pos %d", 0, 0}; +static void +lbrac_mismatch_complaint (int arg1) +{ + complaint (&symfile_complaints, + "N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d", arg1); +} -struct deprecated_complaint unclaimed_bincl_complaint = -{"N_BINCL %s not in entries for any file, at symtab pos %d", 0, 0}; +static void +repeated_header_complaint (const char *arg1, int arg2) +{ + complaint (&symfile_complaints, + "\"repeated\" header file %s not previously seen, at symtab pos %d", + arg1, arg2); +} -struct deprecated_complaint discarding_local_symbols_complaint = -{"misplaced N_LBRAC entry; discarding local symbols which have no enclosing block", 0, 0}; - /* find_text_range --- find start and end of loadable code sections The find_text_range function finds the shortest address range that @@ -367,7 +358,7 @@ add_old_header_file (char *name, int instance) add_this_object_header_file (i); return; } - complain (&repeated_header_complaint, name, symnum); + repeated_header_complaint (name, symnum); } /* Add to this file a "new" header file: definitions for its types follow. @@ -1022,7 +1013,7 @@ find_corresponding_bincl_psymtab (char *name, int instance) && STREQ (name, bincl->name)) return bincl->pst; - complain (&repeated_header_complaint, name, symnum); + repeated_header_complaint (name, symnum); return (struct partial_symtab *) 0; } @@ -1059,7 +1050,8 @@ set_namestring (struct objfile *objfile, struct internal_nlist nlist) if (((unsigned) nlist.n_strx + file_string_table_offset) >= DBX_STRINGTAB_SIZE (objfile)) { - complain (&string_table_offset_complaint, symnum); + complaint (&symfile_complaints, "bad string table offset in symbol %d", + symnum); namestring = ""; } else @@ -1256,6 +1248,14 @@ find_stab_function_addr (char *namestring, char *filename, } #endif /* SOFUN_ADDRESS_MAYBE_MISSING */ +static void +function_outside_compilation_unit_complaint (const char *arg1) +{ + complaint (&symfile_complaints, + "function `%s' appears to be defined outside of all compilation units", + arg1); +} + /* Setup partial_symtab's describing each source file for which debugging information is available. */ @@ -1360,9 +1360,6 @@ read_dbx_symtab (struct objfile *objfile) switch (nlist.n_type) { - static struct deprecated_complaint function_outside_compilation_unit = { - "function `%s' appears to be defined outside of all compilation units", 0, 0 - }; char *p; /* * Standard, external, non-debugger, symbols @@ -1613,7 +1610,9 @@ read_dbx_symtab (struct objfile *objfile) { /* FIXME: we should not get here without a PST to work on. Attempt to recover. */ - complain (&unclaimed_bincl_complaint, namestring, symnum); + complaint (&symfile_complaints, + "N_BINCL %s not in entries for any file, at symtab pos %d", + namestring, symnum); continue; } add_bincl_to_list (pst, namestring, nlist.n_value); @@ -1887,7 +1886,7 @@ read_dbx_symtab (struct objfile *objfile) char *name = xmalloc (name_len + 1); memcpy (name, namestring, name_len); name[name_len] = '\0'; - complain (&function_outside_compilation_unit, name); + function_outside_compilation_unit_complaint (name); xfree (name); } nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -1952,7 +1951,7 @@ read_dbx_symtab (struct objfile *objfile) char *name = xmalloc (name_len + 1); memcpy (name, namestring, name_len); name[name_len] = '\0'; - complain (&function_outside_compilation_unit, name); + function_outside_compilation_unit_complaint (name); xfree (name); } nlist.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -2047,7 +2046,8 @@ read_dbx_symtab (struct objfile *objfile) time searching to the end of every string looking for a backslash. */ - complain (&unknown_symchar_complaint, p[1]); + complaint (&symfile_complaints, "unknown symbol descriptor `%c'", + p[1]); /* Ignore it; perhaps it is an extension that we don't know about. */ @@ -2161,8 +2161,7 @@ read_dbx_symtab (struct objfile *objfile) default: /* If we haven't found it yet, ignore it. It's probably some new type we don't know about yet. */ - complain (&unknown_symtype_complaint, - local_hex_string (nlist.n_type)); + unknown_symtype_complaint (local_hex_string (nlist.n_type)); continue; } } @@ -2777,7 +2776,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, if (context_stack_depth <= 0) { - complain (&lbrac_mismatch_complaint, symnum); + lbrac_mismatch_complaint (symnum); break; } @@ -2827,7 +2826,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, if (!SUN_FIXED_LBRAC_BUG && valu < last_pc_address) { /* Patch current LBRAC pc value to match last handy pc value */ - complain (&lbrac_complaint); + complaint (&symfile_complaints, "bad block start address patched"); valu = last_pc_address; } #endif @@ -2852,13 +2851,13 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, if (context_stack_depth <= 0) { - complain (&lbrac_mismatch_complaint, symnum); + lbrac_mismatch_complaint (symnum); break; } new = pop_context (); if (desc != new->depth) - complain (&lbrac_mismatch_complaint, symnum); + lbrac_mismatch_complaint (symnum); /* Some compilers put the variable decls inside of an LBRAC/RBRAC block. This macro should be nonzero if this @@ -2883,7 +2882,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, symbols within an LBRAC/RBRAC block; this complaint might also help sort out problems in which VARIABLES_INSIDE_BLOCK is incorrectly defined. */ - complain (&discarding_local_symbols_complaint); + complaint (&symfile_complaints, + "misplaced N_LBRAC entry; discarding local symbols which have no enclosing block"); } local_symbols = new->locals; } @@ -2903,7 +2903,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, compilers? Is this ever harmful?). */ if (new->start_addr > valu) { - complain (&lbrac_rbrac_complaint); + complaint (&symfile_complaints, + "block start larger than block end"); new->start_addr = valu; } /* Make a block for the local symbols within. */ @@ -3127,7 +3128,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, case N_NBBSS: case N_NBSTS: case N_NBLCS: - complain (&unknown_symtype_complaint, local_hex_string (type)); + unknown_symtype_complaint (local_hex_string (type)); /* FALLTHROUGH */ /* The following symbol types don't need the address field relocated, @@ -3239,7 +3240,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name, if (context_stack_depth > 1) { - complain (&lbrac_unmatched_complaint, symnum); + complaint (&symfile_complaints, + "unmatched N_LBRAC before symtab pos %d", symnum); break; } diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index f8254c95068..f797fc54973 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -62,115 +62,37 @@ /* Complaints that can be issued during DWARF debug info reading. */ -struct deprecated_complaint no_bfd_get_N = -{ - "DIE @ 0x%x \"%s\", no bfd support for %d byte data object", 0, 0 -}; - -struct deprecated_complaint malformed_die = -{ - "DIE @ 0x%x \"%s\", malformed DIE, bad length (%d bytes)", 0, 0 -}; - -struct deprecated_complaint bad_die_ref = -{ - "DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit", 0, 0 -}; - -struct deprecated_complaint unknown_attribute_form = -{ - "DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", 0, 0 -}; - -struct deprecated_complaint unknown_attribute_length = -{ - "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes", 0, 0 -}; - -struct deprecated_complaint unexpected_fund_type = -{ - "DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x", 0, 0 -}; - -struct deprecated_complaint unknown_type_modifier = -{ - "DIE @ 0x%x \"%s\", unknown type modifier %u", 0, 0 -}; - -struct deprecated_complaint volatile_ignored = -{ - "DIE @ 0x%x \"%s\", type modifier 'volatile' ignored", 0, 0 -}; - -struct deprecated_complaint const_ignored = -{ - "DIE @ 0x%x \"%s\", type modifier 'const' ignored", 0, 0 -}; - -struct deprecated_complaint botched_modified_type = -{ - "DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)", 0, 0 -}; - -struct deprecated_complaint op_deref2 = -{ - "DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%x not handled", 0, 0 -}; - -struct deprecated_complaint op_deref4 = -{ - "DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%x not handled", 0, 0 -}; - -struct deprecated_complaint basereg_not_handled = -{ - "DIE @ 0x%x \"%s\", BASEREG %d not handled", 0, 0 -}; - -struct deprecated_complaint dup_user_type_allocation = -{ - "DIE @ 0x%x \"%s\", internal error: duplicate user type allocation", 0, 0 -}; - -struct deprecated_complaint dup_user_type_definition = -{ - "DIE @ 0x%x \"%s\", internal error: duplicate user type definition", 0, 0 -}; - -struct deprecated_complaint missing_tag = -{ - "DIE @ 0x%x \"%s\", missing class, structure, or union tag", 0, 0 -}; - -struct deprecated_complaint bad_array_element_type = -{ - "DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", 0, 0 -}; - -struct deprecated_complaint subscript_data_items = -{ - "DIE @ 0x%x \"%s\", can't decode subscript data items", 0, 0 -}; - -struct deprecated_complaint unhandled_array_subscript_format = +static void +bad_die_ref_complaint (int arg1, const char *arg2, int arg3) { - "DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet", 0, 0 -}; + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit", + arg1, arg2, arg3); +} -struct deprecated_complaint unknown_array_subscript_format = +static void +unknown_attribute_form_complaint (int arg1, const char *arg2, int arg3) { - "DIE @ 0x%x \"%s\", unknown array subscript format %x", 0, 0 -}; + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", arg1, arg2, + arg3); +} -struct deprecated_complaint not_row_major = +static void +dup_user_type_definition_complaint (int arg1, const char *arg2) { - "DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0 -}; + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", internal error: duplicate user type definition", + arg1, arg2); +} -struct deprecated_complaint missing_at_name = +static void +bad_array_element_type_complaint (int arg1, const char *arg2, int arg3) { - "DIE @ 0x%x, AT_name tag missing", 0, 0 -}; + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", arg1, + arg2, arg3); +} typedef unsigned int DIE_REF; /* Reference to a DIE */ @@ -786,7 +708,7 @@ lookup_utype (DIE_REF die_ref) utypeidx = (die_ref - dbroff) / 4; if ((utypeidx < 0) || (utypeidx >= numutypes)) { - complain (&bad_die_ref, DIE_ID, DIE_NAME); + bad_die_ref_complaint (DIE_ID, DIE_NAME, die_ref); } else { @@ -828,12 +750,14 @@ alloc_utype (DIE_REF die_ref, struct type *utypep) if ((utypeidx < 0) || (utypeidx >= numutypes)) { utypep = dwarf_fundamental_type (current_objfile, FT_INTEGER); - complain (&bad_die_ref, DIE_ID, DIE_NAME); + bad_die_ref_complaint (DIE_ID, DIE_NAME, die_ref); } else if (*typep != NULL) { utypep = *typep; - complain (&dup_user_type_allocation, DIE_ID, DIE_NAME); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", internal error: duplicate user type allocation", + DIE_ID, DIE_NAME); } else { @@ -978,7 +902,9 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie, default: /* Should never happen */ TYPE_CODE (type) = TYPE_CODE_UNDEF; - complain (&missing_tag, DIE_ID, DIE_NAME); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", missing class, structure, or union tag", + DIE_ID, DIE_NAME); break; } /* Some compilers try to be helpful by inventing "fake" names for @@ -1191,7 +1117,7 @@ decode_array_element_type (char *scan) scan += SIZEOF_ATTRIBUTE; if ((nbytes = attribute_size (attribute)) == -1) { - complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute); + bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute); typep = dwarf_fundamental_type (current_objfile, FT_INTEGER); } else @@ -1218,7 +1144,7 @@ decode_array_element_type (char *scan) typep = decode_mod_u_d_type (scan); break; default: - complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute); + bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute); typep = dwarf_fundamental_type (current_objfile, FT_INTEGER); break; } @@ -1306,7 +1232,9 @@ decode_subscript_data_item (char *scan, char *end) if (nexttype == NULL) { /* Munged subscript data or other problem, fake it. */ - complain (&subscript_data_items, DIE_ID, DIE_NAME); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", can't decode subscript data items", + DIE_ID, DIE_NAME); nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER); } rangetype = create_range_type ((struct type *) NULL, indextype, @@ -1320,13 +1248,17 @@ decode_subscript_data_item (char *scan, char *end) case FMT_UT_C_X: case FMT_UT_X_C: case FMT_UT_X_X: - complain (&unhandled_array_subscript_format, DIE_ID, DIE_NAME, format); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet", + DIE_ID, DIE_NAME, format); nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER); rangetype = create_range_type ((struct type *) NULL, nexttype, 0, 0); typep = create_array_type ((struct type *) NULL, nexttype, rangetype); break; default: - complain (&unknown_array_subscript_format, DIE_ID, DIE_NAME, format); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", unknown array subscript format %x", DIE_ID, + DIE_NAME, format); nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER); rangetype = create_range_type ((struct type *) NULL, nexttype, 0, 0); typep = create_array_type ((struct type *) NULL, nexttype, rangetype); @@ -1364,7 +1296,9 @@ dwarf_read_array_type (struct dieinfo *dip) if (dip->at_ordering != ORD_row_major) { /* FIXME: Can gdb even handle column major arrays? */ - complain (¬_row_major, DIE_ID, DIE_NAME); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", array not row major; not handled correctly", + DIE_ID, DIE_NAME); } if ((sub = dip->at_subscr_data) != NULL) { @@ -1394,7 +1328,7 @@ dwarf_read_array_type (struct dieinfo *dip) { /* Double ick! Not only is a type already in our slot, but someone has decorated it. Complain and leave it alone. */ - complain (&dup_user_type_definition, DIE_ID, DIE_NAME); + dup_user_type_definition_complaint (DIE_ID, DIE_NAME); } } } @@ -1492,7 +1426,7 @@ read_tag_string_type (struct dieinfo *dip) is a blank one. If not, complain and leave it alone. */ if (TYPE_CODE (utype) != TYPE_CODE_UNDEF) { - complain (&dup_user_type_definition, DIE_ID, DIE_NAME); + dup_user_type_definition_complaint (DIE_ID, DIE_NAME); return; } } @@ -1558,7 +1492,7 @@ read_subroutine_type (struct dieinfo *dip, char *thisdie, char *enddie) } else { - complain (&dup_user_type_definition, DIE_ID, DIE_NAME); + dup_user_type_definition_complaint (DIE_ID, DIE_NAME); } } @@ -1774,7 +1708,8 @@ read_func_scope (struct dieinfo *dip, char *thisdie, char *enddie, FIXME: Add code to handle AT_abstract_origin tags properly. */ if (dip->at_name == NULL) { - complain (&missing_at_name, DIE_ID); + complaint (&symfile_complaints, "DIE @ 0x%x, AT_name tag missing", + DIE_ID); return; } @@ -2208,10 +2143,14 @@ locval (struct dieinfo *dip) break; case OP_DEREF2: /* pop, deref and push 2 bytes (as a long) */ - complain (&op_deref2, DIE_ID, DIE_NAME, stack[stacki]); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%lx not handled", + DIE_ID, DIE_NAME, stack[stacki]); break; case OP_DEREF4: /* pop, deref and push 4 bytes (as a long) */ - complain (&op_deref4, DIE_ID, DIE_NAME, stack[stacki]); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%lx not handled", + DIE_ID, DIE_NAME, stack[stacki]); break; case OP_ADD: /* pop top 2 items, add, push result */ stack[stacki - 1] += stack[stacki]; @@ -2661,8 +2600,8 @@ scan_partial_symbols (char *thisdie, char *enddie, struct objfile *objfile) temp = dbbase + di.at_sibling - dbroff; if ((temp < thisdie) || (temp >= enddie)) { - complain (&bad_die_ref, DIE_ID, DIE_NAME, - di.at_sibling); + bad_die_ref_complaint (DIE_ID, DIE_NAME, + di.at_sibling); } else { @@ -3180,7 +3119,9 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype) } break; default: - complain (&botched_modified_type, DIE_ID, DIE_NAME, mtype); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)", + DIE_ID, DIE_NAME, mtype); typep = dwarf_fundamental_type (current_objfile, FT_INTEGER); break; } @@ -3198,16 +3139,22 @@ decode_modified_type (char *modifiers, unsigned int modcount, int mtype) typep = lookup_reference_type (typep); break; case MOD_const: - complain (&const_ignored, DIE_ID, DIE_NAME); /* FIXME */ + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", type modifier 'const' ignored", DIE_ID, + DIE_NAME); /* FIXME */ break; case MOD_volatile: - complain (&volatile_ignored, DIE_ID, DIE_NAME); /* FIXME */ + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", type modifier 'volatile' ignored", + DIE_ID, DIE_NAME); /* FIXME */ break; default: if (!(MOD_lo_user <= (unsigned char) modifier && (unsigned char) modifier <= MOD_hi_user)) { - complain (&unknown_type_modifier, DIE_ID, DIE_NAME, modifier); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", unknown type modifier %u", DIE_ID, + DIE_NAME, modifier); } break; } @@ -3349,7 +3296,9 @@ decode_fund_type (unsigned int fundtype) typep = dwarf_fundamental_type (current_objfile, FT_INTEGER); if (!(FT_lo_user <= fundtype && fundtype <= FT_hi_user)) { - complain (&unexpected_fund_type, DIE_ID, DIE_NAME, fundtype); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x", + DIE_ID, DIE_NAME, fundtype); } } @@ -3447,7 +3396,9 @@ basicdieinfo (struct dieinfo *dip, char *diep, struct objfile *objfile) if ((dip->die_length < SIZEOF_DIE_LENGTH) || ((diep + dip->die_length) > (dbbase + dbsize))) { - complain (&malformed_die, DIE_ID, DIE_NAME, dip->die_length); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", malformed DIE, bad length (%ld bytes)", + DIE_ID, DIE_NAME, dip->die_length); dip->die_length = 0; } else if (dip->die_length < (SIZEOF_DIE_LENGTH + SIZEOF_DIE_TAG)) @@ -3513,7 +3464,9 @@ completedieinfo (struct dieinfo *dip, struct objfile *objfile) diep += SIZEOF_ATTRIBUTE; if ((nbytes = attribute_size (attr)) == -1) { - complain (&unknown_attribute_length, DIE_ID, DIE_NAME); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes", + DIE_ID, DIE_NAME); diep = end; continue; } @@ -3670,7 +3623,7 @@ completedieinfo (struct dieinfo *dip, struct objfile *objfile) diep += strlen (diep) + 1; break; default: - complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form); + unknown_attribute_form_complaint (DIE_ID, DIE_NAME, form); diep = end; break; } @@ -3727,7 +3680,9 @@ target_to_host (char *from, int nbytes, int signextend, /* FIXME: Unused */ rtnval = bfd_get_8 (objfile->obfd, (bfd_byte *) from); break; default: - complain (&no_bfd_get_N, DIE_ID, DIE_NAME, nbytes); + complaint (&symfile_complaints, + "DIE @ 0x%x \"%s\", no bfd support for %d byte data object", + DIE_ID, DIE_NAME, nbytes); rtnval = 0; break; } @@ -3782,7 +3737,7 @@ attribute_size (unsigned int attr) nbytes = TARGET_FT_POINTER_SIZE (objfile); break; default: - complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form); + unknown_attribute_form_complaint (DIE_ID, DIE_NAME, form); nbytes = -1; break; } diff --git a/gdb/elfread.c b/gdb/elfread.c index a29a71b544d..ba8fc490a7d 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -52,20 +52,6 @@ struct elfinfo asection *mdebugsect; /* Section pointer for .mdebug section */ }; -/* Various things we might complain about... */ - -struct deprecated_complaint section_info_complaint = -{"elf/stab section information %s without a preceding file symbol", 0, 0}; - -struct deprecated_complaint section_info_dup_complaint = -{"duplicated elf/stab section information for %s", 0, 0}; - -struct deprecated_complaint stab_info_mismatch_complaint = -{"elf/stab section information missing for %s", 0, 0}; - -struct deprecated_complaint stab_info_questionable_complaint = -{"elf/stab section information questionable for %s", 0, 0}; - static void free_elfinfo (void *); /* We are called once per section from elf_symfile_read. We @@ -415,8 +401,9 @@ elf_symtab_read (struct objfile *objfile, int dynamic) sizeof (*sectinfo)); if (filesym == NULL) { - complain (§ion_info_complaint, - sym->name); + complaint (&symfile_complaints, + "elf/stab section information %s without a preceding file symbol", + sym->name); } else { @@ -428,8 +415,9 @@ elf_symtab_read (struct objfile *objfile, int dynamic) { if (sectinfo->sections[index] != 0) { - complain (§ion_info_dup_complaint, - sectinfo->filename); + complaint (&symfile_complaints, + "duplicated elf/stab section information for %s", + sectinfo->filename); } } else @@ -740,7 +728,8 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst) if (maybe == 0 && questionable != 0) { - complain (&stab_info_questionable_complaint, filename); + complaint (&symfile_complaints, + "elf/stab section information questionable for %s", filename); maybe = questionable; } @@ -757,7 +746,8 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst) /* We were unable to find any offsets for this file. Complain. */ if (dbx->stab_section_info) /* If there *is* any info, */ - complain (&stab_info_mismatch_complaint, filename); + complaint (&symfile_complaints, + "elf/stab section information missing for %s", filename); } /* Register that we are able to handle ELF object file formats. */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 293adda891f..6d3e3a78e05 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1341,8 +1341,11 @@ get_destructor_fn_field (struct type *t, int *method_indexp, int *field_indexp) This used to be coded as a macro, but I don't think it is called often enough to merit such treatment. */ -struct deprecated_complaint stub_noname_complaint = -{"stub type has NULL name", 0, 0}; +static void +stub_noname_complaint (void) +{ + complaint (&symfile_complaints, "stub type has NULL name"); +} struct type * check_typedef (struct type *type) @@ -1369,7 +1372,7 @@ check_typedef (struct type *type) TYPE_TAG_NAME were separate). */ if (name == NULL) { - complain (&stub_noname_complaint); + stub_noname_complaint (); return type; } sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0, @@ -1396,7 +1399,7 @@ check_typedef (struct type *type) struct type *newtype; if (name == NULL) { - complain (&stub_noname_complaint); + stub_noname_complaint (); return type; } newtype = lookup_transparent_type (name); @@ -1414,7 +1417,7 @@ check_typedef (struct type *type) struct symbol *sym; if (name == NULL) { - complain (&stub_noname_complaint); + stub_noname_complaint (); return type; } sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0, (struct symtab **) NULL); @@ -1511,12 +1514,8 @@ add_mangled_type (struct extra *pextras, struct type *t) break; default: { - - static struct deprecated_complaint msg = - {"Bad int type code length x%x\n", 0, 0}; - - complain (&msg, tlen); - + complaint (&symfile_complaints, "Bad int type code length x%x", + tlen); } } break; @@ -1534,9 +1533,8 @@ add_mangled_type (struct extra *pextras, struct type *t) break; default: { - static struct deprecated_complaint msg = - {"Bad float type code length x%x\n", 0, 0}; - complain (&msg, tlen); + complaint (&symfile_complaints, "Bad float type code length x%x", + tlen); } } break; @@ -1550,9 +1548,8 @@ add_mangled_type (struct extra *pextras, struct type *t) break; case TYPE_CODE_TYPEDEF: { - static struct deprecated_complaint msg = - {"Typedefs in overloaded functions not yet supported\n", 0, 0}; - complain (&msg); + complaint (&symfile_complaints, + "Typedefs in overloaded functions not yet supported"); } /* followed by type bytes & name */ break; @@ -1590,9 +1587,7 @@ add_mangled_type (struct extra *pextras, struct type *t) case TYPE_CODE_ERROR: default: { - static struct deprecated_complaint msg = - {"Unknown type code x%x\n", 0, 0}; - complain (&msg, tcode); + complaint (&symfile_complaints, "Unknown type code x%x", tcode); } } if (TYPE_TARGET_TYPE (t)) diff --git a/gdb/hpread.c b/gdb/hpread.c index b2e64f48cff..d64b4cae62d 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -98,7 +98,8 @@ struct hpread_symfile_info *NAMEP = ""; \ else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \ { \ - complain (&string_table_offset_complaint, (char *) symnum); \ + complaint (&symfile_complaints, "bad string table offset in symbol %d", \ + (char *) symnum); \ *NAMEP = ""; \ } \ else \ @@ -127,57 +128,20 @@ struct symloc #define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen) #define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private)) -/* FIXME: Shouldn't this stuff be in a .h file somewhere? */ /* Complaints about the symbols we have encountered. */ -extern struct deprecated_complaint string_table_offset_complaint; -extern struct deprecated_complaint lbrac_unmatched_complaint; -extern struct deprecated_complaint lbrac_mismatch_complaint; - -static struct deprecated_complaint hpread_unhandled_end_common_complaint = -{ - "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n", 0, 0 -}; - -static struct deprecated_complaint hpread_unhandled_type_complaint = -{ - "hpread_type_translate: unhandled type code.", 0, 0 -}; - -static struct deprecated_complaint hpread_struct_complaint = -{ - "hpread_read_struct_type: expected SVAR type...", 0, 0 -}; - -static struct deprecated_complaint hpread_array_complaint = -{ - "error in hpread_array_type.", 0, 0 -}; - -static struct deprecated_complaint hpread_type_lookup_complaint = -{ - "error in hpread_type_lookup().", 0, 0 -}; - - -static struct deprecated_complaint hpread_unexpected_end_complaint = -{ - "internal error in hp-symtab-read.c: Unexpected DNTT_TYPE_END kind.", 0, 0 -}; - -static struct deprecated_complaint hpread_tagdef_complaint = -{ - "error processing class tagdef", 0, 0 -}; - -static struct deprecated_complaint hpread_unhandled_common_complaint = +static void +lbrac_unmatched_complaint (int arg1) { - "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON.", 0, 0 -}; + complaint (&symfile_complaints, "unmatched N_LBRAC before symtab pos %d", + arg1); +} -static struct deprecated_complaint hpread_unhandled_blockdata_complaint = +static void +lbrac_mismatch_complaint (int arg1) { - "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_BLOCKDATA.", 0, 0 -}; + complaint (&symfile_complaints, + "N_LBRAC/N_RBRAC symbol mismatch at symtab pos %d", arg1); +} /* To generate dumping code, uncomment this define. The dumping itself is controlled by routine-local statics called "dumping". */ @@ -4775,7 +4739,7 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile) dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile); else { - complain (&hpread_type_lookup_complaint); + complaint (&symfile_complaints, "error in hpread_type_lookup()."); return NULL; } @@ -5269,7 +5233,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, /* Stack must be empty now. */ if (context_stack_depth != 0) - complain (&lbrac_unmatched_complaint, (char *) symnum); + lbrac_unmatched_complaint ((char *) symnum); new = push_context (0, valu); /* Built a type for the function. This includes processing @@ -5387,7 +5351,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, CURRENT_FUNCTION_VALUE (objfile) = valu; /* Stack must be empty now. */ if (context_stack_depth != 0) - complain (&lbrac_unmatched_complaint, (char *) symnum); + lbrac_unmatched_complaint ((char *) symnum); new = push_context (0, valu); /* Built a type for the function. This includes processing @@ -5615,7 +5579,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, new = pop_context (); desc = dn_bufp->dend.beginscope.dnttp.index; if (desc != new->depth) - complain (&lbrac_mismatch_complaint, (char *) symnum); + lbrac_mismatch_complaint ((char *) symnum); /* Make a block for the local symbols within. */ finish_block (new->name, &local_symbols, new->old_blocks, @@ -5633,7 +5597,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, case DNTT_TYPE_COMMON: /* End a FORTRAN common block. We don't currently handle these */ - complain (&hpread_unhandled_end_common_complaint); + complaint (&symfile_complaints, + "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON/DNTT_TYPE_END.\n"); break; case DNTT_TYPE_CLASS_SCOPE: @@ -5650,7 +5615,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, new = pop_context (); desc = dn_bufp->dend.beginscope.dnttp.index; if (desc != new->depth) - complain (&lbrac_mismatch_complaint, (char *) symnum); + lbrac_mismatch_complaint ((char *) symnum); /* Make a block for the local symbols within. */ finish_block (new->name, &local_symbols, new->old_blocks, new->start_addr, valu, objfile); @@ -5660,7 +5625,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, break; default: - complain (&hpread_unexpected_end_complaint); + complaint (&symfile_complaints, + "internal error in hp-symtab-read.c: Unexpected DNTT_TYPE_END kind."); break; } break; @@ -5882,7 +5848,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, dn_bufp = hpread_get_lntt (dn_bufp->dtag.type.dnttp.index, objfile); else { - complain (&hpread_tagdef_complaint); + complaint (&symfile_complaints, "error processing class tagdef"); return; } if (dn_bufp->dblock.kind == DNTT_TYPE_CLASS || @@ -5990,7 +5956,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, case DNTT_TYPE_COMMON: /* FORTRAN common. Not yet handled. */ - complain (&hpread_unhandled_common_complaint); + complaint (&symfile_complaints, + "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_COMMON."); break; /* DNTT_TYPE_COBSTRUCT is not handled by GDB. */ @@ -6002,7 +5969,8 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, /* Not sure what this is - part of FORTRAN support maybe? * Anyway, not yet handled. */ - complain (&hpread_unhandled_blockdata_complaint); + complaint (&symfile_complaints, + "unhandled symbol in hp-symtab-read.c: DNTT_TYPE_BLOCKDATA."); break; case DNTT_TYPE_CLASS_SCOPE: diff --git a/gdb/macrotab.c b/gdb/macrotab.c index 5bc5b7327da..1432847a8e6 100644 --- a/gdb/macrotab.c +++ b/gdb/macrotab.c @@ -445,12 +445,9 @@ macro_include (struct macro_source_file *source, should tolerate bad debug info. So: First, squawk. */ - static struct deprecated_complaint bogus_inclusion_line = { - "both `%s' and `%s' allegedly #included at %s:%d", 0, 0 - }; - - complain (&bogus_inclusion_line, - included, (*link)->filename, source->filename, line); + complaint (&symfile_complaints, + "both `%s' and `%s' allegedly #included at %s:%d", included, + (*link)->filename, source->filename, line); /* Now, choose a new, unoccupied line number for this #inclusion, after the alleged #inclusion line. */ @@ -707,15 +704,10 @@ check_for_redefinition (struct macro_source_file *source, int line, if (! same) { - static struct deprecated_complaint macro_redefined = { - "macro `%s' redefined at %s:%d; original definition at %s:%d", - 0, 0 - }; - complain (¯o_redefined, - name, - source->filename, line, - found_key->start_file->filename, - found_key->start_line); + complaint (&symfile_complaints, + "macro `%s' redefined at %s:%d; original definition at %s:%d", + name, source->filename, line, + found_key->start_file->filename, found_key->start_line); } return found_key; @@ -801,12 +793,10 @@ macro_undef (struct macro_source_file *source, int line, if (key->end_file) { - static struct deprecated_complaint double_undef = { - "macro '%s' is #undefined twice, at %s:%d and %s:%d", - 0, 0 - }; - complain (&double_undef, name, source->filename, line, - key->end_file->filename, key->end_line); + complaint (&symfile_complaints, + "macro '%s' is #undefined twice, at %s:%d and %s:%d", name, + source->filename, line, key->end_file->filename, + key->end_line); } /* Whatever the case, wipe out the old ending point, and @@ -820,11 +810,9 @@ macro_undef (struct macro_source_file *source, int line, has no macro definition in scope is ignored. So we should ignore it too. */ #if 0 - static struct deprecated_complaint no_macro_to_undefine = { - "no definition for macro `%s' in scope to #undef at %s:%d", - 0, 0 - }; - complain (&no_macro_to_undefine, name, source->filename, line); + complaint (&symfile_complaints, + "no definition for macro `%s' in scope to #undef at %s:%d", + name, source->filename, line); #endif } } diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index ed13fa3364a..f6ec396f76f 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -142,96 +142,43 @@ struct symloc #define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined) /* Various complaints about symbol reading that don't abort the process */ +static void +index_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "bad aux index at symbol %s", arg1); +} -static struct deprecated_complaint bad_file_number_complaint = -{"bad file number %d", 0, 0}; - -static struct deprecated_complaint index_complaint = -{"bad aux index at symbol %s", 0, 0}; - -static struct deprecated_complaint aux_index_complaint = -{"bad proc end in aux found from symbol %s", 0, 0}; - -static struct deprecated_complaint block_index_complaint = -{"bad aux index at block symbol %s", 0, 0}; - -static struct deprecated_complaint unknown_ext_complaint = -{"unknown external symbol %s", 0, 0}; - -static struct deprecated_complaint unknown_sym_complaint = -{"unknown local symbol %s", 0, 0}; - -static struct deprecated_complaint unknown_st_complaint = -{"with type %d", 0, 0}; - -static struct deprecated_complaint block_overflow_complaint = -{"block containing %s overfilled", 0, 0}; - -static struct deprecated_complaint basic_type_complaint = -{"cannot map ECOFF basic type 0x%x for %s", 0, 0}; - -static struct deprecated_complaint unknown_type_qual_complaint = -{"unknown type qualifier 0x%x", 0, 0}; - -static struct deprecated_complaint array_index_type_complaint = -{"illegal array index type for %s, assuming int", 0, 0}; - -static struct deprecated_complaint bad_tag_guess_complaint = -{"guessed tag type of %s incorrectly", 0, 0}; - -static struct deprecated_complaint block_member_complaint = -{"declaration block contains unhandled symbol type %d", 0, 0}; - -static struct deprecated_complaint stEnd_complaint = -{"stEnd with storage class %d not handled", 0, 0}; - -static struct deprecated_complaint unknown_mdebug_symtype_complaint = -{"unknown symbol type 0x%x", 0, 0}; - -static struct deprecated_complaint stab_unknown_complaint = -{"unknown stabs symbol %s", 0, 0}; - -static struct deprecated_complaint pdr_for_nonsymbol_complaint = -{"PDR for %s, but no symbol", 0, 0}; - -static struct deprecated_complaint pdr_static_symbol_complaint = -{"can't handle PDR for static proc at 0x%lx", 0, 0}; - -static struct deprecated_complaint bad_setjmp_pdr_complaint = -{"fixing bad setjmp PDR from libc", 0, 0}; - -static struct deprecated_complaint bad_fbitfield_complaint = -{"can't handle TIR fBitfield for %s", 0, 0}; - -static struct deprecated_complaint bad_continued_complaint = -{"illegal TIR continued for %s", 0, 0}; - -static struct deprecated_complaint bad_rfd_entry_complaint = -{"bad rfd entry for %s: file %d, index %d", 0, 0}; - -static struct deprecated_complaint unexpected_type_code_complaint = -{"unexpected type code for %s", 0, 0}; - -static struct deprecated_complaint unable_to_cross_ref_complaint = -{"unable to cross ref btTypedef for %s", 0, 0}; - -static struct deprecated_complaint bad_indirect_xref_complaint = -{"unable to cross ref btIndirect for %s", 0, 0}; - -static struct deprecated_complaint illegal_forward_tq0_complaint = -{"illegal tq0 in forward typedef for %s", 0, 0}; +static void +unknown_ext_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "unknown external symbol %s", arg1); +} -static struct deprecated_complaint illegal_forward_bt_complaint = -{"illegal bt %d in forward typedef for %s", 0, 0}; +static void +basic_type_complaint (int arg1, const char *arg2) +{ + complaint (&symfile_complaints, "cannot map ECOFF basic type 0x%x for %s", + arg1, arg2); +} -static struct deprecated_complaint bad_linetable_guess_complaint = -{"guessed size of linetable for %s incorrectly", 0, 0}; +static void +bad_tag_guess_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "guessed tag type of %s incorrectly", arg1); +} -static struct deprecated_complaint bad_ext_ifd_complaint = -{"bad ifd for external symbol: %d (max %d)", 0, 0}; +static void +bad_rfd_entry_complaint (const char *arg1, int arg2, int arg3) +{ + complaint (&symfile_complaints, "bad rfd entry for %s: file %d, index %d", + arg1, arg2, arg3); +} -static struct deprecated_complaint bad_ext_iss_complaint = -{"bad iss for external symbol: %ld (max %ld)", 0, 0}; +static void +unexpected_type_code_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "unexpected type code for %s", arg1); +} /* Macros and extra defs */ @@ -987,7 +934,9 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, break; default: - complain (&block_member_complaint, tsym.st); + complaint (&symfile_complaints, + "declaration block contains unhandled symbol type %d", + tsym.st); } } end_of_fields:; @@ -1273,7 +1222,8 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, ; } else - complain (&stEnd_complaint, sh->sc); + complaint (&symfile_complaints, + "stEnd with storage class %d not handled", sh->sc); pop_parse_stack (); /* restore previous lexical context */ break; @@ -1385,7 +1335,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, case stConstant: break; /* constant */ default: - complain (&unknown_mdebug_symtype_complaint, sh->st); + complaint (&symfile_complaints, "unknown symbol type 0x%x", sh->st); break; } @@ -1454,7 +1404,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, /* Handle corrupt aux indices. */ if (aux_index >= (debug_info->fdr + fd)->caux) { - complain (&index_complaint, sym_name); + index_complaint (sym_name); return mdebug_type_int; } ax += aux_index; @@ -1463,7 +1413,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, (*debug_swap->swap_tir_in) (bigend, &ax->a_ti, t); if (t->bt >= (sizeof (map_bt) / sizeof (*map_bt))) { - complain (&basic_type_complaint, t->bt, sym_name); + basic_type_complaint (t->bt, sym_name); return mdebug_type_int; } if (map_bt[t->bt]) @@ -1502,7 +1452,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, type_code = TYPE_CODE_ERROR; break; default: - complain (&basic_type_complaint, t->bt, sym_name); + basic_type_complaint (t->bt, sym_name); return mdebug_type_int; } } @@ -1528,7 +1478,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, else if (t->bt == btEnum) ; else - complain (&bad_fbitfield_complaint, sym_name); + complaint (&symfile_complaints, "can't handle TIR fBitfield for %s", + sym_name); } else *bs = width; @@ -1556,7 +1507,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, if (rf == -1) { - complain (&bad_indirect_xref_complaint, sym_name); + complaint (&symfile_complaints, + "unable to cross ref btIndirect for %s", sym_name); return mdebug_type_int; } xref_fh = get_rfd (fd, rf); @@ -1596,7 +1548,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, && TYPE_CODE (tp) != TYPE_CODE_UNION && TYPE_CODE (tp) != TYPE_CODE_ENUM) { - complain (&unexpected_type_code_complaint, sym_name); + unexpected_type_code_complaint (sym_name); } else { @@ -1610,7 +1562,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, || (TYPE_CODE (tp) != TYPE_CODE_ENUM && type_code == TYPE_CODE_ENUM)) { - complain (&bad_tag_guess_complaint, sym_name); + bad_tag_guess_complaint (sym_name); } if (TYPE_CODE (tp) != type_code) @@ -1647,7 +1599,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, are corrupted. */ if (TYPE_CODE (tp) != TYPE_CODE_RANGE) { - complain (&unexpected_type_code_complaint, sym_name); + unexpected_type_code_complaint (sym_name); } else { @@ -1655,7 +1607,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, exception is if we guessed wrong re struct/union/enum. */ if (TYPE_CODE (tp) != type_code) { - complain (&bad_tag_guess_complaint, sym_name); + bad_tag_guess_complaint (sym_name); TYPE_CODE (tp) = type_code; } if (TYPE_NAME (tp) == NULL || !STREQ (TYPE_NAME (tp), name)) @@ -1671,7 +1623,8 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, ax += cross_ref (fd, ax, &tp, type_code, &name, bigend, sym_name); if (tp == (struct type *) NULL) { - complain (&unable_to_cross_ref_complaint, sym_name); + complaint (&symfile_complaints, + "unable to cross ref btTypedef for %s", sym_name); tp = mdebug_type_int; } } @@ -1721,7 +1674,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs, /* Complain for illegal continuations due to corrupt aux entries. */ if (t->continued) - complain (&bad_continued_complaint, sym_name); + complaint (&symfile_complaints, "illegal TIR continued for %s", sym_name); return tp; } @@ -1783,7 +1736,8 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend, else due to corrupt aux entries. */ if (TYPE_CODE (indx) != TYPE_CODE_INT) { - complain (&array_index_type_complaint, sym_name); + complaint (&symfile_complaints, + "illegal array index type for %s, assuming int", sym_name); indx = mdebug_type_int; } @@ -1833,7 +1787,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend, return 0; default: - complain (&unknown_type_qual_complaint, tq); + complaint (&symfile_complaints, "unknown type qualifier 0x%x", tq); return 0; } } @@ -1868,7 +1822,9 @@ parse_procedure (PDR *pr, struct symtab *search_symtab, { /* Static procedure at address pr->adr. Sigh. */ /* FIXME-32x64. assuming pr->adr fits in long. */ - complain (&pdr_static_symbol_complaint, (unsigned long) pr->adr); + complaint (&symfile_complaints, + "can't handle PDR for static proc at 0x%lx", + (unsigned long) pr->adr); return; } else @@ -1928,7 +1884,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab, } else { - complain (&pdr_for_nonsymbol_complaint, sh_name); + complaint (&symfile_complaints, "PDR for %s, but no symbol", sh_name); #if 1 return; #else @@ -1976,7 +1932,7 @@ parse_procedure (PDR *pr, struct symtab *search_symtab, to make backtrace through setjmp work. */ if (e->pdr.pcreg == 0 && STREQ (sh_name, "setjmp")) { - complain (&bad_setjmp_pdr_complaint, 0); + complaint (&symfile_complaints, "fixing bad setjmp PDR from libc"); e->pdr.pcreg = RA_REGNUM; e->pdr.regmask = 0x80000000; e->pdr.regoffset = -4; @@ -2173,7 +2129,9 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines, with corrupt binaries. */ if (lt->nitems >= maxlines) { - complain (&bad_linetable_guess_complaint, fdr_name (fh)); + complaint (&symfile_complaints, + "guessed size of linetable for %s incorrectly", + fdr_name (fh)); break; } k = add_line (lt, lineno, l, k); @@ -2182,6 +2140,14 @@ parse_lines (FDR *fh, PDR *pr, struct linetable *lt, int maxlines, } } +static void +function_outside_compilation_unit_complaint (const char *arg1) +{ + complaint (&symfile_complaints, + "function `%s' appears to be defined outside of all compilation units", + arg1); +} + /* Master parsing procedure for first-pass reading of file symbols into a partial_symtab. */ @@ -2358,13 +2324,16 @@ parse_partial_symbols (struct objfile *objfile) external symbols. */ if (ext_in->ifd < -1 || ext_in->ifd >= hdr->ifdMax) { - complain (&bad_ext_ifd_complaint, ext_in->ifd, hdr->ifdMax); + complaint (&symfile_complaints, + "bad ifd for external symbol: %d (max %ld)", ext_in->ifd, + hdr->ifdMax); continue; } if (ext_in->asym.iss < 0 || ext_in->asym.iss >= hdr->issExtMax) { - complain (&bad_ext_iss_complaint, ext_in->asym.iss, - hdr->issExtMax); + complaint (&symfile_complaints, + "bad iss for external symbol: %ld (max %ld)", + ext_in->asym.iss, hdr->issExtMax); continue; } @@ -2490,7 +2459,7 @@ parse_partial_symbols (struct objfile *objfile) /* Fall through. */ default: ms_type = mst_unknown; - complain (&unknown_ext_complaint, name); + unknown_ext_complaint (name); } if (!ECOFF_IN_ELF (cur_bfd)) prim_record_minimal_symbol (name, svalue, ms_type, objfile); @@ -2722,9 +2691,6 @@ parse_partial_symbols (struct objfile *objfile) switch (type_code) { - static struct deprecated_complaint function_outside_compilation_unit = { - "function `%s' appears to be defined outside of all compilation units", 0, 0 - }; char *p; /* * Standard, external, non-debugger, symbols @@ -3127,7 +3093,7 @@ parse_partial_symbols (struct objfile *objfile) char *name = xmalloc (name_len + 1); memcpy (name, namestring, name_len); name[name_len] = '\0'; - complain (&function_outside_compilation_unit, name); + function_outside_compilation_unit_complaint (name); xfree (name); } sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -3148,7 +3114,7 @@ parse_partial_symbols (struct objfile *objfile) char *name = xmalloc (name_len + 1); memcpy (name, namestring, name_len); name[name_len] = '\0'; - complain (&function_outside_compilation_unit, name); + function_outside_compilation_unit_complaint (name); xfree (name); } sh.value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -3199,7 +3165,8 @@ parse_partial_symbols (struct objfile *objfile) time searching to the end of every string looking for a backslash. */ - complain (&unknown_symchar_complaint, p[1]); + complaint (&symfile_complaints, + "unknown symbol descriptor `%c'", p[1]); /* Ignore it; perhaps it is an extension that we don't know about. */ @@ -3260,8 +3227,8 @@ parse_partial_symbols (struct objfile *objfile) default: /* If we haven't found it yet, ignore it. It's probably some new type we don't know about yet. */ - complain (&unknown_symtype_complaint, - local_hex_string (type_code)); /*CUR_SYMBOL_TYPE*/ + complaint (&symfile_complaints, "unknown symbol type %s", + local_hex_string (type_code)); /*CUR_SYMBOL_TYPE*/ continue; } if (stabstring @@ -3366,7 +3333,7 @@ parse_partial_symbols (struct objfile *objfile) { /* Should not happen, but does when cross-compiling with the MIPS compiler. FIXME -- pull later. */ - complain (&index_complaint, name); + index_complaint (name); new_sdx = cur_sdx + 1; /* Don't skip at all */ } else @@ -3379,7 +3346,9 @@ parse_partial_symbols (struct objfile *objfile) if (new_sdx <= cur_sdx) { /* This should not happen either... FIXME. */ - complain (&aux_index_complaint, name); + complaint (&symfile_complaints, + "bad proc end in aux found from symbol %s", + name); new_sdx = cur_sdx + 1; /* Don't skip backward */ } @@ -3458,7 +3427,8 @@ parse_partial_symbols (struct objfile *objfile) if (new_sdx <= cur_sdx) { /* This happens with the Ultrix kernel. */ - complain (&block_index_complaint, name); + complaint (&symfile_complaints, + "bad aux index at block symbol %s", name); new_sdx = cur_sdx + 1; /* Don't skip backward */ } cur_sdx = new_sdx; @@ -3478,8 +3448,9 @@ parse_partial_symbols (struct objfile *objfile) default: /* Both complaints are valid: one gives symbol name, the other the offending symbol type. */ - complain (&unknown_sym_complaint, name); - complain (&unknown_st_complaint, sh.st); + complaint (&symfile_complaints, "unknown local symbol %s", + name); + complaint (&symfile_complaints, "with type %d", sh.st); cur_sdx++; continue; } @@ -3548,8 +3519,7 @@ parse_partial_symbols (struct objfile *objfile) class = LOC_LABEL; break; default: - complain (&unknown_ext_complaint, - debug_info->ssext + psh->iss); + unknown_ext_complaint (debug_info->ssext + psh->iss); /* Fall through, pretend it's global. */ case stGlobal: /* Global common symbols are resolved by the runtime loader, @@ -3646,7 +3616,7 @@ parse_partial_symbols (struct objfile *objfile) &rh); if (rh < 0 || rh >= hdr->ifdMax) { - complain (&bad_file_number_complaint, rh); + complaint (&symfile_complaints, "bad file number %ld", rh); continue; } @@ -3953,7 +3923,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) /* These are generated by gcc-2.x, do not complain */ ; else - complain (&stab_unknown_complaint, name); + complaint (&symfile_complaints, "unknown stabs symbol %s", name); } if (! last_symtab_ended) @@ -4264,8 +4234,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp, enum type_code type_cod { /* File indirect entry is corrupt. */ *pname = ""; - complain (&bad_rfd_entry_complaint, - sym_name, xref_fd, rn->index); + bad_rfd_entry_complaint (sym_name, xref_fd, rn->index); return result; } @@ -4289,8 +4258,7 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp, enum type_code type_cod { /* File indirect entry is corrupt. */ *pname = ""; - complain (&bad_rfd_entry_complaint, - sym_name, xref_fd, rn->index); + bad_rfd_entry_complaint (sym_name, xref_fd, rn->index); return result; } @@ -4326,7 +4294,8 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp, enum type_code type_cod + fh->iauxBase + sh.index)->a_ti, &tir); if (tir.tq0 != tqNil) - complain (&illegal_forward_tq0_complaint, sym_name); + complaint (&symfile_complaints, + "illegal tq0 in forward typedef for %s", sym_name); switch (tir.bt) { case btVoid: @@ -4363,7 +4332,9 @@ cross_ref (int fd, union aux_ext *ax, struct type **tpp, enum type_code type_cod break; default: - complain (&illegal_forward_bt_complaint, tir.bt, sym_name); + complaint (&symfile_complaints, + "illegal bt %d in forward typedef for %s", tir.bt, + sym_name); *tpp = init_type (type_code, 0, 0, (char *) NULL, current_objfile); break; @@ -4445,7 +4416,8 @@ add_symbol (struct symbol *s, struct block *b) if (b == top_stack->cur_block && nsyms >= top_stack->maxsyms) { - complain (&block_overflow_complaint, SYMBOL_NAME (s)); + complaint (&symfile_complaints, "block containing %s overfilled", + SYMBOL_NAME (s)); /* In this case shrink_block is actually grow_block, since BLOCK_NSYMS(b) is larger than its current size. */ origb = b; diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index 1f83511970c..45fe7987437 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -74,15 +74,6 @@ struct objc_method { /* Complaints about ObjC classes, selectors, etc. */ -static struct deprecated_complaint noclass_lookup_complaint = { - "no way to lookup Objective-C classes", 0, 0 -}; - -static struct deprecated_complaint nosel_lookup_complaint = { - "no way to lookup Objective-C selectors", 0, 0 -}; - - #if (!defined __GNUC__ || __GNUC__ < 2 || __GNUC_MINOR__ < (defined __cplusplus ? 6 : 4)) #define __CHECK_FUNCTION ((__const char *) 0) #else @@ -160,7 +151,8 @@ lookup_objc_class (char *classname) function = find_function_in_inferior("objc_lookup_class"); else { - complain (&noclass_lookup_complaint, 0); + complaint (&symfile_complaints, "no way to lookup Objective-C classes", + 0); return 0; } @@ -187,7 +179,8 @@ lookup_child_selector (char *selname) function = find_function_in_inferior("sel_get_any_uid"); else { - complain (&nosel_lookup_complaint, 0); + complaint (&symfile_complaints, "no way to lookup Objective-C selectors", + 0); return 0; } diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c index 0bd8c52052a..39d18e422d9 100644 --- a/gdb/remote-vx.c +++ b/gdb/remote-vx.c @@ -820,9 +820,6 @@ net_get_symbols (ldtabl *pLoadTable) Returns status of symbol read on target side (0=success, -1=fail) Returns -1 and complain()s if rpc fails. */ -struct deprecated_complaint cant_contact_target = -{"Lost contact with VxWorks target", 0, 0}; - static int vx_lookup_symbol (char *name, /* symbol name */ CORE_ADDR *pAddr) @@ -837,7 +834,7 @@ vx_lookup_symbol (char *name, /* symbol name */ xdr_SYMBOL_ADDR, &symbolAddr); if (status != RPC_SUCCESS) { - complain (&cant_contact_target); + complaint (&symfile_complaints, "Lost contact with VxWorks target"); return -1; } diff --git a/gdb/stabsread.c b/gdb/stabsread.c index fcd6046d8dd..68a67d52368 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -202,47 +202,31 @@ static const char vb_name[] = "_vb$"; #define BELIEVE_PCC_PROMOTION_TYPE 0 #endif -static struct deprecated_complaint invalid_cpp_abbrev_complaint = -{"invalid C++ abbreviation `%s'", 0, 0}; - -static struct deprecated_complaint invalid_cpp_type_complaint = -{"C++ abbreviated type name unknown at symtab pos %d", 0, 0}; - -static struct deprecated_complaint member_fn_complaint = -{"member function type missing, got '%c'", 0, 0}; - -static struct deprecated_complaint const_vol_complaint = -{"const/volatile indicator missing, got '%c'", 0, 0}; - -static struct deprecated_complaint error_type_complaint = -{"couldn't parse type; debugger out of date?", 0, 0}; - -static struct deprecated_complaint invalid_member_complaint = -{"invalid (minimal) member type data format at symtab pos %d.", 0, 0}; - -static struct deprecated_complaint range_type_base_complaint = -{"base type %d of range type is not defined", 0, 0}; - -static struct deprecated_complaint reg_value_complaint = -{"register number %d too large (max %d) in symbol %s", 0, 0}; - -static struct deprecated_complaint vtbl_notfound_complaint = -{"virtual function table pointer not found when defining class `%s'", 0, 0}; - -static struct deprecated_complaint unrecognized_cplus_name_complaint = -{"Unknown C++ symbol name `%s'", 0, 0}; - -static struct deprecated_complaint rs6000_builtin_complaint = -{"Unknown builtin type %d", 0, 0}; +static void +invalid_cpp_abbrev_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "invalid C++ abbreviation `%s'", arg1); +} -static struct deprecated_complaint unresolved_sym_chain_complaint = -{"%s: common block `%s' from global_sym_chain unresolved", 0, 0}; +static void +reg_value_complaint (int arg1, int arg2, const char *arg3) +{ + complaint (&symfile_complaints, + "register number %d too large (max %d) in symbol %s", arg1, arg2, + arg3); +} -static struct deprecated_complaint stabs_general_complaint = -{"%s", 0, 0}; +static void +stabs_general_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "%s", arg1); +} -static struct deprecated_complaint lrs_general_complaint = -{"%s", 0, 0}; +static void +lrs_general_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "%s", arg1); +} /* Make a list of forward references which haven't been defined. */ @@ -311,11 +295,9 @@ dbx_lookup_type (int typenums[2]) if (filenum < 0 || filenum >= n_this_object_header_files) { - static struct deprecated_complaint msg = - {"\ -Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.", - 0, 0}; - complain (&msg, filenum, index, symnum); + complaint (&symfile_complaints, + "Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.", + filenum, index, symnum); goto error_return; } @@ -606,6 +588,12 @@ get_cfront_method_physname (char *fname) return p; } +static void +msg_unknown_complaint (const char *arg1) +{ + complaint (&symfile_complaints, "Unsupported token in stabs string %s", arg1); +} + /* Read base classes within cfront class definition. eg: A:ZcA;1@Bpub v2@Bvirpri;__ct__1AFv func__1AFv *sfunc__1AFv ;as__1A ;; ^^^^^^^^^^^^^^^^^^ @@ -618,14 +606,6 @@ static int read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type, struct objfile *objfile) { - static struct deprecated_complaint msg_unknown = - {"\ - Unsupported token in stabs string %s.\n", - 0, 0}; - static struct deprecated_complaint msg_notfound = - {"\ - Unable to find base type for %s.\n", - 0, 0}; int bnum = 0; char *p; int i; @@ -692,10 +672,9 @@ read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type, /* Bad visibility format. Complain and treat it as public. */ { - static struct deprecated_complaint msg = - { - "Unknown visibility `%c' for baseclass", 0, 0}; - complain (&msg, new->visibility); + complaint (&symfile_complaints, + "Unknown visibility `%c' for baseclass", + new->visibility); new->visibility = VISIBILITY_PUBLIC; } } @@ -703,7 +682,7 @@ read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type, /* "@" comes next - eg: @Bvir */ if (**pp != '@') { - complain (&msg_unknown, *pp); + msg_unknown_complaint (*pp); return 1; } ++(*pp); @@ -731,7 +710,7 @@ read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type, bname = get_substring (pp, ';'); if (!bname || !*bname) { - complain (&msg_unknown, *pp); + msg_unknown_complaint (*pp); return 1; } /* FIXME! attach base info to type */ @@ -743,7 +722,8 @@ read_cfront_baseclasses (struct field_info *fip, char **pp, struct type *type, } else { - complain (&msg_notfound, *pp); + complaint (&symfile_complaints, "Unable to find base type for %s", + *pp); return 1; } } @@ -810,11 +790,8 @@ read_cfront_member_functions (struct field_info *fip, char **pp, ref_func = lookup_symbol (fname, 0, VAR_NAMESPACE, 0, 0); /* demangled name */ if (!ref_func) { - static struct deprecated_complaint msg = - {"\ - Unable to find function symbol for %s\n", - 0, 0}; - complain (&msg, fname); + complaint (&symfile_complaints, + "Unable to find function symbol for %s", fname); continue; } sublist = NULL; @@ -1070,7 +1047,7 @@ resolve_symbol_reference (struct objfile *objfile, struct symbol *sym, char *p) ref_sym = ref_search (refnum); if (!ref_sym) { - complain (&lrs_general_complaint, "symbol for reference not found"); + lrs_general_complaint ("symbol for reference not found"); return 0; } @@ -1106,7 +1083,7 @@ resolve_symbol_reference (struct objfile *objfile, struct symbol *sym, char *p) sizeof (struct alias_list)); if (!alias) { - complain (&lrs_general_complaint, "Unable to allocate alias list memory"); + lrs_general_complaint ("Unable to allocate alias list memory"); return 0; } @@ -1361,7 +1338,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, #endif default: - complain (&unrecognized_cplus_name_complaint, string); + complaint (&symfile_complaints, "Unknown C++ symbol name `%s'", + string); goto normal; /* Do *something* with it */ } } @@ -1813,9 +1791,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu); if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS) { - complain (®_value_complaint, SYMBOL_VALUE (sym), - NUM_REGS + NUM_PSEUDO_REGS, - SYMBOL_SOURCE_NAME (sym)); + reg_value_complaint (SYMBOL_VALUE (sym), + NUM_REGS + NUM_PSEUDO_REGS, + SYMBOL_SOURCE_NAME (sym)); SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */ } SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; @@ -1829,9 +1807,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu); if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS) { - complain (®_value_complaint, SYMBOL_VALUE (sym), - NUM_REGS + NUM_PSEUDO_REGS, - SYMBOL_SOURCE_NAME (sym)); + reg_value_complaint (SYMBOL_VALUE (sym), + NUM_REGS + NUM_PSEUDO_REGS, + SYMBOL_SOURCE_NAME (sym)); SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */ } SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; @@ -2083,9 +2061,9 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_VALUE (sym) = STAB_REG_TO_REGNUM (valu); if (SYMBOL_VALUE (sym) >= NUM_REGS + NUM_PSEUDO_REGS) { - complain (®_value_complaint, SYMBOL_VALUE (sym), - NUM_REGS + NUM_PSEUDO_REGS, - SYMBOL_SOURCE_NAME (sym)); + reg_value_complaint (SYMBOL_VALUE (sym), + NUM_REGS + NUM_PSEUDO_REGS, + SYMBOL_SOURCE_NAME (sym)); SYMBOL_VALUE (sym) = SP_REGNUM; /* Known safe, though useless */ } SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; @@ -2180,7 +2158,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, p = strchr (p, ')'); if (!*p || *p != ')') { - complain (&lrs_general_complaint, "live range format not recognized"); + lrs_general_complaint ("live range format not recognized"); return NULL; } p++; @@ -2201,14 +2179,14 @@ resolve_live_range (struct objfile *objfile, struct symbol *sym, char *p) /* Sanity check the beginning of the stabs string. */ if (!*p || *p != 'l') { - complain (&lrs_general_complaint, "live range string 1"); + lrs_general_complaint ("live range string 1"); return 0; } p++; if (!*p || *p != '(') { - complain (&lrs_general_complaint, "live range string 2"); + lrs_general_complaint ("live range string 2"); return 0; } p++; @@ -2221,13 +2199,13 @@ resolve_live_range (struct objfile *objfile, struct symbol *sym, char *p) start = ref_search_value (refnum); if (!start) { - complain (&lrs_general_complaint, "Live range symbol not found 1"); + lrs_general_complaint ("Live range symbol not found 1"); return 0; } if (!*p || *p != ',') { - complain (&lrs_general_complaint, "live range string 3"); + lrs_general_complaint ("live range string 3"); return 0; } p++; @@ -2240,13 +2218,13 @@ resolve_live_range (struct objfile *objfile, struct symbol *sym, char *p) end = ref_search_value (refnum); if (!end) { - complain (&lrs_general_complaint, "Live range symbol not found 2"); + lrs_general_complaint ("Live range symbol not found 2"); return 0; } if (!*p || *p != ')') { - complain (&lrs_general_complaint, "live range string 4"); + lrs_general_complaint ("live range string 4"); return 0; } @@ -2268,7 +2246,7 @@ add_live_range (struct objfile *objfile, struct symbol *sym, CORE_ADDR start, if (start >= end) { - complain (&lrs_general_complaint, "end of live range follows start"); + lrs_general_complaint ("end of live range follows start"); return; } @@ -2325,7 +2303,7 @@ add_live_range (struct objfile *objfile, struct symbol *sym, CORE_ADDR start, static struct type * error_type (char **pp, struct objfile *objfile) { - complain (&error_type_complaint); + complaint (&symfile_complaints, "couldn't parse type; debugger out of date?"); while (1) { /* Skip to end of symbol. */ @@ -2435,9 +2413,8 @@ again: { /* Complain and keep going, so compilers can invent new cross-reference types. */ - static struct deprecated_complaint msg = - {"Unrecognized cross-reference type `%c'", 0, 0}; - complain (&msg, (*pp)[0]); + complaint (&symfile_complaints, + "Unrecognized cross-reference type `%c'", (*pp)[0]); code = TYPE_CODE_STRUCT; break; } @@ -2660,11 +2637,9 @@ again: ++*pp; else { - static struct deprecated_complaint msg = { - "Prototyped function type didn't end arguments with `#':\n%s", - 0, 0 - }; - complain (&msg, type_start); + complaint (&symfile_complaints, + "Prototyped function type didn't end arguments with `#':\n%s", + type_start); } /* If there is just one argument whose type is `void', then @@ -2797,7 +2772,9 @@ again: (*pp)++; return_type = read_type (pp, objfile); if (*(*pp)++ != ';') - complain (&invalid_member_complaint, symnum); + complaint (&symfile_complaints, + "invalid (minimal) member type data format at symtab pos %d.", + symnum); type = allocate_stub_method (return_type); if (typenums[0] != -1) *dbx_lookup_type (typenums) = type; @@ -2930,7 +2907,7 @@ rs6000_builtin_type (int typenum) if (typenum >= 0 || typenum < -NUMBER_RECOGNIZED) { - complain (&rs6000_builtin_complaint, typenum); + complaint (&symfile_complaints, "Unknown builtin type %d", typenum); return builtin_type_error; } if (negative_types[-typenum] != NULL) @@ -3288,7 +3265,8 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, case '.': break; default: - complain (&const_vol_complaint, **pp); + complaint (&symfile_complaints, + "const/volatile indicator missing, got '%c'", **pp); break; } @@ -3370,7 +3348,8 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, default: /* error */ - complain (&member_fn_complaint, (*pp)[-1]); + complaint (&symfile_complaints, + "member function type missing, got '%c'", (*pp)[-1]); /* Fall through into normal member function. */ case '.': @@ -3635,7 +3614,9 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, name = type_name_no_tag (context); if (name == NULL) { - complain (&invalid_cpp_type_complaint, symnum); + complaint (&symfile_complaints, + "C++ abbreviated type name unknown at symtab pos %d", + symnum); name = "FOO"; } fip->list->field.name = @@ -3643,7 +3624,7 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, break; default: - complain (&invalid_cpp_abbrev_complaint, *pp); + invalid_cpp_abbrev_complaint (*pp); fip->list->field.name = obconcat (&objfile->type_obstack, "INVALID_CPLUSPLUS_ABBREV", "", ""); @@ -3656,7 +3637,7 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, p = ++(*pp); if (p[-1] != ':') { - complain (&invalid_cpp_abbrev_complaint, *pp); + invalid_cpp_abbrev_complaint (*pp); return 0; } fip->list->field.type = read_type (pp, objfile); @@ -3677,7 +3658,7 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, } else { - complain (&invalid_cpp_abbrev_complaint, *pp); + invalid_cpp_abbrev_complaint (*pp); /* We have no idea what syntax an unrecognized abbrev would have, so better return 0. If we returned 1, we would need to at least advance *pp to avoid an infinite loop. */ @@ -3761,7 +3742,7 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p, else if (**pp != ',') { /* Bad structure-type format. */ - complain (&stabs_general_complaint, "bad structure-type format"); + stabs_general_complaint ("bad structure-type format"); return; } @@ -3772,13 +3753,13 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p, FIELD_BITPOS (fip->list->field) = read_huge_number (pp, ',', &nbits); if (nbits != 0) { - complain (&stabs_general_complaint, "bad structure-type format"); + stabs_general_complaint ("bad structure-type format"); return; } FIELD_BITSIZE (fip->list->field) = read_huge_number (pp, ';', &nbits); if (nbits != 0) { - complain (&stabs_general_complaint, "bad structure-type format"); + stabs_general_complaint ("bad structure-type format"); return; } } @@ -4018,10 +3999,8 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type, default: /* Unknown character. Complain and treat it as non-virtual. */ { - static struct deprecated_complaint msg = - { - "Unknown virtual character `%c' for baseclass", 0, 0}; - complain (&msg, **pp); + complaint (&symfile_complaints, + "Unknown virtual character `%c' for baseclass", **pp); } } ++(*pp); @@ -4037,11 +4016,9 @@ read_baseclasses (struct field_info *fip, char **pp, struct type *type, /* Bad visibility format. Complain and treat it as public. */ { - static struct deprecated_complaint msg = - { - "Unknown visibility `%c' for baseclass", 0, 0 - }; - complain (&msg, new->visibility); + complaint (&symfile_complaints, + "Unknown visibility `%c' for baseclass", + new->visibility); new->visibility = VISIBILITY_PUBLIC; } } @@ -4147,7 +4124,9 @@ read_tilde_fields (struct field_info *fip, char **pp, struct type *type, } } /* Virtual function table field not found. */ - complain (&vtbl_notfound_complaint, TYPE_NAME (type)); + complaint (&symfile_complaints, + "virtual function table pointer not found when defining class `%s'", + TYPE_NAME (type)); return 0; } else @@ -4210,11 +4189,8 @@ read_cfront_static_fields (struct field_info *fip, char **pp, struct type *type, ref_static = lookup_symbol (sname, 0, VAR_NAMESPACE, 0, 0); /*demangled_name */ if (!ref_static) { - static struct deprecated_complaint msg = - {"\ - Unable to find symbol for static data field %s\n", - 0, 0}; - complain (&msg, sname); + complaint (&symfile_complaints, + "Unable to find symbol for static data field %s", sname); continue; } stype = SYMBOL_TYPE (ref_static); @@ -4389,10 +4365,8 @@ attach_fields_to_type (struct field_info *fip, register struct type *type, default: /* Unknown visibility. Complain and treat it as public. */ { - static struct deprecated_complaint msg = - { - "Unknown visibility `%c' for field", 0, 0}; - complain (&msg, fip->list->visibility); + complaint (&symfile_complaints, "Unknown visibility `%c' for field", + fip->list->visibility); } break; } @@ -4402,10 +4376,6 @@ attach_fields_to_type (struct field_info *fip, register struct type *type, } -static struct deprecated_complaint multiply_defined_struct = -{"struct/union type gets multiply defined: %s%s", 0, 0}; - - /* Complain that the compiler has emitted more than one definition for the structure type TYPE. */ static void @@ -4436,7 +4406,8 @@ complain_about_struct_wipeout (struct type *type) kind = ""; } - complain (&multiply_defined_struct, kind, name); + complaint (&symfile_complaints, + "struct/union type gets multiply defined: %s%s", kind, name); } @@ -5138,7 +5109,8 @@ handle_true_range: static struct type *range_type_index; - complain (&range_type_base_complaint, rangenums[1]); + complaint (&symfile_complaints, + "base type %d of range type is not defined", rangenums[1]); if (range_type_index == NULL) range_type_index = init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT, @@ -5214,11 +5186,8 @@ common_block_start (char *name, struct objfile *objfile) { if (common_block_name != NULL) { - static struct deprecated_complaint msg = - { - "Invalid symbol data: common block within common block", - 0, 0}; - complain (&msg); + complaint (&symfile_complaints, + "Invalid symbol data: common block within common block"); } common_block = local_symbols; common_block_i = local_symbols ? local_symbols->nsyms : 0; @@ -5244,9 +5213,7 @@ common_block_end (struct objfile *objfile) if (common_block_name == NULL) { - static struct deprecated_complaint msg = - {"ECOMM symbol unmatched by BCOMM", 0, 0}; - complain (&msg); + complaint (&symfile_complaints, "ECOMM symbol unmatched by BCOMM"); return; } @@ -5359,9 +5326,7 @@ cleanup_undefined_types (void) if (typename == NULL) { - static struct deprecated_complaint msg = - {"need a type name", 0, 0}; - complain (&msg); + complaint (&symfile_complaints, "need a type name"); break; } for (ppt = file_symbols; ppt; ppt = ppt->next) @@ -5384,10 +5349,9 @@ cleanup_undefined_types (void) default: { - static struct deprecated_complaint msg = - {"\ -GDB internal error. cleanup_undefined_types with bad type %d.", 0, 0}; - complain (&msg, TYPE_CODE (*type)); + complaint (&symfile_complaints, + "GDB internal error. cleanup_undefined_types with bad type %d.", + TYPE_CODE (*type)); } break; } @@ -5547,8 +5511,9 @@ scan_file_globals (struct objfile *objfile) if (SYMBOL_CLASS (prev) == LOC_STATIC) SYMBOL_CLASS (prev) = LOC_UNRESOLVED; else - complain (&unresolved_sym_chain_complaint, - objfile->name, SYMBOL_NAME (prev)); + complaint (&symfile_complaints, + "%s: common block `%s' from global_sym_chain unresolved", + objfile->name, SYMBOL_NAME (prev)); } } memset (global_sym_chain, 0, sizeof (global_sym_chain)); diff --git a/gdb/stabsread.h b/gdb/stabsread.h index 1371f6c56ce..017074bf53d 100644 --- a/gdb/stabsread.h +++ b/gdb/stabsread.h @@ -128,9 +128,6 @@ EXTERN int n_this_object_header_files; EXTERN int n_allocated_this_object_header_files; -extern struct deprecated_complaint unknown_symtype_complaint; -extern struct deprecated_complaint unknown_symchar_complaint; - extern struct type *read_type (char **, struct objfile *); extern void cleanup_undefined_types (void); diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 87329f1c1c1..5bdb88c7ad2 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -150,17 +150,25 @@ struct coff_symfile_info CORE_ADDR toc_offset; }; -static struct deprecated_complaint storclass_complaint = -{"Unexpected storage class: %d", 0, 0}; - -static struct deprecated_complaint bf_notfound_complaint = -{"line numbers off, `.bf' symbol not found", 0, 0}; +static void +bf_notfound_complaint (void) +{ + complaint (&symfile_complaints, "line numbers off, `.bf' symbol not found"); +} -static struct deprecated_complaint ef_complaint = -{"Mismatched .ef symbol ignored starting at symnum %d", 0, 0}; +static void +ef_complaint (int arg1) +{ + complaint (&symfile_complaints, + "Mismatched .ef symbol ignored starting at symnum %d", arg1); +} -static struct deprecated_complaint eb_complaint = -{"Mismatched .eb symbol ignored starting at symnum %d", 0, 0}; +static void +eb_complaint (int arg1) +{ + complaint (&symfile_complaints, + "Mismatched .eb symbol ignored starting at symnum %d", arg1); +} static void xcoff_initial_scan (struct objfile *, int); @@ -483,9 +491,7 @@ record_include_begin (struct coff_symbol *cs) /* This can happen with old versions of GCC. GCC 2.3.3-930426 does not exhibit this on a test case which a user said produced the message for him. */ - static struct deprecated_complaint msg = - {"Nested C_BINCL symbols", 0, 0}; - complain (&msg); + complaint (&symfile_complaints, "Nested C_BINCL symbols"); } ++inclDepth; @@ -502,9 +508,7 @@ record_include_end (struct coff_symbol *cs) if (inclDepth == 0) { - static struct deprecated_complaint msg = - {"Mismatched C_BINCL/C_EINCL pair", 0, 0}; - complain (&msg); + complaint (&symfile_complaints, "Mismatched C_BINCL/C_EINCL pair"); } allocate_include_entry (); @@ -766,9 +770,8 @@ enter_line_range (struct subfile *subfile, unsigned beginoffset, unsigned endoff { if (endoffset >= limit_offset) { - static struct deprecated_complaint msg = - {"Bad line table offset in C_EINCL directive", 0, 0}; - complain (&msg); + complaint (&symfile_complaints, + "Bad line table offset in C_EINCL directive"); return; } limit_offset = endoffset; @@ -864,8 +867,6 @@ static char * xcoff_next_symbol_text (struct objfile *objfile) { struct internal_syment symbol; - static struct deprecated_complaint msg = - {"Unexpected symbol continuation", 0, 0}; char *retval; /* FIXME: is this the same as the passed arg? */ objfile = this_symtab_psymtab->objfile; @@ -873,7 +874,7 @@ xcoff_next_symbol_text (struct objfile *objfile) bfd_coff_swap_sym_in (objfile->obfd, raw_symbol, &symbol); if (symbol.n_zeroes) { - complain (&msg); + complaint (&symfile_complaints, "Unexpected symbol continuation"); /* Return something which points to '\0' and hope the symbol reading code does something reasonable. */ @@ -890,7 +891,7 @@ xcoff_next_symbol_text (struct objfile *objfile) } else { - complain (&msg); + complaint (&symfile_complaints, "Unexpected symbol continuation"); /* Return something which points to '\0' and hope the symbol reading code does something reasonable. */ @@ -1282,7 +1283,7 @@ read_xcoff_symtab (struct partial_symtab *pst) if (context_stack_depth <= 0) { /* We attempted to pop an empty context stack */ - complain (&ef_complaint, cs->c_symnum); + ef_complaint (cs->c_symnum); within_function = 0; break; } @@ -1290,7 +1291,7 @@ read_xcoff_symtab (struct partial_symtab *pst) /* Stack must be empty now. */ if (context_stack_depth > 0 || new == NULL) { - complain (&ef_complaint, cs->c_symnum); + ef_complaint (cs->c_symnum); within_function = 0; break; } @@ -1332,9 +1333,8 @@ read_xcoff_symtab (struct partial_symtab *pst) case C_UNTAG: case C_ENTAG: { - static struct deprecated_complaint msg = - {"Unrecognized storage class %d.", 0, 0}; - complain (&msg, cs->c_sclass); + complaint (&symfile_complaints, "Unrecognized storage class %d.", + cs->c_sclass); } break; @@ -1376,13 +1376,13 @@ read_xcoff_symtab (struct partial_symtab *pst) { if (context_stack_depth <= 0) { /* We attempted to pop an empty context stack */ - complain (&eb_complaint, cs->c_symnum); + eb_complaint (cs->c_symnum); break; } new = pop_context (); if (depth-- != new->depth) { - complain (&eb_complaint, cs->c_symnum); + eb_complaint (cs->c_symnum); break; } if (local_symbols && context_stack_depth > 0) @@ -1520,7 +1520,8 @@ process_xcoff_symbol (register struct coff_symbol *cs, struct objfile *objfile) break; default: - complain (&storclass_complaint, cs->c_sclass); + complaint (&symfile_complaints, "Unexpected storage class: %d", + cs->c_sclass); /* FALLTHROUGH */ case C_DECL: @@ -1603,9 +1604,7 @@ read_symbol (struct internal_syment *symbol, int symno) ->symtbl; if (symno < 0 || symno >= nsyms) { - static struct deprecated_complaint msg = - {"Invalid symbol offset", 0, 0}; - complain (&msg); + complaint (&symfile_complaints, "Invalid symbol offset"); symbol->n_value = 0; symbol->n_scnum = -1; return; @@ -1647,7 +1646,7 @@ read_symbol_lineno (int symno) if (symno < 0) { - complain (&bf_notfound_complaint); + bf_notfound_complaint (); return 0; } @@ -1680,7 +1679,7 @@ read_symbol_lineno (int symno) symno += symbol->n_numaux + 1; } - complain (&bf_notfound_complaint); + bf_notfound_complaint (); return 0; gotit: @@ -2117,6 +2116,14 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux, } } +static void +function_outside_compilation_unit_complaint (const char *arg1) +{ + complaint (&symfile_complaints, + "function `%s' appears to be defined outside of all compilation units", + arg1); +} + static void scan_xcoff_symtab (struct objfile *objfile) { @@ -2442,9 +2449,8 @@ scan_xcoff_symtab (struct objfile *objfile) default: { - static struct deprecated_complaint msg = - {"Storage class %d not recognized during scan", 0, 0}; - complain (&msg, sclass); + complaint (&symfile_complaints, + "Storage class %d not recognized during scan", sclass); } /* FALLTHROUGH */ @@ -2564,11 +2570,6 @@ scan_xcoff_symtab (struct objfile *objfile) case C_DECL: case C_STSYM: { - - static struct deprecated_complaint function_outside_compilation_unit = { - "function `%s' appears to be defined outside of all compilation units", 0, 0 - }; - char *p; swap_sym (&symbol, &main_aux[0], &namestring, &sraw_symbol, &ssymnum, objfile); @@ -2748,7 +2749,7 @@ scan_xcoff_symtab (struct objfile *objfile) char *name = xmalloc (name_len + 1); memcpy (name, namestring, name_len); name[name_len] = '\0'; - complain (&function_outside_compilation_unit, name); + function_outside_compilation_unit_complaint (name); xfree (name); } symbol.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -2769,7 +2770,7 @@ scan_xcoff_symtab (struct objfile *objfile) char *name = xmalloc (name_len + 1); memcpy (name, namestring, name_len); name[name_len] = '\0'; - complain (&function_outside_compilation_unit, name); + function_outside_compilation_unit_complaint (name); xfree (name); } symbol.n_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); @@ -2820,7 +2821,8 @@ scan_xcoff_symtab (struct objfile *objfile) time searching to the end of every string looking for a backslash. */ - complain (&unknown_symchar_complaint, p[1]); + complaint (&symfile_complaints, + "unknown symbol descriptor `%c'", p[1]); /* Ignore it; perhaps it is an extension that we don't know about. */