From c2e4669f8cc511833f293fdc03f6d63ee442bc9c Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Fri, 27 Mar 1992 23:56:15 +0000 Subject: [PATCH] Misc cleanups from code review. --- gdb/ChangeLog | 16 ++++++++++++++++ gdb/buildsym.c | 3 --- gdb/elfread.c | 10 ++++------ gdb/gdbtypes.c | 12 +++++------- gdb/main.c | 46 ++++++++++++++++------------------------------ gdb/partial-stab.h | 3 ++- gdb/rs6000-tdep.c | 7 +++++-- 7 files changed, 48 insertions(+), 49 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2da155d20de..fdce940c22a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,19 @@ +Fri Mar 27 15:44:55 1992 John Gilmore (gnu at cygnus.com) + + * buildsym.c (MAX_OF_C_TYPE, MIN_OF_C_TYPE): Unused, remove. + * copying.awk: Lint. Make stronger warning at top of copying.c. + * elfread.c (elf_symtab_read): Eliminate check of mainline. + * gdbtypes.c (smash_to_*): Remove FIXME comments. + (lookup_pointer_type): Add FIXME comment. + * main.c (set_history_size_command): Disallow negative size. + * partial-stab.h: Update copyright. + * rs6000-tdep.c (skip_trampoline_code): Better comments. + +Wed Mar 25 10:45:38 1992 John Gilmore (gnu at cygnus.com) + + * main.c (set_history_size_command): Negative size is error. + (Reported by Peggy Fieland.) + Thu Mar 26 17:01:18 1992 Fred Fish (fnf@cygnus.com) * coffread.c (coff_symfile_init): Update comment. diff --git a/gdb/buildsym.c b/gdb/buildsym.c index f50ced73aaa..eab5cb6f216 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -3011,9 +3011,6 @@ read_huge_number (pp, end, valu, bits) } } -#define MAX_OF_C_TYPE(t) ((1 << (sizeof (t)*8 - 1)) - 1) -#define MIN_OF_C_TYPE(t) (-(1 << (sizeof (t)*8 - 1))) - static struct type * read_range_type (pp, typenums, objfile) char **pp; diff --git a/gdb/elfread.c b/gdb/elfread.c index ada668dc40f..99cf1adce6d 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -1,5 +1,5 @@ /* Read ELF (Executable and Linking Format) object files for GDB. - Copyright (C) 1991 Free Software Foundation, Inc. + Copyright 1991, 1992 Free Software Foundation, Inc. Written by Fred Fish at Cygnus Support. This file is part of GDB. @@ -24,7 +24,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ * * * This file is still under construction. When it is complete, this * * notice will be removed. Until then, direct any questions or changes * - * to Fred Fish at Cygnus Support (fnf@cygint) * + * to Fred Fish at Cygnus Support (fnf@cygnus.com) * * * * FIXME Still needs support for shared libraries. * * FIXME Still needs support for core files. * @@ -219,10 +219,8 @@ elf_symtab_read (abfd, addr, mainline, objfile) && (sym -> section != NULL)) { symaddr = sym -> value; - /* Relocate all non-absolute symbols by base address. - FIXME: Can we eliminate the check for mainline now, - since shouldn't addr be 0 in this case? */ - if (!mainline && (sym -> section != &bfd_abs_section)) + /* Relocate all non-absolute symbols by base address. */ + if (sym -> section != &bfd_abs_section) { symaddr += addr; } diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 4d6eaa76951..788fda8ad60 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -79,7 +79,7 @@ lookup_pointer_type (type) TYPE_TARGET_TYPE (ptype) = type; TYPE_POINTER_TYPE (type) = ptype; - /* We assume the machine has only one representation for pointers! */ + /* FIXME, assume machine has only one representation for pointers! */ TYPE_LENGTH (ptype) = TARGET_PTR_BIT / TARGET_CHAR_BIT; TYPE_CODE (ptype) = TYPE_CODE_PTR; @@ -236,10 +236,9 @@ create_array_type (element_type, number) include the offset (that's the value of the MEMBER itself), but does include the structure type into which it points (for some reason). - FIXME: When "smashing" the type, we preserve the objfile that the + When "smashing" the type, we preserve the objfile that the old type pointed to, since we aren't changing where the type is actually - allocated. If the two types aren't associated with the same objfile, - then we are in deep-s**t anyway... */ + allocated. */ void smash_to_member_type (type, domain, to_type) @@ -262,10 +261,9 @@ smash_to_member_type (type, domain, to_type) /* Smash TYPE to be a type of method of DOMAIN with type TO_TYPE. METHOD just means `function that gets an extra "this" argument'. - FIXME: When "smashing" the type, we preserve the objfile that the + When "smashing" the type, we preserve the objfile that the old type pointed to, since we aren't changing where the type is actually - allocated. If the two types aren't associated with the same objfile, - then we are in deep-s**t anyway... */ + allocated. */ void smash_to_method_type (type, domain, to_type, args) diff --git a/gdb/main.c b/gdb/main.c index 8fc5d185f49..8543c3b463b 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1591,29 +1591,12 @@ validate_comname (comname) p = comname; while (*p) { - if (!(*p >= 'A' && *p <= 'Z') - && !(*p >= 'a' && *p <= 'z') - && !(*p >= '0' && *p <= '9') - && *p != '-') + if (!isalnum(*p) && *p != '-') error ("Junk in argument list: \"%s\"", p); p++; } } -#ifdef IBM6000 - -lowercase (char *str) -{ - while (*str) { - - /* isupper(), tolower() are function calls in AIX. */ - if ( *str >= 'A' && *str <= 'Z') - *str = *str + 'a' - 'A'; - ++str; - } -} -#endif - static void define_command (comname, from_tty) char *comname; @@ -1625,14 +1608,6 @@ define_command (comname, from_tty) validate_comname (comname); -#ifdef IBM6000 - - /* If the rest of the commands will be case insensetive, this one - should behave in the same manner. */ - - lowercase (comname); -#endif - /* Look it up, and verify that we got an exact match. */ c = lookup_cmd (&tem, cmdlist, "", -1, 1); if (c && 0 != strcmp (comname, c->name)) @@ -1644,17 +1619,23 @@ define_command (comname, from_tty) tem = "Redefine command \"%s\"? "; else tem = "Really redefine built-in command \"%s\"? "; - if (!query (tem, comname)) - error ("Command \"%s\" not redefined.", comname); + if (!query (tem, c->name)) + error ("Command \"%s\" not redefined.", c->name); } + comname = savestring (comname, strlen (comname)); + + /* If the rest of the commands will be case insensetive, this one + should behave in the same manner. */ + for (tem = comname; *tem; tem++) + if (isupper(*tem)) *tem = tolower(*tem); + if (from_tty) { printf ("Type commands for definition of \"%s\".\n\ End with a line saying just \"end\".\n", comname); fflush (stdout); } - comname = savestring (comname, strlen (comname)); cmds = read_command_lines (); @@ -2028,8 +2009,13 @@ set_history_size_command (args, from_tty, c) { if (history_size == UINT_MAX) unstifle_history (); - else + else if (history_size >= 0) stifle_history (history_size); + else + { + history_size = UINT_MAX; + error ("History size must be non-negative"); + } } /* ARGSUSED */ diff --git a/gdb/partial-stab.h b/gdb/partial-stab.h index 350d781fd3b..ba4a307e909 100644 --- a/gdb/partial-stab.h +++ b/gdb/partial-stab.h @@ -1,5 +1,6 @@ /* Shared code to pre-read a stab (dbx-style), when building a psymtab. - Copyright (C) 1986-1991 Free Software Foundation, Inc. + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 Free Software Foundation, + Inc. This file is part of GDB. diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 297e77dee9e..fea31f10ae3 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -835,8 +835,11 @@ int fram; -/* Indirect function calls use a piece of trampoline code do co context switching, - i.e. to set the new TOC table. Skip such code if exists. */ +/* Indirect function calls use a piece of trampoline code to do context + switching, i.e. to set the new TOC table. Skip such code if we are on + its first instruction (as when we have single-stepped to here). + Result is desired PC to step until, or NULL if we are not in + trampoline code. */ skip_trampoline_code (pc) int pc; -- 2.30.2