From 833e0d94ccb34e8ac566a574fd5a75fb967434a5 Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Thu, 27 Jan 1994 00:36:05 +0000 Subject: Fix many sins which will come up in 32 bit x 64 bit GDB, and various miscellaneous things discovered in the process: * printcmd.c, defs.h (print_address_numeric): New function. * c-valprint.c (c_val_print), ch-valprint.c (chill_val_print) breakpoint.c (describe_other_breakpoints, breakpoint_1, mention), cp-valprint.c (cplus_print_value), infcmd.c (jump_command), printcmd.c, stack.c, symfile.c, symmisc.c, valprint.c: Use it. * utils.c, defs.h (gdb_print_address): New function. * expprint (dump_expression), gdbtypes.h: Use it. * breakpoint.c (describe_other_breakpoints), symmisc.c (dump_symtab, print_symbol): Use filtered not unfiltered I/O. (remove_breakpoints): Remove BREAKPOINT_DEBUG code. Might as well just run gdb under a debugger for this (and it had problems with printing addresses, how to print b->shadow, etc.). * buildsym.c (make_blockvector), core.c (memory_error), exec.c (print_section_info), maint.c (print_section_table), mdebugread.c (parse_procedure), solib.c, source.c, symfile.c, symmisc.c, symtab.c, valops.c, valprint.c, xcoffexec.c: Add comments saying code is broken. Marked with "FIXME-32x64". * dbxread.c (process_one_symbol), partial-stab.h (default), remote-vx.c (vx_run_files_info): Don't cast int being passed to local_hex_string. * symmisc.c (print_symbol): Don't cast long being passed to %lx. * symtab.h (general_symbol_info): Add comment about SYMBOL_VALUE only being a long. * symmisc.c (print_symbol): Print "offset" in message for LOC_ARG and LOC_LOCAL. * printcmd.c (print_address): Remove #if 0 code with ADDR_BITS_REMOVE. * source.c: Include regardless of USG. --- gdb/valprint.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'gdb/valprint.c') diff --git a/gdb/valprint.c b/gdb/valprint.c index c91b7cd..a3242fd 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -460,7 +460,7 @@ print_floating (valaddr, type, stream) /* Assume that floating point byte order is the same as integer byte order. */ low = extract_unsigned_integer (valaddr, 4); - nonnegative = low >= 0; + nonnegative = ((low & 0x80000000) == 0); is_nan = ((((low >> 23) & 0xFF) == 0xFF) && 0 != (low & 0x7FFFFF)); low &= 0x7fffff; @@ -479,7 +479,7 @@ print_floating (valaddr, type, stream) low = extract_unsigned_integer (valaddr, 4); high = extract_unsigned_integer (valaddr + 4, 4); #endif - nonnegative = high >= 0; + nonnegative = ((high & 0x80000000) == 0); is_nan = (((high >> 20) & 0x7ff) == 0x7ff && ! ((((high & 0xfffff) == 0)) && (low == 0))); high &= 0xfffff; @@ -719,9 +719,10 @@ val_print_string (addr, len, stream) are looking for a null terminator to end the fetching, so we might as well read in blocks that are large enough to be efficient, but not so large as to be slow if fetchlimit happens to be large. So we choose the - minimum of DEFAULT_PRINT_MAX and fetchlimit. */ + minimum of 8 and fetchlimit. We used to use 200 instead of 8 but + 200 is way too big for remote debugging over a serial line. */ - chunksize = (len == 0 ? min (PRINT_MAX_DEFAULT, fetchlimit) : fetchlimit); + chunksize = (len == 0 ? min (8, fetchlimit) : fetchlimit); /* Loop until we either have all the characters to print, or we encounter some error, such as bumping into the end of the address space. */ @@ -766,7 +767,7 @@ val_print_string (addr, len, stream) } while (bufptr < limit && *(bufptr - 1) != '\0'); } } while (errcode == 0 /* no error */ - && bufptr < buffer + fetchlimit /* no overrun */ + && bufsize < fetchlimit /* no overrun */ && !(len == 0 && *(bufptr - 1) == '\0')); /* no null term */ /* We now have either successfully filled the buffer to fetchlimit, or @@ -803,12 +804,13 @@ val_print_string (addr, len, stream) { if (errcode == EIO) { - fprintf_filtered (stream, - "
", - (unsigned long) addr); + fprintf_filtered (stream, "
"); } else { + /* FIXME-32x64: assumes addr fits in a long. */ error ("Error reading memory address 0x%lx: %s.", (unsigned long) addr, safe_strerror (errcode)); -- cgit v1.1