From 9b041f69fc5372c05d5d8a067d8263c12c2a3abb Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Sat, 25 Nov 1995 11:32:18 +0000 Subject: * mdebugread.c (handle_psymbol_enumerators, parse_symbol): Recognize enums from alpha cc -migrate. (upgrade_type): Pass correct fd to parse_symbol when parsing the index type of an array. (parse_procedure, parse_lines, psymtab_to_symtab_1): Handle unsorted procedure descriptors from Irix 5.x and Alpha OSF/1-3.x shared libraries. Use CORE_ADDR instead of `unsigned long' in procedure descriptor address computations. * symtab.c (decode_line_1): Prevent accidental strchr match of a null character with the terminating null character of gdb_completer_quote_characters. (cplusplus_hint): Make sure that only a single quote is printed in the hint message. --- gdb/symtab.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'gdb/symtab.c') diff --git a/gdb/symtab.c b/gdb/symtab.c index 840efb0..ea2d60f 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1,5 +1,5 @@ /* Symbol table lookup for the GNU debugger, GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994 + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. This file is part of GDB. @@ -110,6 +110,8 @@ void cplusplus_hint (name) char *name; { + while (*name == '\'') + name++; printf_filtered ("Hint: try '%s or '%s\n", name, name); printf_filtered ("(Note leading single quote.)\n"); } @@ -1915,9 +1917,10 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */ s = NULL; - is_quoted = (strchr(gdb_completer_quote_characters, **argptr) != NULL); - has_parens = (( pp = strchr(*argptr, '(')) != NULL && - (pp = strchr(pp, ')')) != NULL); + is_quoted = (**argptr + && strchr (gdb_completer_quote_characters, **argptr) != NULL); + has_parens = ((pp = strchr (*argptr, '(')) != NULL + && (pp = strchr (pp, ')')) != NULL); for (p = *argptr; *p; p++) { @@ -1962,7 +1965,8 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) { /* Arg token is not digits => try it as a function name Find the next token(everything up to end or next blank). */ - if (strchr(gdb_completer_quote_characters, **argptr) != NULL) + if (**argptr + && strchr (gdb_completer_quote_characters, **argptr) != NULL) { p = skip_quoted(*argptr); *argptr = *argptr + 1; @@ -1998,8 +2002,11 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) copy = (char *) alloca (p - *argptr + 1 ); memcpy (copy, *argptr, p - *argptr); copy[p - *argptr] = '\0'; - if (strchr(gdb_completer_quote_characters, copy[p-*argptr-1]) != NULL) - copy[p - *argptr -1] = '\0'; + if (p != *argptr + && copy[p - *argptr - 1] + && strchr (gdb_completer_quote_characters, + copy[p - *argptr - 1]) != NULL) + copy[p - *argptr - 1] = '\0'; } /* no line number may be specified */ @@ -2211,7 +2218,8 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical) memcpy (copy, *argptr, p - *argptr); copy[p - *argptr] = '\0'; if (p != *argptr - && (copy[0] == copy [p - *argptr - 1]) + && copy[0] + && copy[0] == copy [p - *argptr - 1] && strchr (gdb_completer_quote_characters, copy[0]) != NULL) { copy [p - *argptr - 1] = '\0'; @@ -3243,6 +3251,9 @@ make_symbol_completion_list (text, word) /* Determine if PC is in the prologue of a function. The prologue is the area between the first instruction of a function, and the first executable line. Returns 1 if PC *might* be in prologue, 0 if definately *not* in prologue. + + If non-zero, func_start is where we thing the prologue starts, possibly + by previous examination of symbol table information. */ int @@ -3276,6 +3287,11 @@ in_prologue (pc, func_start) nosyms: +/* If func_start is zero (meaning unknown) then we don't know whether pc is + in the prologue or not. I.E. it might be. */ + + if (!func_start) return 1; + /* We need to call the target-specific prologue skipping functions with the function's start address because PC may be pointing at an instruction that could be mistakenly considered part of the prologue. */ -- cgit v1.1