diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1994-05-13 18:18:57 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1994-05-13 18:18:57 +0000 |
commit | 1c95d7ab2e12e00756d21ef44c7539f8f9edc56f (patch) | |
tree | 1366d0687b8ad6294d7cbb151227f81b4f3280da /gdb/coffread.c | |
parent | f3e72e3771ea66fb319fe96b96403ef212dbfb50 (diff) | |
download | gdb-1c95d7ab2e12e00756d21ef44c7539f8f9edc56f.zip gdb-1c95d7ab2e12e00756d21ef44c7539f8f9edc56f.tar.gz gdb-1c95d7ab2e12e00756d21ef44c7539f8f9edc56f.tar.bz2 |
gcc -Wall lint:
* breakpoint.c (watchpoint_check): Remove unused variable b.
* stack.c (print_frame_info): Move sp and buf inside #if.
* eval.c (evaluate_subexp): Remove unused variables pp,
mangle_ptr, ptr, and mangle_tstr.
* valarith.c (value_x_binop): Remove unused variables mangle_tstr
and mangle_ptr.
* symtab.c (lookup_symtab): Put variable copy inside #if.
(decode_line_1): Put variable q1 inside #if 0.
* target.h: Declare target_link.
* infrun.c (wait_for_inferior): Remove unused variables signame.
* remote.c (remote_resume): Remove unused variable name.
* c-exp.y (parse_number): Parenthesize operand of shift.
* dbxread.c (record_minimal_symbol): Parenthesize operand of &&
(this is a semantic change, the warning seems to have detected a bug).
* dbxread.c (end_psymtab): Move variable p1 inside #if.
* coffread.c: Move variable temptype inside #if.
* ch-typeprint.c (chill_type_print_base): Remove unused variable
name.
* ch-valprint.c: #include typeprint.h and ch-lang.h.
(chill_val_print): Remove unused variable in_range.
(chill_val_print): Remove statement "length > TYPE_LENGTH (type);".
(chill_val_print): Add default case for switch.
* stabsread.h: Declare stabsect_build_psymtabs.
* os9kread.c (read_minimal_symbols): Make this return void.
(os9k_symfile_read): Remove unused variables stb_exist and val.
(os9k_symfile_init): Remove unused variable val.
(fill_sym): Remove unused variable id.
(read_os9k_psymtab): Put variable back_to inside #if 0. Remove
unused variable nsl.
Remove unused variable symfile_bfd.
#if 0 unused variables lbrac_unmatched_complaint and
lbrac_mismatch_complaint.
Remove declaration for non-existent function os9k_next_symbol_text.
* annotate.c, annotate.h: New files, containing a function for
each annotation which outputs it.
* Move breakpoints_changed from breakpoint.c to annotate.c.
* breakpoint.c, blockframe.c, infrun.c, cp-valprint.c, main.c,
printcmd.c, source.c, stack.c, utils.c, valprint.c:
Use annotate.c functions to output annotations.
* Makefile.in (OBS): Add annotate.o.
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r-- | gdb/coffread.c | 138 |
1 files changed, 81 insertions, 57 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c index 0797a93..ff74f47 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -143,8 +143,6 @@ static struct symbol *opaque_type_chain[HASHSIZE]; struct type *in_function_type; #endif -struct pending_block *pending_blocks; - /* Complaints about various problems in the file being read */ struct complaint ef_complaint = @@ -900,29 +898,32 @@ read_coff_symtab (symtab_offset, nsyms, objfile) break; /* fall in for static symbols that don't start with '.' */ case C_EXT: - /* Record external symbols in minsyms if we don't have debug - info for them. FIXME, this is probably the wrong thing - to do. Why don't we record them even if we do have - debug symbol info? What really belongs in the minsyms - anyway? Fred!?? */ - if (!SDB_TYPE (cs->c_type)) { - /* FIXME: This is BOGUS Will Robinson! - Coff should provide the SEC_CODE flag for executable sections, - then if we could look up sections by section number we - could see if the flags indicate SEC_CODE. If so, then - record this symbol as a function in the minimal symbol table. - But why are absolute syms recorded as functions, anyway? */ - if (cs->c_secnum <= text_bfd_scnum+1) {/* text or abs */ - record_minimal_symbol (cs->c_name, cs->c_value, - mst_text, objfile); - break; - } else { - record_minimal_symbol (cs->c_name, cs->c_value, - mst_data, objfile); - break; - } - } - process_coff_symbol (cs, &main_aux, objfile); + /* Record it in the minimal symbols regardless of SDB_TYPE. + This parallels what we do for other debug formats, and + probably is needed to make print_address_symbolic work right + without the "set fast-symbolic-addr off" kludge. */ + + /* FIXME: This bogusly assumes the sections are in a certain + order, text (SEC_CODE) sections are before data sections, + etc. */ + if (cs->c_secnum <= text_bfd_scnum+1) + { + /* text or absolute. (FIXME, should use mst_abs if + absolute). */ + record_minimal_symbol + (cs->c_name, cs->c_value, + cs->c_sclass == C_STAT ? mst_file_text : mst_text, + objfile); + } + else + { + record_minimal_symbol + (cs->c_name, cs->c_value, + cs->c_sclass == C_STAT ? mst_file_data : mst_data, + objfile); + } + if (SDB_TYPE (cs->c_type)) + process_coff_symbol (cs, &main_aux, objfile); break; case C_FCN: @@ -1412,7 +1413,6 @@ process_coff_symbol (cs, aux, objfile) = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); char *name; - struct type *temptype; memset (sym, 0, sizeof (struct symbol)); name = cs->c_name; @@ -1502,16 +1502,19 @@ process_coff_symbol (cs, aux, objfile) #endif add_symbol_to_list (sym, &local_symbols); #if !defined (BELIEVE_PCC_PROMOTION) && (TARGET_BYTE_ORDER == BIG_ENDIAN) - /* If PCC says a parameter is a short or a char, - aligned on an int boundary, realign it to the "little end" - of the int. */ - temptype = lookup_fundamental_type (current_objfile, FT_INTEGER); - if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype) - && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT - && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (temptype)) + { + /* If PCC says a parameter is a short or a char, + aligned on an int boundary, realign it to the "little end" + of the int. */ + struct type *temptype; + temptype = lookup_fundamental_type (current_objfile, FT_INTEGER); + if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype) + && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT + && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (temptype)) { - SYMBOL_VALUE (sym) += TYPE_LENGTH (temptype) - - TYPE_LENGTH (SYMBOL_TYPE (sym)); + SYMBOL_VALUE (sym) += + TYPE_LENGTH (temptype) + - TYPE_LENGTH (SYMBOL_TYPE (sym)); } #endif break; @@ -1523,17 +1526,21 @@ process_coff_symbol (cs, aux, objfile) #if !defined (BELIEVE_PCC_PROMOTION) /* FIXME: This should retain the current type, since it's just a register value. gnu@adobe, 26Feb93 */ - /* If PCC says a parameter is a short or a char, - it is really an int. */ - temptype = lookup_fundamental_type (current_objfile, FT_INTEGER); - if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype) - && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT) - { - SYMBOL_TYPE (sym) = TYPE_UNSIGNED (SYMBOL_TYPE (sym)) - ? lookup_fundamental_type (current_objfile, - FT_UNSIGNED_INTEGER) - : temptype; - } + { + /* If PCC says a parameter is a short or a char, + it is really an int. */ + struct type *temptype; + temptype = + lookup_fundamental_type (current_objfile, FT_INTEGER); + if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype) + && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT) + { + SYMBOL_TYPE (sym) = + (TYPE_UNSIGNED (SYMBOL_TYPE (sym)) + ? lookup_fundamental_type (current_objfile, + FT_UNSIGNED_INTEGER) + : temptype); + } #endif break; @@ -1543,7 +1550,34 @@ process_coff_symbol (cs, aux, objfile) /* If type has no name, give it one */ if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) - TYPE_NAME (SYMBOL_TYPE (sym)) = concat (SYMBOL_NAME (sym), NULL); + { + if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR + || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC) + { + /* If we are giving a name to a type such as "pointer to + foo" or "function returning foo", we better not set + the TYPE_NAME. If the program contains "typedef char + *caddr_t;", we don't want all variables of type char + * to print as caddr_t. This is not just a + consequence of GDB's type management; CC and GCC (at + least through version 2.4) both output variables of + either type char * or caddr_t with the type + refering to the C_TPDEF symbol for caddr_t. If a future + compiler cleans this up it GDB is not ready for it + yet, but if it becomes ready we somehow need to + disable this check (without breaking the PCC/GCC2.4 + case). + + Sigh. + + Fortunately, this check seems not to be necessary + for anything except pointers or functions. */ + ; + } + else + TYPE_NAME (SYMBOL_TYPE (sym)) = + concat (SYMBOL_NAME (sym), NULL); + } /* Keep track of any type which points to empty structured type, so it can be filled from a definition from another file. A @@ -2017,16 +2051,6 @@ coff_read_enum_type (index, length, lastsym) break; } -#if 0 - /* This screws up perfectly good C programs with enums. FIXME. */ - /* Is this Modula-2's BOOLEAN type? Flag it as such if so. */ - if(TYPE_NFIELDS(type) == 2 && - ((STREQ(TYPE_FIELD_NAME(type,0),"TRUE") && - STREQ(TYPE_FIELD_NAME(type,1),"FALSE")) || - (STREQ(TYPE_FIELD_NAME(type,1),"TRUE") && - STREQ(TYPE_FIELD_NAME(type,0),"FALSE")))) - TYPE_CODE(type) = TYPE_CODE_BOOL; -#endif return type; } |