From: Fred Fish Date: Sat, 30 Mar 1996 05:45:10 +0000 (+0000) Subject: * core-aout.c (fetch_core_registers): Cast core_reg_size to int X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b52cac6b76cd1f1662d62c630a5aabc13a70dfb8;p=binutils-gdb.git * core-aout.c (fetch_core_registers): Cast core_reg_size to int before testing against reg_ptr. * eval.c (evaluate_subexp_standard): Cast type of TYPE_FN_FIELD_VOFFSET to int. * findvar.c (extract_signed_integer, extract_unsigned_integer, extract_long_unsigned_integer): Cast type of sizeof to int. * values.c (unpack_field_as_long, modify_field): Ditto. * valops.c (value_assign, call_function_by_hand): Ditto. * infcmd.c (do_registers_info): Ditto. * ser-tcp.c (tcp_open): Ditto * remote.c (putpkt): Ditto. * dcache.c (dcache_peek): Ditto. * dcache.c (dcache_poke): Ditto. * m2-exp.y (yylex): Ditto. * gnu-regex.c (re_match_2): Ditto. * f-lang.c (ADD_BF_SYMNUM, saved_bf_list_end, tmp_bf_ptr): Ifdef out unused macro definition and variables. * inftarg.c (proc_wait): Move from main.c to here, and make static. * valprint.c (val_print_string): Change bufsize from int to unsigned. * main.c (wait.h): Include * top.c (command_line_input): Remove unused variable "c". * f-typeprint.c (f_type_print_varspec_prefix): Add missing enum value TYPE_CODE_TYPEDEF to switch statement. (f_type_print_varspec_suffix): Add missing enum value TYPE_CODE_TYPEDEF to switch statement. * ch-exp.c (parse_primval): Add remaining enumeration values to switch statement, with no specific action. (ch_lex): Add LOC_UNRESOLVED in switch statement. (pushback_token): Ifdef out, since code using it is ifdef'd out. * stabsread.c (cleanup_undefined_types): Remove unused label "badtype". * objfiles.h (print_symbol_bcache_statistics): Add prototype. * maint.c (objfiles.h): Include. (maintenance_print_statistics): Remove unused variable "temp". * minsyms.c (lookup_minimal_symbol_solib_trampoline): Remove unused variable "found_file_symbol". * m2-exp.y (yylex): Add LOC_UNRESOLVED case to switch. * language.c (lang_bool_type): Use existing function local type variable rather than create block local variables. * solib.c (disable_break): Enclose in ifndef SVR4_SHARED_LIBS. * infptrace.c (wait.h, command.h): Include. * ser-tcp.c (gdb_string.h): Include * i386-tdep.c (codestream_seek): Change "place" to CORE_ADDR. (i386_get_frame_setup): Change "pc" from int to CORE_ADDR. * command.c (complete_on_enum): Make assignment used as truth value explictly check against NULL. (wait.h): Include. * infrun.c (wait_for_inferior): Ifdef out prologue_pc since code that uses it is ifdef'd out. * parser-defs.h: Add prototype for write_dollar_variable. * infrun.c: Add prototype for write_pc_pid. * breakpoint.h: Add prototype for re_enable_breakpoints_in_shlibs. * symmisc.c (bcache.h): Include. * bcache.h: Add prototype for print_bcache_statistics. * symfile.c: Include . * printcmd.c (print_scalar_formatted): Change len to unsigned int. * valarith.c (value_equal): Cast result of TYPE_LENGTH to int. * valarith.c (value_binop): Change result_len, promoted_len1, and promoted_len2 to unsigned int. * valarith.c (value_subscripted_rvalue): Change elt_offs and elt_size to unsigned int. * valops.c (value_array): Change typelength to unsigned int. (destructor_name_p): Change len to unsigned int. * scm-lang.h (scm_parse): Add prototype for scm_unpack. * symfile.c (decrement_reading_symtab): Change return type to void. * valarith.c (value_subscript): Remove unused variable "word". (value_subscript): Remove unused variable "tint". * valops.c (auto_abandon): Ifdef out, since code using it is also ifdef'd out. * eval.c (init_array_element): Remove unused variable "val". * Makefile.in (values.o): Depends on scm-lang.h. (command.o): Depends upon wait_h. (ser-tcp.o): Depends upon gdb_string.h. (infptrace.o): Depends upon wait_h and command_h. (maint.o): Depends on objfiles.h and symfile.h. * values.c (allocate_repeat_value): Remove unused variable "element_type". (scm-lang.h): Include. * breakpoint.c (create_longjmp_breakpoint): Enclose in GET_LONGJMP_TARGET define, unused otherwise. * config/i386/nm-linux.h: Add prototypes for i386_insert_watchpoint, i386_remove_watchpoint and i386_stopped_by_watchpoint. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 441e26a28bc..e5c06a5dfb5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,88 @@ +Fri Mar 29 21:39:56 1996 Fred Fish + + * core-aout.c (fetch_core_registers): Cast core_reg_size to int + before testing against reg_ptr. + * eval.c (evaluate_subexp_standard): Cast type of + TYPE_FN_FIELD_VOFFSET to int. + * findvar.c (extract_signed_integer, extract_unsigned_integer, + extract_long_unsigned_integer): Cast type of sizeof to int. + * values.c (unpack_field_as_long, modify_field): Ditto. + * valops.c (value_assign, call_function_by_hand): Ditto. + * infcmd.c (do_registers_info): Ditto. + * ser-tcp.c (tcp_open): Ditto + * remote.c (putpkt): Ditto. + * dcache.c (dcache_peek): Ditto. + * dcache.c (dcache_poke): Ditto. + * m2-exp.y (yylex): Ditto. + * gnu-regex.c (re_match_2): Ditto. + * f-lang.c (ADD_BF_SYMNUM, saved_bf_list_end, tmp_bf_ptr): Ifdef + out unused macro definition and variables. + * inftarg.c (proc_wait): Move from main.c to here, and make static. + * valprint.c (val_print_string): Change bufsize from int to unsigned. + * main.c (wait.h): Include + * top.c (command_line_input): Remove unused variable "c". + * f-typeprint.c (f_type_print_varspec_prefix): Add missing enum + value TYPE_CODE_TYPEDEF to switch statement. + (f_type_print_varspec_suffix): Add missing enum value + TYPE_CODE_TYPEDEF to switch statement. + * ch-exp.c (parse_primval): Add remaining enumeration values to + switch statement, with no specific action. + (ch_lex): Add LOC_UNRESOLVED in switch statement. + (pushback_token): Ifdef out, since code using it is ifdef'd out. + * stabsread.c (cleanup_undefined_types): Remove unused label + "badtype". + * objfiles.h (print_symbol_bcache_statistics): Add prototype. + * maint.c (objfiles.h): Include. + (maintenance_print_statistics): Remove unused variable "temp". + * minsyms.c (lookup_minimal_symbol_solib_trampoline): Remove + unused variable "found_file_symbol". + * m2-exp.y (yylex): Add LOC_UNRESOLVED case to switch. + * language.c (lang_bool_type): Use existing function local type + variable rather than create block local variables. + * solib.c (disable_break): Enclose in ifndef SVR4_SHARED_LIBS. + * infptrace.c (wait.h, command.h): Include. + * ser-tcp.c (gdb_string.h): Include + * i386-tdep.c (codestream_seek): Change "place" to CORE_ADDR. + (i386_get_frame_setup): Change "pc" from int to CORE_ADDR. + * command.c (complete_on_enum): Make assignment used as truth value + explictly check against NULL. + (wait.h): Include. + * infrun.c (wait_for_inferior): Ifdef out prologue_pc since code + that uses it is ifdef'd out. + * parser-defs.h: Add prototype for write_dollar_variable. + * infrun.c: Add prototype for write_pc_pid. + * breakpoint.h: Add prototype for re_enable_breakpoints_in_shlibs. + * symmisc.c (bcache.h): Include. + * bcache.h: Add prototype for print_bcache_statistics. + * symfile.c: Include . + * printcmd.c (print_scalar_formatted): Change len to unsigned int. + * valarith.c (value_equal): Cast result of TYPE_LENGTH to int. + * valarith.c (value_binop): Change result_len, promoted_len1, + and promoted_len2 to unsigned int. + * valarith.c (value_subscripted_rvalue): Change elt_offs and + elt_size to unsigned int. + * valops.c (value_array): Change typelength to unsigned int. + (destructor_name_p): Change len to unsigned int. + * scm-lang.h (scm_parse): Add prototype for scm_unpack. + * symfile.c (decrement_reading_symtab): Change return type to void. + * valarith.c (value_subscript): Remove unused variable "word". + (value_subscript): Remove unused variable "tint". + * valops.c (auto_abandon): Ifdef out, since code using it is also + ifdef'd out. + * eval.c (init_array_element): Remove unused variable "val". + * Makefile.in (values.o): Depends on scm-lang.h. + (command.o): Depends upon wait_h. + (ser-tcp.o): Depends upon gdb_string.h. + (infptrace.o): Depends upon wait_h and command_h. + (maint.o): Depends on objfiles.h and symfile.h. + * values.c (allocate_repeat_value): Remove unused variable + "element_type". + (scm-lang.h): Include. + * breakpoint.c (create_longjmp_breakpoint): Enclose in + GET_LONGJMP_TARGET define, unused otherwise. + * config/i386/nm-linux.h: Add prototypes for i386_insert_watchpoint, + i386_remove_watchpoint and i386_stopped_by_watchpoint. + Thu Mar 28 12:53:19 1996 Doug Evans * configure.in (sparc64-*-solaris2*): Delete. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index b5b5804b8d2..464573e842f 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -206,7 +206,7 @@ CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \ ADD_FILES = $(REGEX) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) ADD_DEPS = $(REGEX1) $(XM_ADD_FILES) $(TM_ADD_FILES) $(NAT_ADD_FILES) -VERSION = 4.15.2 +VERSION = 4.15.3 DIST=gdb LINT=/usr/5bin/lint @@ -1055,7 +1055,7 @@ coffread.o: coffread.c $(bfd_h) $(breakpoint_h) buildsym.h \ gdb_string.h command.o: command.c $(defs_h) $(expression_h) $(gdbcmd_h) \ - $(gdbtypes_h) $(symtab_h) $(value_h) gdb_string.h + $(gdbtypes_h) $(symtab_h) $(value_h) gdb_string.h $(wait_h) complaints.o: complaints.c complaints.h $(defs_h) $(gdbcmd_h) @@ -1190,7 +1190,7 @@ inflow.o: inflow.c $(bfd_h) $(command_h) $(defs_h) $(inferior_h) \ signals.h target.h terminal.h thread.h gdb_string.h infptrace.o: infptrace.c $(defs_h) $(gdbcore_h) $(inferior_h) target.h \ - gdb_string.h + gdb_string.h $(wait_h) $(command_h) infrun.o: infrun.c $(wait_h) $(defs_h) $(gdbcmd_h) $(gdbcore_h) \ $(inferior_h) target.h thread.h gdb_string.h @@ -1238,7 +1238,7 @@ mac-nat.o: mac-nat.c $(defs_h) gdb_string.h main.o: main.c top.h $(defs_h) gdb_string.h maint.o: maint.c $(defs_h) $(gdbcmd_h) $(gdbtypes_h) $(symtab_h) language.h \ - $(expression_h) + $(expression_h) objfiles.h symfile.h mdebugread.o: mdebugread.c buildsym.h complaints.h $(bfd_h) $(defs_h) \ $(expression_h) gdb-stabs.h $(gdbcore_h) $(gdbtypes_h) language.h \ @@ -1412,7 +1412,7 @@ ser-go32.o: ser-go32.c $(defs_h) serial.h ser-mac.o: ser-mac.c $(defs_h) serial.h signals.h -ser-tcp.o: ser-tcp.c $(defs_h) serial.h signals.h +ser-tcp.o: ser-tcp.c $(defs_h) serial.h signals.h gdb_string.h ser-unix.o: ser-unix.c $(defs_h) serial.h @@ -1510,7 +1510,7 @@ valprint.o: valprint.c $(defs_h) $(expression_h) $(gdbcmd_h) \ values.o: values.c $(defs_h) $(expression_h) $(frame_h) $(gdbcmd_h) \ $(gdbcore_h) $(gdbtypes_h) $(symtab_h) target.h $(value_h) \ - gdb_string.h + gdb_string.h scm-lang.h vax-tdep.o: vax-tdep.c $(OP_INCLUDE)/vax.h $(defs_h) $(symtab_h) diff --git a/gdb/bcache.h b/gdb/bcache.h index 1e6d25a547a..48b71e28cf0 100644 --- a/gdb/bcache.h +++ b/gdb/bcache.h @@ -62,4 +62,11 @@ struct bcache { extern void * bcache PARAMS ((void *bytes, int count, struct bcache *bcachep)); +#if MAINTENANCE_CMDS + +extern void +print_bcache_statistics PARAMS ((struct bcache *, char *)); + +#endif /* MAINTENANCE_CMDS */ + #endif /* BCACHE_H */ diff --git a/gdb/ch-exp.c b/gdb/ch-exp.c index af43fc281c2..ce5f49efdb3 100644 --- a/gdb/ch-exp.c +++ b/gdb/ch-exp.c @@ -75,6 +75,7 @@ typedef union enum ch_terminal { END_TOKEN = 0, /* '\001' ... '\xff' come first. */ + OPEN_PAREN = '(', TOKEN_NOT_READ = 999, INTEGER_LITERAL, BOOLEAN_LITERAL, @@ -176,6 +177,8 @@ peek_token_ (i) return terminal_buffer[i]; } +#if 0 + static void pushback_token (code, node) enum ch_terminal code; @@ -193,6 +196,8 @@ pushback_token (code, node) val_buffer[0] = node; } +#endif + static void forward_token_() { @@ -778,7 +783,7 @@ parse_primval () } write_exp_elt_opcode (UNOP_IND); continue; - case '(': + case OPEN_PAREN: parse_call (); continue; case CHARACTER_STRING_LITERAL: @@ -790,6 +795,55 @@ parse_primval () write_exp_elt_longcst (1); write_exp_elt_opcode (MULTI_SUBSCRIPT); continue; + case END_TOKEN: + case TOKEN_NOT_READ: + case INTEGER_LITERAL: + case BOOLEAN_LITERAL: + case FLOAT_LITERAL: + case GENERAL_PROCEDURE_NAME: + case LOCATION_NAME: + case EMPTINESS_LITERAL: + case TYPENAME: + case CASE: + case OF: + case ESAC: + case LOGIOR: + case ORIF: + case LOGXOR: + case LOGAND: + case ANDIF: + case NOTEQUAL: + case GEQ: + case LEQ: + case IN: + case SLASH_SLASH: + case MOD: + case REM: + case NOT: + case RECEIVE: + case UP: + case IF: + case THEN: + case ELSE: + case FI: + case ELSIF: + case ILLEGAL_TOKEN: + case NUM: + case PRED: + case SUCC: + case ABS: + case CARD: + case MAX_TOKEN: + case MIN_TOKEN: + case ADDR_TOKEN: + case SIZE: + case UPPER: + case LOWER: + case LENGTH: + case ARRAY: + case GDB_VARIABLE: + case GDB_ASSIGNMENT: + break; } break; } @@ -1977,6 +2031,9 @@ ch_lex () case LOC_OPTIMIZED_OUT: error ("Symbol \"%s\" names no location.", inputname); break; + case LOC_UNRESOLVED: + error ("unhandled SYMBOL_CLASS in ch_lex()"); + break; } } else if (!have_full_symbols () && !have_partial_symbols ()) diff --git a/gdb/command.c b/gdb/command.c index 2ad1ebe0f1d..a5477ddd327 100644 --- a/gdb/command.c +++ b/gdb/command.c @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdbcmd.h" #include "symtab.h" #include "value.h" +#include "wait.h" #include #include "gdb_string.h" #ifdef HAVE_UNISTD_H @@ -1048,7 +1049,7 @@ complete_on_enum (enumlist, text, word) matchlist = (char **) xmalloc (sizeof_matchlist * sizeof (char *)); matches = 0; - for (i = 0; name = enumlist[i]; i++) + for (i = 0; (name = enumlist[i]) != NULL; i++) if (strncmp (name, text, textlen) == 0) { if (matches == sizeof_matchlist) diff --git a/gdb/core-aout.c b/gdb/core-aout.c index 32eef961146..7103a9c8e13 100644 --- a/gdb/core-aout.c +++ b/gdb/core-aout.c @@ -84,7 +84,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr) CORE_REGISTER_ADDR to offset to the other registers. If this is a modern core file without a upage, reg_ptr will be zero and this is all a big NOP. */ - if (reg_ptr > core_reg_size) + if (reg_ptr > (int) core_reg_size) reg_ptr -= KERNEL_U_ADDR; for (regno = 0; regno < numregs; regno++) diff --git a/gdb/dcache.c b/gdb/dcache.c index 1e9a37d8ce6..9f44e96b9f7 100644 --- a/gdb/dcache.c +++ b/gdb/dcache.c @@ -355,7 +355,7 @@ dcache_peek (dcache, addr, data) { char *dp = (char *) data; int i; - for (i = 0; i < sizeof (int); i++) + for (i = 0; i < (int) sizeof (int); i++) { if (!dcache_peek_byte (dcache, addr + i, dp + i)) return 0; @@ -433,7 +433,7 @@ dcache_poke (dcache, addr, data) { char *dp = (char *) (&data); int i; - for (i = 0; i < sizeof (int); i++) + for (i = 0; i < (int) sizeof (int); i++) { if (!dcache_poke_byte (dcache, addr + i, dp + i)) return 0; diff --git a/gdb/eval.c b/gdb/eval.c index 87417f34eb9..d0add2392c2 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -335,7 +335,6 @@ init_array_element (array, element, exp, pos, noside, low_bound, high_bound) else if (exp->elts[*pos].opcode == BINOP_RANGE) { LONGEST low, high; - value_ptr val; (*pos)++; low = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); high = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); @@ -460,11 +459,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) case OP_BOOL: (*pos) += 2; - if (current_language->la_language == language_fortran) - return value_from_longest (builtin_type_f_logical_s2, - exp->elts[pc + 1].longconst); - else - return value_from_longest (builtin_type_chill_bool, + return value_from_longest (LA_BOOL_TYPE, exp->elts[pc + 1].longconst); case OP_INTERNALVAR: @@ -698,7 +693,7 @@ evaluate_subexp_standard (expect_type, exp, pos, noside) /* If one is virtual, then all are virtual. */ if (TYPE_FN_FIELD_VIRTUAL_P (f, 0)) for (j = TYPE_FN_FIELDLIST_LENGTH (basetype, i) - 1; j >= 0; --j) - if (TYPE_FN_FIELD_VOFFSET (f, j) == fnoffset) + if ((int) TYPE_FN_FIELD_VOFFSET (f, j) == fnoffset) { value_ptr temp = value_ind (arg2); arg1 = value_virtual_fn_field (&temp, f, j, domain_type, 0); diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 65ad64c1cac..57a68099ece 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1,5 +1,5 @@ /* Fortran language support routines for GDB, the GNU debugger. - Copyright 1993, 1994 Free Software Foundation, Inc. + Copyright 1993, 1994, 1996 Free Software Foundation, Inc. Contributed by Motorola. Adapted from the C parser by Farooq Butt (fmbutt@engage.sps.mot.com). @@ -582,13 +582,16 @@ SAVED_F77_COMMON_PTR current_common=NULL; /* Ptr to current COMMON */ static SAVED_BF_PTR saved_bf_list=NULL; /* Ptr to (.bf,function) list*/ +#if 0 static SAVED_BF_PTR saved_bf_list_end=NULL; /* Ptr to above list's end */ +#endif static SAVED_BF_PTR current_head_bf_list=NULL; /* Current head of above list */ +#if 0 static SAVED_BF_PTR tmp_bf_ptr; /* Generic temporary for use in macros */ - +#endif /* The following function simply enters a given common block onto the global common block chain */ @@ -824,6 +827,7 @@ void patch_all_commons_by_name (name, offset, secnum) first by a queueing algorithm and upon failure fall back to a linear scan. */ +#if 0 #define ADD_BF_SYMNUM(bf_sym,fcn_sym) \ \ if (saved_bf_list == NULL) \ @@ -848,7 +852,7 @@ else \ saved_bf_list_end->next = tmp_bf_ptr; \ saved_bf_list_end = tmp_bf_ptr; \ } - +#endif /* This function frees the entire (.bf,function) list */ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index 7a160bc934b..3ab6237c59d 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -146,6 +146,7 @@ f_type_print_varspec_prefix (type, stream, show, passed_a_ptr) case TYPE_CODE_MEMBER: case TYPE_CODE_REF: case TYPE_CODE_COMPLEX: + case TYPE_CODE_TYPEDEF: /* These types need no prefix. They are listed here so that gcc -Wall will reveal any types that haven't been handled. */ break; @@ -299,6 +300,7 @@ f_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args) case TYPE_CODE_METHOD: case TYPE_CODE_MEMBER: case TYPE_CODE_COMPLEX: + case TYPE_CODE_TYPEDEF: /* These types do not need a suffix. They are listed so that gcc -Wall will report types that may not have been considered. */ break; diff --git a/gdb/findvar.c b/gdb/findvar.c index f0f46d6734f..1dce9050d7f 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -1,5 +1,5 @@ /* Find a variable's value in memory, for GDB, the GNU debugger. - Copyright 1986, 1987, 1989, 1991, 1994, 1995 Free Software Foundation, Inc. + Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996 Free Software Foundation, Inc. This file is part of GDB. @@ -55,7 +55,7 @@ extract_signed_integer (addr, len) unsigned char *startaddr = (unsigned char *)addr; unsigned char *endaddr = startaddr + len; - if (len > sizeof (LONGEST)) + if (len > (int) sizeof (LONGEST)) error ("\ That operation is not available on integers of more than %d bytes.", sizeof (LONGEST)); @@ -91,7 +91,7 @@ extract_unsigned_integer (addr, len) unsigned char *startaddr = (unsigned char *)addr; unsigned char *endaddr = startaddr + len; - if (len > sizeof (unsigned LONGEST)) + if (len > (int) sizeof (unsigned LONGEST)) error ("\ That operation is not available on integers of more than %d bytes.", sizeof (unsigned LONGEST)); @@ -112,6 +112,58 @@ That operation is not available on integers of more than %d bytes.", return retval; } +/* Sometimes a long long unsigned integer can be extracted as a + LONGEST value. This is done so that we can print these values + better. If this integer can be converted to a LONGEST, this + function returns 1 and sets *PVAL. Otherwise it returns 0. */ + +int +extract_long_unsigned_integer (addr, orig_len, pval) + PTR addr; + int orig_len; + LONGEST *pval; +{ + char *p, *first_addr; + int len; + + len = orig_len; + if (TARGET_BYTE_ORDER == BIG_ENDIAN) + { + for (p = (char *) addr; + len > (int) sizeof (LONGEST) && p < (char *) addr + orig_len; + p++) + { + if (*p == 0) + len--; + else + break; + } + first_addr = p; + } + else + { + first_addr = (char *) addr; + for (p = (char *) addr + orig_len - 1; + len > (int) sizeof (LONGEST) && p >= (char *) addr; + p--) + { + if (*p == 0) + len--; + else + break; + } + } + + if (len <= (int) sizeof (LONGEST)) + { + *pval = (LONGEST) extract_unsigned_integer (first_addr, + sizeof (LONGEST)); + return 1; + } + + return 0; +} + CORE_ADDR extract_address (addr, len) PTR addr; @@ -247,9 +299,9 @@ extract_floating (addr, len) SWAP_FLOATING (&retval, sizeof (retval)); return retval; } - else if (len == sizeof (long double)) + else if (len == sizeof (DOUBLEST)) { - long double retval; + DOUBLEST retval; memcpy (&retval, addr, sizeof (retval)); SWAP_FLOATING (&retval, sizeof (retval)); return retval; @@ -279,7 +331,7 @@ store_floating (addr, len, val) SWAP_FLOATING (&doubleval, sizeof (doubleval)); memcpy (addr, &doubleval, sizeof (doubleval)); } - else if (len == sizeof (long double)) + else if (len == sizeof (DOUBLEST)) { SWAP_FLOATING (&val, sizeof (val)); memcpy (addr, &val, sizeof (val)); diff --git a/gdb/gnu-regex.c b/gdb/gnu-regex.c index 601e3b5fbb2..dec0cf12f2a 100644 --- a/gdb/gnu-regex.c +++ b/gdb/gnu-regex.c @@ -1126,7 +1126,7 @@ re_match_2 (pbufp, string1, size1, string2, size2, pos, regs, mstop) /* Initialize \) text positions to -1 to mark ones that no \( or \) has been seen for. */ - for (mcnt = 0; mcnt < sizeof (regend) / sizeof (*regend); mcnt++) + for (mcnt = 0; mcnt < (int) (sizeof (regend) / sizeof (*regend)); mcnt++) regend[mcnt] = (unsigned char *) -1; /* `p' scans through the pattern as `d' scans through the data. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 7847f33fb34..4aa408ac3c4 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1027,7 +1027,7 @@ do_registers_info (regnum, fpregs) /* Else if virtual format is too long for printf, print in hex a byte at a time. */ - else if (REGISTER_VIRTUAL_SIZE (i) > sizeof (long)) + else if (REGISTER_VIRTUAL_SIZE (i) > (int) sizeof (long)) { register int j; printf_filtered ("0x"); @@ -1173,8 +1173,11 @@ attach_command (args, from_tty) #ifdef SOLIB_ADD if (auto_solib_add) - /* Add shared library symbols from the newly attached process, if any. */ - SOLIB_ADD ((char *)0, from_tty, (struct target_ops *)0); + { + /* Add shared library symbols from the newly attached process, if any. */ + SOLIB_ADD ((char *)0, from_tty, (struct target_ops *)0); + re_enable_breakpoints_in_shlibs (); + } #endif normal_stop (); diff --git a/gdb/infptrace.c b/gdb/infptrace.c index 9f6e7fb2d78..28210e49e39 100644 --- a/gdb/infptrace.c +++ b/gdb/infptrace.c @@ -22,6 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "inferior.h" #include "target.h" #include "gdb_string.h" +#include "wait.h" +#include "command.h" #ifdef USG #include @@ -519,12 +521,14 @@ udot_info () #endif } +#endif /* !defined (CHILD_XFER_MEMORY). */ + void _initialize_infptrace () { +#if !defined (CHILD_XFER_MEMORY) add_info ("udot", udot_info, "Print contents of kernel ``struct user'' for current child."); - +#endif } -#endif /* !defined (CHILD_XFER_MEMORY). */ diff --git a/gdb/language.c b/gdb/language.c index 9f56066cbc2..51ce181900b 100644 --- a/gdb/language.c +++ b/gdb/language.c @@ -799,7 +799,7 @@ lang_bool_type () sym = lookup_symbol ("logical", NULL, VAR_NAMESPACE, NULL, NULL); if (sym) { - struct type *type = SYMBOL_TYPE (sym); + type = SYMBOL_TYPE (sym); if (type && TYPE_CODE (type) == TYPE_CODE_BOOL) return type; } @@ -808,7 +808,7 @@ lang_bool_type () sym = lookup_symbol ("bool", NULL, VAR_NAMESPACE, NULL, NULL); if (sym) { - struct type *type = SYMBOL_TYPE (sym); + type = SYMBOL_TYPE (sym); if (type && TYPE_CODE (type) == TYPE_CODE_BOOL) return type; } diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index 35f7423c1da..f207b244304 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -829,7 +829,7 @@ yylex () /* See if it is a special token of length 2 */ - for( i = 0 ; i < sizeof tokentab2 / sizeof tokentab2[0] ; i++) + for( i = 0 ; i < (int) (sizeof tokentab2 / sizeof tokentab2[0]) ; i++) if(STREQN(tokentab2[i].name, tokstart, 2)) { lexptr += 2; @@ -986,7 +986,7 @@ yylex () lexptr += namelen; /* Lookup special keywords */ - for(i = 0 ; i < sizeof(keytab) / sizeof(keytab[0]) ; i++) + for(i = 0 ; i < (int) (sizeof(keytab) / sizeof(keytab[0])) ; i++) if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen)) return keytab[i].token; @@ -1048,6 +1048,7 @@ yylex () error("internal: Undefined class in m2lex()"); case LOC_LABEL: + case LOC_UNRESOLVED: error("internal: Unforseen case in m2lex()"); } } diff --git a/gdb/main.c b/gdb/main.c index 42621ffa6ff..dcb985e6dc6 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -16,7 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "defs.h" #include @@ -140,7 +140,7 @@ main (argc, argv) current_directory = gdb_dirbuf; /* Parse arguments and options. */ -#ifndef WIN32 +#ifndef WINGDB { int c; /* When var field is 0, use flag field to record the equivalent @@ -297,6 +297,10 @@ main (argc, argv) } } + /* If --help or --version, disable window interface. */ + if (print_help || print_version) + use_windows = 0; + /* OK, that's all the options. The other arguments are filenames. */ count = 0; for (; optind < argc; optind++) @@ -382,7 +386,7 @@ For more information, type \"help\" from within GDB, or consult the\n\ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout); exit (0); } - + if (!quiet) { /* Print all the junk at the top, with trailing "..." if we are about @@ -413,6 +417,7 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout); strcpy (homeinit, getenv ("HOME")); strcat (homeinit, "/"); strcat (homeinit, gdbinit); + if (!inhibit_gdbinit && access (homeinit, R_OK) == 0) { if (!SET_TOP_LEVEL ()) @@ -567,7 +572,7 @@ GDB manual (available as on-line info or a printed manual).\n", gdb_stdout); /* The default command loop. The WIN32 Gui calls this main to set up gdb's state, and has its own command loop. */ -#if !defined (WIN32) +#if !defined (WINGDB) while (1) { if (!SET_TOP_LEVEL ()) @@ -594,16 +599,6 @@ init_proc () { } -int -proc_wait (pid, status) - int pid; - int *status; -{ -#ifndef __GO32__ - return wait (status); -#endif -} - void proc_remove_foreign (pid) int pid; diff --git a/gdb/maint.c b/gdb/maint.c index 5a0eca11f5a..9ce342c2e6a 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -32,6 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdbcore.h" #include "expression.h" /* For language.h */ #include "language.h" +#include "symfile.h" +#include "objfiles.h" #ifdef HAVE_UNISTD_H #include @@ -249,8 +251,6 @@ maintenance_print_statistics (args, from_tty) char *args; int from_tty; { - int temp; - print_objfile_statistics (); print_symbol_bcache_statistics (); } diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 6ef709a7349..6c22d6cd851 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -270,7 +270,6 @@ lookup_minimal_symbol_solib_trampoline (name, sfile, objf) struct objfile *objfile; struct minimal_symbol *msymbol; struct minimal_symbol *found_symbol = NULL; - struct minimal_symbol *found_file_symbol = NULL; #ifdef SOFUN_ADDRESS_MAYBE_MISSING if (sfile != NULL) diff --git a/gdb/objfiles.h b/gdb/objfiles.h index f53605609a0..b98b7088fe7 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -175,6 +175,7 @@ struct objstats { #define OBJSTAT(objfile, expr) (objfile -> stats.expr) #define OBJSTATS struct objstats stats extern void print_objfile_statistics PARAMS ((void)); +extern void print_symbol_bcache_statistics PARAMS ((void)); #else diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 9e7b1c72889..60c12e6a356 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -110,6 +110,8 @@ extern void write_exp_elt_block PARAMS ((struct block *)); extern void write_exp_msymbol PARAMS ((struct minimal_symbol *, struct type *, struct type *)); +extern void write_dollar_variable PARAMS ((struct stoken str)); + extern void start_arglist PARAMS ((void)); diff --git a/gdb/remote.c b/gdb/remote.c index c33cf6c37aa..5356e5e459b 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -108,6 +108,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ for step or cont : SAA where AA is the signal number. + detach D Reply OK. + There is no immediate reply to step or cont. The reply comes when the machine stops. It is SAA AA is the signal number. @@ -274,6 +276,13 @@ extern struct target_ops extended_remote_ops; /* Forward decl */ static int remote_timeout = 2; +/* This variable chooses whether to send a ^C or a break when the user + requests program interruption. Although ^C is usually what remote + systems expect, and that is the default here, sometimes a break is + preferable instead. */ + +static int remote_break; + /* Descriptor for I/O to remote machine. Initialize it to NULL so that remote_open knows that we don't have a file open when the program starts. */ @@ -561,22 +570,25 @@ device is attached to the remote system (e.g. /dev/ttya)."); pop_target(); } -/* remote_detach() - takes a program previously attached to and detaches it. - We better not have left any breakpoints - in the program or it'll die when it hits one. - Close the open connection to the remote debugger. - Use this when you want to detach and do something else - with your gdb. */ +/* This takes a program previously attached to and detaches it. After + this is done, GDB can be used to debug some other program. We + better not have left any breakpoints in the target program or it'll + die when it hits one. */ static void remote_detach (args, from_tty) char *args; int from_tty; { + char buf[PBUFSIZ]; + if (args) error ("Argument given to \"detach\" when remotely debugging."); - + + /* Tell the remote target to detach. */ + strcpy (buf, "D"); + remote_send (buf); + pop_target (); if (from_tty) puts_filtered ("Ending remote debugging.\n"); @@ -656,7 +668,11 @@ remote_interrupt (signo) if (remote_debug) printf_unfiltered ("remote_interrupt called\n"); - SERIAL_WRITE (remote_desc, "\003", 1); /* Send a ^C */ + /* Send a break or a ^C, depending on user preference. */ + if (remote_break) + SERIAL_SEND_BREAK (remote_desc); + else + SERIAL_WRITE (remote_desc, "\003", 1); } static void (*ofunc)(); @@ -1126,7 +1142,7 @@ remote_read_bytes (memaddr, myaddr, len) /* FIXME-32x64: Need a version of print_address_numeric which puts the result in a buffer like sprintf. */ - sprintf (buf, "m%lx,%x", (unsigned long) memaddr, todo); + sprintf (buf, "m%lx,%x", (unsigned long) memaddr + done, todo); putpkt (buf); getpkt (buf, 0); @@ -1149,7 +1165,7 @@ remote_read_bytes (memaddr, myaddr, len) if (p[0] == 0 || p[1] == 0) /* Reply is short. This means that we were able to read only part of what we wanted to. */ - break; + return i + done; myaddr[i + done] = fromhex (p[0]) * 16 + fromhex (p[1]); p += 2; } @@ -1315,7 +1331,7 @@ putpkt (buf) /* Copy the packet into buffer BUF2, encapsulating it and giving it a checksum. */ - if (cnt > sizeof(buf2) - 5) /* Prosanity check */ + if (cnt > (int) sizeof (buf2) - 5) /* Prosanity check */ abort(); p = buf2; @@ -1731,10 +1747,8 @@ Specify the serial device it is connected to (e.g. /dev/ttya).", /* to_doc */ remote_prepare_to_store, /* to_prepare_to_store */ remote_xfer_memory, /* to_xfer_memory */ remote_files_info, /* to_files_info */ - remote_insert_breakpoint, /* to_insert_breakpoint */ remote_remove_breakpoint, /* to_remove_breakpoint */ - NULL, /* to_terminal_init */ NULL, /* to_terminal_inferior */ NULL, /* to_terminal_ours_for_output */ @@ -1817,4 +1831,9 @@ _initialize_remote () var_integer, (char *)&remote_timeout, "Set timeout value for remote read.\n", &setlist), &showlist); + + add_show_from_set (add_set_cmd ("remotebreak", no_class, + var_integer, (char *)&remote_break, + "Set whether to send break if interrupted.\n", &setlist), + &showlist); } diff --git a/gdb/scm-lang.h b/gdb/scm-lang.h index 73fc745f724..f990d774d72 100644 --- a/gdb/scm-lang.h +++ b/gdb/scm-lang.h @@ -46,3 +46,5 @@ extern struct value * scm_evaluate_string PARAMS ((char*, int)); extern struct type *builtin_type_scm; extern int scm_parse (); + +extern LONGEST scm_unpack PARAMS ((struct type *, char *, enum type_code)); diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c index 282da11c23b..388293fa33e 100644 --- a/gdb/ser-tcp.c +++ b/gdb/ser-tcp.c @@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include "signals.h" +#include "gdb_string.h" struct tcp_ttystate { @@ -66,7 +67,7 @@ tcp_open(scb, name) if (!port_str) error ("tcp_open: No colon in host name!"); /* Shouldn't ever happen */ - tmp = min (port_str - name, sizeof hostname - 1); + tmp = min (port_str - name, (int) sizeof hostname - 1); strncpy (hostname, name, tmp); /* Don't want colon */ hostname[tmp] = '\000'; /* Tie off host name */ port = atoi (port_str + 1); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index b5cddf73bd3..80fbd77e3f6 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -3812,7 +3812,6 @@ cleanup_undefined_types () break; default: - badtype: { static struct complaint msg = {"\ GDB internal error. cleanup_undefined_types with bad type %d.", 0, 0}; diff --git a/gdb/symfile.c b/gdb/symfile.c index 328d07c98c2..de2928f39c8 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -43,6 +43,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdb_string.h" #include "gdb_stat.h" #include +#include #ifdef HAVE_UNISTD_H #include #endif @@ -273,7 +274,7 @@ obconcat (obstackp, s1, s2, s3) int currently_reading_symtab = 0; -static int +static void decrement_reading_symtab (dummy) void *dummy; { @@ -923,6 +924,8 @@ generic_load (filename, from_tty) struct cleanup *old_cleanups; asection *s; bfd *loadfile_bfd; + time_t start_time, end_time; /* Start and end times of download */ + unsigned long data_count; /* Number of bytes transferred to memory */ loadfile_bfd = bfd_openr (filename, gnutarget); if (loadfile_bfd == NULL) @@ -941,6 +944,8 @@ generic_load (filename, from_tty) bfd_errmsg (bfd_get_error ())); } + start_time = time (NULL); + for (s = loadfile_bfd->sections; s; s = s->next) { if (s->flags & SEC_LOAD) @@ -954,6 +959,8 @@ generic_load (filename, from_tty) struct cleanup *old_chain; bfd_vma vma; + data_count += size; + buffer = xmalloc (size); old_chain = make_cleanup (free, buffer); @@ -976,6 +983,8 @@ generic_load (filename, from_tty) } } + end_time = time (NULL); + /* We were doing this in remote-mips.c, I suspect it is right for other targets too. */ write_pc (loadfile_bfd->start_address); @@ -986,6 +995,10 @@ generic_load (filename, from_tty) loaded in. remote-nindy.c had no call to symbol_file_add, but remote-vx.c does. */ + if (end_time != start_time) + printf_filtered ("Transfer rate: %d bits/sec.\n", + (data_count * 8)/(end_time - start_time)); + do_cleanups (old_cleanups); } @@ -1182,17 +1195,17 @@ reread_symbols () enough? */ if (objfile->global_psymbols.list) mfree (objfile->md, objfile->global_psymbols.list); - objfile->global_psymbols.list = NULL; - objfile->global_psymbols.next = NULL; - objfile->global_psymbols.size = 0; + memset (&objfile -> global_psymbols, 0, + sizeof (objfile -> global_psymbols)); if (objfile->static_psymbols.list) mfree (objfile->md, objfile->static_psymbols.list); - objfile->static_psymbols.list = NULL; - objfile->static_psymbols.next = NULL; - objfile->static_psymbols.size = 0; + memset (&objfile -> static_psymbols, 0, + sizeof (objfile -> static_psymbols)); /* Free the obstacks for non-reusable objfiles */ obstack_free (&objfile -> psymbol_cache.cache, 0); + memset (&objfile -> psymbol_cache, 0, + sizeof (objfile -> psymbol_cache)); obstack_free (&objfile -> psymbol_obstack, 0); obstack_free (&objfile -> symbol_obstack, 0); obstack_free (&objfile -> type_obstack, 0); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 8485c596bd8..b008e9e3882 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "command.h" #include "obstack.h" #include "language.h" +#include "bcache.h" #include "gdb_string.h" @@ -160,8 +161,8 @@ print_symbol_bcache_statistics () immediate_quit++; ALL_OBJFILES (objfile) { - printf_filtered ("Cached obstack statistics for '%s':\n", objfile -> name); - print_bcache_statistics (&objfile -> psymbol_cache, "partial symbol obstack"); + printf_filtered ("Byte cache statistics for '%s':\n", objfile -> name); + print_bcache_statistics (&objfile -> psymbol_cache, "partial symbol cache"); } immediate_quit--; } diff --git a/gdb/top.c b/gdb/top.c index d7d85189515..cb27060a550 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1891,7 +1891,6 @@ command_line_input (prrompt, repeat, annotation_suffix) char *p1; char *rl; char *local_prompt = prrompt; - register int c; char *nline; char got_eof = 0; diff --git a/gdb/valarith.c b/gdb/valarith.c index 0446907af3b..c03d0a4a2ef 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -133,7 +133,7 @@ value_subscript (array, idx) { value_ptr bound; int c_style = current_language->c_style_arrays; - struct type *tarray, *tint; + struct type *tarray; COERCE_REF (array); tarray = check_typedef (VALUE_TYPE (array)); @@ -174,7 +174,7 @@ value_subscript (array, idx) LONGEST index = value_as_long (idx); value_ptr v; int offset, byte, bit_index; - LONGEST lowerbound, upperbound, word; + LONGEST lowerbound, upperbound; get_discrete_bounds (range_type, &lowerbound, &upperbound); if (index < lowerbound || index > upperbound) error ("bitstring index out of range"); @@ -211,9 +211,9 @@ value_subscripted_rvalue (array, idx, lowerbound) { struct type *array_type = check_typedef (VALUE_TYPE (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); - int elt_size = TYPE_LENGTH (elt_type); + unsigned int elt_size = TYPE_LENGTH (elt_type); LONGEST index = value_as_long (idx); - int elt_offs = elt_size * longest_to_int (index - lowerbound); + unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound); value_ptr v; if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type)) @@ -710,11 +710,11 @@ value_binop (arg1, arg2, op) /* FIXME: This implements ANSI C rules (also correct for C++). What about FORTRAN and chill? */ { - int promoted_len1 = TYPE_LENGTH (type1); - int promoted_len2 = TYPE_LENGTH (type2); + unsigned int promoted_len1 = TYPE_LENGTH (type1); + unsigned int promoted_len2 = TYPE_LENGTH (type2); int is_unsigned1 = TYPE_UNSIGNED (type1); int is_unsigned2 = TYPE_UNSIGNED (type2); - int result_len; + unsigned int result_len; int unsigned_operation; /* Determine type length and signedness after promotion for @@ -1060,8 +1060,8 @@ value_equal (arg1, arg2) return (CORE_ADDR) value_as_long (arg1) == value_as_pointer (arg2); else if (code1 == code2 - && ((len = TYPE_LENGTH (type1)) - == TYPE_LENGTH (type2))) + && ((len = (int) TYPE_LENGTH (type1)) + == (int) TYPE_LENGTH (type2))) { p1 = VALUE_CONTENTS (arg1); p2 = VALUE_CONTENTS (arg2); @@ -1204,7 +1204,7 @@ value_in (element, set) value_as_long (element)); if (member < 0) error ("First argument of 'IN' not in range"); - return value_from_longest (builtin_type_chill_bool, member); + return value_from_longest (LA_BOOL_TYPE, member); } void diff --git a/gdb/valops.c b/gdb/valops.c index 83d06bbd839..684b224cc88 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -66,7 +66,9 @@ static value_ptr cast_into_complex PARAMS ((struct type *, value_ptr)); /* Flag for whether we want to abandon failed expression evals by default. */ +#if 0 static int auto_abandon = 0; +#endif /* Find the address of function name NAME in the inferior. */ @@ -470,7 +472,7 @@ value_assign (toval, fromval) + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; - if (len > sizeof (LONGEST)) + if (len > (int) sizeof (LONGEST)) error ("Can't handle bitfields which don't fit in a %d bit word.", sizeof (LONGEST) * HOST_CHAR_BIT); @@ -495,7 +497,7 @@ value_assign (toval, fromval) char buffer[sizeof (LONGEST)]; int len = REGISTER_RAW_SIZE (VALUE_REGNO (toval)); - if (len > sizeof (LONGEST)) + if (len > (int) sizeof (LONGEST)) error ("Can't handle bitfields in registers larger than %d bits.", sizeof (LONGEST) * HOST_CHAR_BIT); @@ -624,7 +626,7 @@ Can't handle bitfield which doesn't fit in a single register."); /* If the field does not entirely fill a LONGEST, then zero the sign bits. If the field is signed, and is negative, then sign extend. */ if ((VALUE_BITSIZE (toval) > 0) - && (VALUE_BITSIZE (toval) < 8 * sizeof (LONGEST))) + && (VALUE_BITSIZE (toval) < 8 * (int) sizeof (LONGEST))) { LONGEST fieldval = value_as_long (fromval); LONGEST valmask = (((unsigned LONGEST) 1) << VALUE_BITSIZE (toval)) - 1; @@ -1075,7 +1077,7 @@ call_function_by_hand (function, nargs, args) /* Create a call sequence customized for this function and the number of arguments for it. */ - for (i = 0; i < sizeof dummy / sizeof (dummy[0]); i++) + for (i = 0; i < (int) (sizeof (dummy) / sizeof (dummy[0])); i++) store_unsigned_integer (&dummy1[i * REGISTER_SIZE], REGISTER_SIZE, (unsigned LONGEST)dummy[i]); @@ -1359,7 +1361,7 @@ value_array (lowbound, highbound, elemvec) { int nelem; int idx; - int typelength; + unsigned int typelength; value_ptr val; struct type *rangetype; struct type *arraytype; @@ -1896,7 +1898,7 @@ destructor_name_p (name, type) { char *dname = type_name_no_tag (type); char *cp = strchr (dname, '<'); - int len; + unsigned int len; /* Do not compare the template part for template classes. */ if (cp == NULL) diff --git a/gdb/valprint.c b/gdb/valprint.c index b734eb465e0..7b3cc5766ca 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -147,8 +147,7 @@ val_print (type, valaddr, address, stream, format, deref_ref, recurse, pretty) only a stub and we can't find and substitute its complete type, then print appropriate string and return. */ - if (TYPE_FLAGS (real_type) & TYPE_FLAG_STUB - || TYPE_LENGTH (real_type) == 0) + if (TYPE_FLAGS (real_type) & TYPE_FLAG_STUB) { fprintf_filtered (stream, ""); gdb_flush (stream); @@ -184,7 +183,9 @@ value_print (val, stream, format, pretty) return LA_VALUE_PRINT (val, stream, format, pretty); } -/* Called by various _val_print routines to print TYPE_CODE_INT's */ +/* Called by various _val_print routines to print + TYPE_CODE_INT's. TYPE is the type. VALADDR is the address of the + value. STREAM is where to print the value. */ void val_print_type_code_int (type, valaddr, stream) @@ -192,74 +193,22 @@ val_print_type_code_int (type, valaddr, stream) char *valaddr; GDB_FILE *stream; { - char *p; - /* Pointer to first (i.e. lowest address) nonzero character. */ - char *first_addr; - unsigned int len; - if (TYPE_LENGTH (type) > sizeof (LONGEST)) { - if (TYPE_UNSIGNED (type)) - { - /* First figure out whether the number in fact has zeros - in all its bytes more significant than least significant - sizeof (LONGEST) ones. */ - len = TYPE_LENGTH (type); - - if (TARGET_BYTE_ORDER == BIG_ENDIAN) - { - for (p = valaddr; - len > sizeof (LONGEST) && p < valaddr + TYPE_LENGTH (type); - p++) - { - if (*p == 0) - { - len--; - } - else - { - break; - } - } - first_addr = p; - } - else - { - first_addr = valaddr; - for (p = valaddr + TYPE_LENGTH (type) - 1; - len > sizeof (LONGEST) && p >= valaddr; - p--) - { - if (*p == 0) - { - len--; - } - else - { - break; - } - } - } + LONGEST val; - if (len <= sizeof (LONGEST)) - { - /* The most significant bytes are zero, so we can just get - the least significant sizeof (LONGEST) bytes and print it - in decimal. */ - print_longest (stream, 'u', 0, - extract_unsigned_integer (first_addr, - sizeof (LONGEST))); - } - else - { - /* It is big, so print it in hex. */ - print_hex_chars (stream, (unsigned char *) first_addr, len); - } + if (TYPE_UNSIGNED (type) + && extract_long_unsigned_integer (valaddr, TYPE_LENGTH (type), + &val)) + { + print_longest (stream, 'u', 0, val); } else { - /* Signed. One could assume two's complement (a reasonable - assumption, I think) and do better than this. */ + /* Signed, or we couldn't turn an unsigned value into a + LONGEST. For signed values, one could assume two's + complement (a reasonable assumption, I think) and do + better than this. */ print_hex_chars (stream, (unsigned char *) valaddr, TYPE_LENGTH (type)); } @@ -427,7 +376,7 @@ print_floating (valaddr, type, stream) struct type *type; GDB_FILE *stream; { - double doub; + DOUBLEST doub; int inv; unsigned len = TYPE_LENGTH (type); @@ -505,9 +454,17 @@ print_floating (valaddr, type, stream) doub = unpack_double (type, valaddr, &inv); if (inv) - fprintf_filtered (stream, ""); + { + fprintf_filtered (stream, ""); + return; + } + + if (len < sizeof (double)) + fprintf_filtered (stream, "%.9g", (double) doub); + else if (len == sizeof (double)) + fprintf_filtered (stream, "%.17g", (double) doub); else - fprintf_filtered (stream, len <= sizeof(float) ? "%.9g" : "%.17g", doub); + fprintf_filtered (stream, "%.35Lg", doub); } /* VALADDR points to an integer of LEN bytes. Print it in hex on stream. */ @@ -656,7 +613,7 @@ val_print_string (addr, len, stream) unsigned int fetchlimit; /* Maximum number of bytes to fetch. */ unsigned int nfetch; /* Bytes to fetch / bytes fetched. */ unsigned int chunksize; /* Size of each fetch, in bytes. */ - int bufsize; /* Size of current fetch buffer. */ + unsigned int bufsize; /* Size of current fetch buffer. */ char *buffer = NULL; /* Dynamically growable fetch buffer. */ char *bufptr; /* Pointer to next available byte in buffer. */ char *limit; /* First location past end of fetch buffer. */ diff --git a/gdb/values.c b/gdb/values.c index b1776aefb88..a3b6abdad6f 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "gdbcmd.h" #include "target.h" #include "language.h" +#include "scm-lang.h" #include "demangle.h" /* Local function prototypes. */ @@ -100,7 +101,6 @@ allocate_repeat_value (type, count) struct type *type; int count; { - struct type *element_type = type; int low_bound = current_language->string_lower_bound; /* ??? */ /* FIXME-type-allocation: need a way to free this type when we are done with it. */ @@ -1155,7 +1155,7 @@ unpack_field_as_long (type, valaddr, fieldno) /* If the field does not entirely fill a LONGEST, then zero the sign bits. If the field is signed, and is negative, then sign extend. */ - if ((bitsize > 0) && (bitsize < 8 * sizeof (val))) + if ((bitsize > 0) && (bitsize < 8 * (int) sizeof (val))) { valmask = (((unsigned LONGEST) 1) << bitsize) - 1; val &= valmask; @@ -1185,12 +1185,12 @@ modify_field (addr, fieldval, bitpos, bitsize) /* If a negative fieldval fits in the field in question, chop off the sign extension bits. */ - if (bitsize < (8 * sizeof (fieldval)) + if (bitsize < (8 * (int) sizeof (fieldval)) && (~fieldval & ~((1 << (bitsize - 1)) - 1)) == 0) fieldval = fieldval & ((1 << bitsize) - 1); /* Warn if value is too big to fit in the field in question. */ - if (bitsize < (8 * sizeof (fieldval)) + if (bitsize < (8 * (int) sizeof (fieldval)) && 0 != (fieldval & ~((1<= size of oword */ - if (bitsize < 8 * sizeof (oword)) + if (bitsize < 8 * (int) sizeof (oword)) oword &= ~(((((unsigned LONGEST)1) << bitsize) - 1) << bitpos); else oword &= ~((~(unsigned LONGEST)0) << bitpos);