* mdebugread.c (handle_psymbol_enumerators, parse_symbol):
authorPeter Schauer <Peter.Schauer@mytum.de>
Sat, 25 Nov 1995 11:32:18 +0000 (11:32 +0000)
committerPeter Schauer <Peter.Schauer@mytum.de>
Sat, 25 Nov 1995 11:32:18 +0000 (11:32 +0000)
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/ChangeLog
gdb/mdebugread.c
gdb/symtab.c

index c75bf374195800b828a3bce17966316cc1a47dab..caaa19160efd9c41de7829499febdc7f213141f3 100644 (file)
@@ -1,3 +1,20 @@
+Sat Nov 25 02:56:38 1995  Peter Schauer  (pes@regent.e-technik.tu-muenchen.de)
+
+       * 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.
+
 Fri Nov 24 16:17:01 1995  Jeffrey A Law  (law@cygnus.com)
 
        * top.c (recurse_read_control_structure): Don't make cleanups
index 0790a78a4378567e3aad8bc0fb7fa17d010ebc5d..9698987b786449338266619326fa5c9dc8f5baa7 100644 (file)
@@ -380,7 +380,7 @@ static struct linetable *
 shrink_linetable PARAMS ((struct linetable *));
 
 static void
-handle_psymbol_enumerators PARAMS ((struct objfile *, FDR *, int));
+handle_psymbol_enumerators PARAMS ((struct objfile *, FDR *, int, CORE_ADDR));
 
 static char *
 mdebug_next_symbol_text PARAMS ((void));
@@ -931,8 +931,11 @@ parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
                if (nfields == 0 && type_code == TYPE_CODE_UNDEF)
                  /* If the type of the member is Nil (or Void),
                     without qualifiers, assume the tag is an
-                    enumeration. */
-                 if (tsym.index == indexNil)
+                    enumeration.
+                    Alpha cc -migrate enums are recognized by a zero
+                    index and a zero symbol value.  */
+                 if (tsym.index == indexNil
+                     || (tsym.index == 0 && sh->value == 0))
                    type_code = TYPE_CODE_ENUM;
                  else
                    {
@@ -1777,7 +1780,8 @@ upgrade_type (fd, tpp, tq, ax, bigend, sym_name)
        }
       fh = get_rfd (fd, rf);
 
-      indx = parse_type (fd, debug_info->external_aux + fh->iauxBase,
+      indx = parse_type (fh - debug_info->fdr,
+                        debug_info->external_aux + fh->iauxBase,
                         id, (int *) NULL, bigend, sym_name);
 
       /* The bounds type should be an integer type, but might be anything
@@ -1851,14 +1855,14 @@ upgrade_type (fd, tpp, tq, ax, bigend, sym_name)
    to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
    in question, or NULL to use top_stack->cur_block.  */
 
-static void parse_procedure PARAMS ((PDR *, struct symtab *, unsigned long,
+static void parse_procedure PARAMS ((PDR *, struct symtab *, CORE_ADDR,
                                     struct partial_symtab *));
 
 static void
-parse_procedure (pr, search_symtab, first_off, pst)
+parse_procedure (pr, search_symtab, lowest_pdr_addr, pst)
      PDR *pr;
      struct symtab *search_symtab;
-     unsigned long first_off;
+     CORE_ADDR lowest_pdr_addr;
      struct partial_symtab *pst;
 {
   struct symbol *s, *i;
@@ -1964,7 +1968,7 @@ parse_procedure (pr, search_symtab, first_off, pst)
       e = (struct mips_extra_func_info *) SYMBOL_VALUE (i);
       e->pdr = *pr;
       e->pdr.isym = (long) s;
-      e->pdr.adr += pst->textlow - first_off;
+      e->pdr.adr += pst->textlow - lowest_pdr_addr;
 
       /* Correct incorrect setjmp procedure descriptor from the library
         to make backtrace through setjmp work.  */
@@ -2113,20 +2117,20 @@ parse_external (es, bigend, section_offsets)
    with that and do not need to reorder our linetables */
 
 static void parse_lines PARAMS ((FDR *, PDR *, struct linetable *, int,
-                                struct partial_symtab *));
+                                struct partial_symtab *, CORE_ADDR));
 
 static void
-parse_lines (fh, pr, lt, maxlines, pst)
+parse_lines (fh, pr, lt, maxlines, pst, lowest_pdr_addr)
      FDR *fh;
      PDR *pr;
      struct linetable *lt;
      int maxlines;
      struct partial_symtab *pst;
+     CORE_ADDR lowest_pdr_addr;
 {
   unsigned char *base;
   int j, k;
   int delta, count, lineno = 0;
-  unsigned long first_off = pr->adr;
 
   if (fh->cbLine == 0)
     return;
@@ -2135,8 +2139,8 @@ parse_lines (fh, pr, lt, maxlines, pst)
   k = 0;
   for (j = 0; j < fh->cpd; j++, pr++)
     {
-      long l;
-      unsigned long adr;
+      CORE_ADDR l;
+      CORE_ADDR adr;
       unsigned char *halt;
 
       /* No code for this one */
@@ -2153,7 +2157,7 @@ parse_lines (fh, pr, lt, maxlines, pst)
        halt = base + fh->cbLine;
       base += pr->cbLineOffset;
 
-      adr = pst->textlow + pr->adr - first_off;
+      adr = pst->textlow + pr->adr - lowest_pdr_addr;
 
       l = adr >> 2;            /* in words */
       for (lineno = pr->lnLow; base < halt; )
@@ -2794,7 +2798,7 @@ parse_partial_symbols (objfile, section_offsets)
                                           sh.value,
                                           psymtab_language, objfile);
                    }
-                 handle_psymbol_enumerators (objfile, fh, sh.st);
+                 handle_psymbol_enumerators (objfile, fh, sh.st, sh.value);
 
                  /* Skip over the block */
                  new_sdx = sh.index;
@@ -3017,10 +3021,11 @@ parse_partial_symbols (objfile, section_offsets)
    all the the enum constants to the partial symbol table.  */
 
 static void
-handle_psymbol_enumerators (objfile, fh, stype)
+handle_psymbol_enumerators (objfile, fh, stype, svalue)
      struct objfile *objfile;
      FDR *fh;
      int stype;
+     CORE_ADDR svalue;
 {
   const bfd_size_type external_sym_size = debug_swap->external_sym_size;
   void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *))
@@ -3038,12 +3043,15 @@ handle_psymbol_enumerators (objfile, fh, stype)
     case stBlock:
       /* It is an enumerated type if the next symbol entry is a stMember
         and its auxiliary index is indexNil or its auxiliary entry
-        is a plain btNil or btVoid.  */
+        is a plain btNil or btVoid.
+        Alpha cc -migrate enums are recognized by a zero index and
+        a zero symbol value.  */
       (*swap_sym_in) (cur_bfd, ext_sym, &sh);
       if (sh.st != stMember)
        return;
 
-      if (sh.index == indexNil)
+      if (sh.index == indexNil
+         || (sh.index == 0 && svalue == 0))
        break;
       (*debug_swap->swap_tir_in) (fh->fBigendian,
                                  &(debug_info->external_aux
@@ -3113,6 +3121,7 @@ psymtab_to_symtab_1 (pst, filename)
   struct symtab *st;
   FDR *fh;
   struct linetable *lines;
+  CORE_ADDR lowest_pdr_addr = 0;
 
   if (pst->readin)
     return;
@@ -3186,10 +3195,6 @@ psymtab_to_symtab_1 (pst, filename)
 
   if (processing_gcc_compilation != 0)
     {
-      char *pdr_ptr;
-      char *pdr_end;
-      int first_pdr;
-      unsigned long first_off = 0;
 
       /* This symbol table contains stabs-in-ecoff entries.  */
 
@@ -3279,21 +3284,42 @@ psymtab_to_symtab_1 (pst, filename)
         generated via asm statements.  */
 
       /* Fill in procedure info next.  */
-      first_pdr = 1;
-      pdr_ptr = ((char *) debug_info->external_pdr
-                + fh->ipdFirst * external_pdr_size);
-      pdr_end = pdr_ptr + fh->cpd * external_pdr_size;
-      for (; pdr_ptr < pdr_end; pdr_ptr += external_pdr_size)
+      if (fh->cpd > 0)
        {
-         PDR pr;
-
-         (*swap_pdr_in) (cur_bfd, pdr_ptr, &pr);
-         if (first_pdr)
+         PDR *pr_block;
+         struct cleanup *old_chain;
+         char *pdr_ptr;
+         char *pdr_end;
+         PDR *pdr_in;
+         PDR *pdr_in_end;
+
+         pr_block = (PDR *) xmalloc (fh->cpd * sizeof (PDR));
+         old_chain = make_cleanup (free, pr_block);
+
+         pdr_ptr = ((char *) debug_info->external_pdr
+                    + fh->ipdFirst * external_pdr_size);
+         pdr_end = pdr_ptr + fh->cpd * external_pdr_size;
+         pdr_in = pr_block;
+         for (;
+              pdr_ptr < pdr_end;
+              pdr_ptr += external_pdr_size, pdr_in++)
            {
-             first_off = pr.adr;
-             first_pdr = 0;
+             (*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
+
+             /* Determine lowest PDR address, the PDRs are not always
+                sorted.  */
+             if (pdr_in == pr_block)
+               lowest_pdr_addr = pdr_in->adr;
+             else if (pdr_in->adr < lowest_pdr_addr)
+               lowest_pdr_addr = pdr_in->adr;
            }
-         parse_procedure (&pr, st, first_off, pst);
+
+         pdr_in = pr_block;
+         pdr_in_end = pdr_in + fh->cpd;
+         for (; pdr_in < pdr_in_end; pdr_in++)
+           parse_procedure (pdr_in, st, lowest_pdr_addr, pst);
+
+         do_cleanups (old_chain);
        }
     }
   else
@@ -3386,9 +3412,18 @@ psymtab_to_symtab_1 (pst, filename)
              for (;
                   pdr_ptr < pdr_end;
                   pdr_ptr += external_pdr_size, pdr_in++)
-               (*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
+               {
+                 (*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
+
+                 /* Determine lowest PDR address, the PDRs are not always
+                    sorted.  */
+                 if (pdr_in == pr_block)
+                   lowest_pdr_addr = pdr_in->adr;
+                 else if (pdr_in->adr < lowest_pdr_addr)
+                   lowest_pdr_addr = pdr_in->adr;
+               }
 
-             parse_lines (fh, pr_block, lines, maxlines, pst);
+             parse_lines (fh, pr_block, lines, maxlines, pst, lowest_pdr_addr);
              if (lines->nitems < fh->cline)
                lines = shrink_linetable (lines);
 
@@ -3396,7 +3431,7 @@ psymtab_to_symtab_1 (pst, filename)
              pdr_in = pr_block;
              pdr_in_end = pdr_in + fh->cpd;
              for (; pdr_in < pdr_in_end; pdr_in++)
-               parse_procedure (pdr_in, 0, pr_block->adr, pst);
+               parse_procedure (pdr_in, 0, lowest_pdr_addr, pst);
 
              do_cleanups (old_chain);
            }
index 840efb0ac8f192bb169c71c11d9edf98f3a819c0..ea2d60f7ef9b441eb38d51b39473490b1fb15e03 100644 (file)
@@ -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<TAB> or '%s<ESC-?>\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.  */
This page took 0.034337 seconds and 4 git commands to generate.