From: Fred Fish Date: Thu, 11 Mar 1993 01:56:31 +0000 (+0000) Subject: * main.c (source_command): Require an explicit pathname of file X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f77ad50597b7c74ce8454346940dcfc65aba1dd5;p=binutils-gdb.git * main.c (source_command): Require an explicit pathname of file to source, since previous behavior of defaulting to gdb init file was troublesome and undocumented. * printcmd.c (disassemble_command): Add missing '{}' pair to else with two statements. Bug reported by Stephane Tsacas . * symtab.c (find_pc_line): Don't complain about zero length or negative length line numbers for the moment, since we may not own the terminal when called, such as when single stepping. (FIXME) * language.h (CAST_IS_CONVERSION): True if current language is C++ as well as C. Fix from Peter Schauer. * environ.c (get_in_environ, set_in_environ, unset_in_environ): Use STREQN macro rather than bare '!strncmp()'. * environ.c (unset_in_environ): Avoid use of memcpy on overlapping memory regions, as suggested by Paul Eggert . * c-exp.y (%union struct): Remove unused ulval as suggested by Paul Eggert . --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cece0b62f59..9a1a5b43588 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,32 @@ +Wed Mar 10 17:37:11 1993 Fred Fish (fnf@cygnus.com) + + * main.c (source_command): Require an explicit pathname of file + to source, since previous behavior of defaulting to gdb init file + was troublesome and undocumented. + * printcmd.c (disassemble_command): Add missing '{}' pair to + else with two statements. Bug reported by Stephane Tsacas + . + * symtab.c (find_pc_line): Don't complain about zero length or + negative length line numbers for the moment, since we may not own + the terminal when called, such as when single stepping. (FIXME) + * language.h (CAST_IS_CONVERSION): True if current language is + C++ as well as C. Fix from Peter Schauer. + * environ.c (get_in_environ, set_in_environ, unset_in_environ): + Use STREQN macro rather than bare '!strncmp()'. + * environ.c (unset_in_environ): Avoid use of memcpy on + overlapping memory regions, as suggested by Paul Eggert + . + * c-exp.y (%union struct): Remove unused ulval as suggested + by Paul Eggert . + +Mon Mar 8 19:03:06 1993 Fred Fish (fnf@cygnus.com) + + * main.c (gdbinit): Make static. + * main.c (inhibit_gdbinit): Move to file scope. + * main.c (main): Remove local inhibit_gdbinit. + * main.c (source_command): Don't source '.gdbinit' file by + default if gdb has been told to ignore it. + Sun Mar 7 21:58:53 1993 Ian Lance Taylor (ian@cygnus.com) * Makefile.in (MAKEOVERRIDES): Define to be empty for GNU Make diff --git a/gdb/c-exp.y b/gdb/c-exp.y index f8c87c4967a..555471fddb2 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -102,7 +102,6 @@ yyerror PARAMS ((char *)); %union { LONGEST lval; - unsigned LONGEST ulval; struct { LONGEST val; struct type *type; diff --git a/gdb/language.h b/gdb/language.h index 7e5c838324b..bd2a5a7818d 100644 --- a/gdb/language.h +++ b/gdb/language.h @@ -215,7 +215,8 @@ extern enum language_mode /* "cast" really means conversion */ /* FIXME -- should be a setting in language_defn */ -#define CAST_IS_CONVERSION (current_language->la_language == language_c) +#define CAST_IS_CONVERSION (current_language->la_language == language_c || \ + current_language->la_language == language_cplus) extern void language_info PARAMS ((int)); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 3e878a68885..a99a6cbc21b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -62,8 +62,13 @@ static CORE_ADDR last_examine_address; static value last_examine_value; +/* Largest offset between a symbolic value and an address, that will be + printed as `0x1234 '. */ + +static unsigned int max_symbolic_offset = UINT_MAX; + /* Number of auto-display expression currently being displayed. - So that we can deleted it if we get an error or a signal within it. + So that we can disable it if we get an error or a signal within it. -1 when not doing one. */ int current_display_number; @@ -119,7 +124,8 @@ static void printf_command PARAMS ((char *, int)); static void -print_frame_nameless_args PARAMS ((CORE_ADDR, long, int, int, FILE *)); +print_frame_nameless_args PARAMS ((struct frame_info *, long, int, int, + FILE *)); static void display_info PARAMS ((char *, int)); @@ -560,7 +566,7 @@ print_address_symbolic (addr, stream, do_demangle, leadin) int do_demangle; char *leadin; { - int name_location; + CORE_ADDR name_location; register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (addr); /* If nothing comes out, don't print anything symbolic. */ @@ -568,15 +574,27 @@ print_address_symbolic (addr, stream, do_demangle, leadin) if (msymbol == NULL) return; + /* If the nearest symbol is too far away, ditto. */ + + name_location = SYMBOL_VALUE_ADDRESS (msymbol); + + /* For when CORE_ADDR is larger than unsigned int, we do math in + CORE_ADDR. But when we detect unsigned wraparound in the + CORE_ADDR math, we ignore this test and print the offset, + because addr+max_symbolic_offset has wrapped through the end + of the address space back to the beginning, giving bogus comparison. */ + if (addr > name_location + max_symbolic_offset + && name_location + max_symbolic_offset > name_location) + return; + fputs_filtered (leadin, stream); fputs_filtered ("<", stream); if (do_demangle) fputs_filtered (SYMBOL_SOURCE_NAME (msymbol), stream); else fputs_filtered (SYMBOL_LINKAGE_NAME (msymbol), stream); - name_location = SYMBOL_VALUE_ADDRESS (msymbol); - if (addr - name_location) - fprintf_filtered (stream, "+%d>", addr - name_location); + if (addr != name_location) + fprintf_filtered (stream, "+%d>", (int)(addr - name_location)); else fputs_filtered (">", stream); } @@ -1881,8 +1899,10 @@ disassemble_command (arg, from_tty) printf_filtered ("for function %s:\n", name); } else - printf_filtered ("from %s ", local_hex_string(low)); - printf_filtered ("to %s:\n", local_hex_string(high)); + { + printf_filtered ("from %s ", local_hex_string(low)); + printf_filtered ("to %s:\n", local_hex_string(high)); + } /* Dump the specified range. */ for (pc = low; pc < high; ) @@ -2030,4 +2050,11 @@ but no count or size letter (see \"x\" command).", NULL)); add_com ("inspect", class_vars, inspect_command, "Same as \"print\" command, except that if you are running in the epoch\n\ environment, the value is printed in its own window."); + + add_show_from_set ( + add_set_cmd ("max-symbolic-offset", no_class, var_uinteger, + (char *)&max_symbolic_offset, + "Set the largest offset that will be printed in form.", + &setprintlist), + &showprintlist); } diff --git a/gdb/symtab.c b/gdb/symtab.c index 5a371aecf02..328679c9bed 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -959,6 +959,13 @@ find_pc_symtab (pc) range, we must search all symtabs associated with this compilation unit, and find the one whose first PC is closer than that of the next line in this symtab. + + FIXME: We used to complain here about zero length or negative length line + tables, but there are two problems with this: (1) some symtabs may not have + any line numbers due to gcc -g1 compilation, and (2) this function is called + during single stepping, when we don't own the terminal and thus can't + produce any output. One solution might be to implement a mechanism whereby + complaints can be queued until we regain control of the terminal. -fnf */ struct symtab_and_line @@ -1023,10 +1030,8 @@ find_pc_line (pc, notcurrent) if (!l) continue; len = l->nitems; - if (len <= 0) + if (len <= 0) /* See FIXME above. */ { - fprintf (stderr, "Inconsistent line number info for %s\n", - s->filename); continue; } @@ -2405,8 +2410,7 @@ static char **return_val; #define COMPLETION_LIST_ADD_SYMBOL(symbol, text, len) \ do { \ completion_list_add_name (SYMBOL_NAME (symbol), text, len); \ - if (SYMBOL_LANGUAGE (symbol) == language_cplus && \ - SYMBOL_DEMANGLED_NAME (symbol) != NULL) \ + if (SYMBOL_DEMANGLED_NAME (symbol) != NULL) \ completion_list_add_name (SYMBOL_DEMANGLED_NAME (symbol), text, len); \ } while (0)