OSDN Git Service

Clean up compiler warnings:
authorkingdon <kingdon>
Tue, 8 Feb 2000 04:39:01 +0000 (04:39 +0000)
committerkingdon <kingdon>
Tue, 8 Feb 2000 04:39:01 +0000 (04:39 +0000)
* bcache.h, bcache.c, c-valprint.c, coffread.c, stabsread.c,
stack.c, valprint.c: Change variables to unsigned.
* bcache.c: Rearrange to avoid warnings about variables not being set.
* c-lang.c, ch-lang.c, f-lang.c, m2-lang.c: Include valprint.h
rather than declaring print_max and repeat_count_threashold
ourselves (incorrectly).
* valprint.h: Do declare repeat_count_threashold.
* ch-exp.c: Use default case for internal error.
* findvar.c: Don't omit argument type.
* symtab.c: Remove unused variable.

16 files changed:
gdb/ChangeLog
gdb/bcache.c
gdb/bcache.h
gdb/c-lang.c
gdb/c-valprint.c
gdb/ch-exp.c
gdb/ch-lang.c
gdb/coffread.c
gdb/f-lang.c
gdb/findvar.c
gdb/m2-lang.c
gdb/stabsread.c
gdb/stack.c
gdb/symtab.c
gdb/valprint.c
gdb/valprint.h

index 2f28b00..8577064 100644 (file)
@@ -1,3 +1,17 @@
+2000-02-07  Jim Kingdon  <kingdon@redhat.com>
+
+       Clean up compiler warnings:
+       * bcache.h, bcache.c, c-valprint.c, coffread.c, stabsread.c,
+       stack.c, valprint.c: Change variables to unsigned.
+       * bcache.c: Rearrange to avoid warnings about variables not being set.
+       * c-lang.c, ch-lang.c, f-lang.c, m2-lang.c: Include valprint.h
+       rather than declaring print_max and repeat_count_threashold
+       ourselves (incorrectly).
+       * valprint.h: Do declare repeat_count_threashold.
+       * ch-exp.c: Use default case for internal error.
+       * findvar.c: Don't omit argument type.
+       * symtab.c: Remove unused variable.
+
 2000-02-04  Nick Clifton  <nickc@cygnus.com>
 
        * config/arm/tm-arm.h (LOWEST_PC): Define.
index d28515b..766aff9 100644 (file)
 /* Implement a cached obstack.
-   Written by Fred Fish (fnf@cygnus.com)
-   Copyright 1995, 1998 Free Software Foundation, Inc.
+   Written by Fred Fish <fnf@cygnus.com>
+   Rewritten by Jim Blandy <jimb@cygnus.com>
+   Copyright 1999 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <stddef.h>
+#include <stdlib.h>
 
 #include "defs.h"
 #include "obstack.h"
 #include "bcache.h"
 #include "gdb_string.h"                /* For memcpy declaration */
 
-/* Prototypes for local functions. */
 
-static unsigned int hash PARAMS ((void *, int));
+\f
+/* The hash function.  */
 
-static void *lookup_cache PARAMS ((void *, int, int, struct bcache *));
+unsigned long
+hash (void *addr, int length)
+{
+  /* If it's a short string, hash on every character.  Otherwise, sample
+     characters from throughout the string.  */
+  if (length <= 64)
+    {
+      char *byte = addr;
+      unsigned long h = 0;
+      int i;
 
-/* FIXME:  Incredibly simplistic hash generator.  Probably way too expensive
- (consider long strings) and unlikely to have good distribution across hash
- values for typical input. */
+      for (i = 0; i < length; i++)
+       h = h * 65793 ^ (h >> (sizeof (h) * 8 - 6)) ^ byte[i];
 
-static unsigned int
-hash (bytes, count)
-     void *bytes;
-     int count;
-{
-  unsigned int len;
-  unsigned long hashval;
-  unsigned int c;
-  const unsigned char *data = bytes;
-
-  hashval = 0;
-  len = 0;
-  while (count-- > 0)
+      return h;
+    }
+  else
     {
-      c = *data++;
-      hashval += c + (c << 17);
-      hashval ^= hashval >> 2;
-      ++len;
+      char *byte = addr;
+      int n, i;
+      unsigned long h = 0;
+
+      for (n = i = 0; n < 64; n++)
+       {
+         h = h * 65793 + (h >> (sizeof (h) * 8 - 6)) + byte[i];
+         i = h % length;
+       }
+
+      return h;
     }
-  hashval += len + (len << 17);
-  hashval ^= hashval >> 2;
-  return (hashval % BCACHE_HASHSIZE);
 }
 
-static void *
-lookup_cache (bytes, count, hashval, bcachep)
-     void *bytes;
-     int count;
-     int hashval;
-     struct bcache *bcachep;
+\f
+/* Growing the bcache's hash table.  */
+
+/* If the average chain length grows beyond this, then we want to
+   resize our hash table.  */
+#define CHAIN_LENGTH_THRESHOLD (5)
+
+static void
+expand_hash_table (struct bcache *bcache)
 {
-  void *location = NULL;
-  struct hashlink **hashtablep;
-  struct hashlink *linkp;
+  /* A table of good hash table sizes.  Whenever we grow, we pick the
+     next larger size from this table.  sizes[i] is close to 1 << (i+10),
+     so we roughly double the table size each time.  After we fall off 
+     the end of this table, we just double.  Don't laugh --- there have
+     been executables sighted with a gigabyte of debug info.  */
+  static unsigned long sizes[] = { 
+    1021, 2053, 4099, 8191, 16381, 32771,
+    65537, 131071, 262144, 524287, 1048573, 2097143,
+    4194301, 8388617, 16777213, 33554467, 67108859, 134217757,
+    268435459, 536870923, 1073741827, 2147483659UL
+  };
+  unsigned int new_num_buckets;
+  struct bstring **new_buckets;
+  unsigned int i;
+
+  /* Find the next size.  */
+  new_num_buckets = bcache->num_buckets * 2;
+  for (i = 0; i < (sizeof (sizes) / sizeof (sizes[0])); i++)
+    if (sizes[i] > bcache->num_buckets)
+      {
+       new_num_buckets = sizes[i];
+       break;
+      }
+
+  /* Allocate the new table.  */
+  {
+    size_t new_size = new_num_buckets * sizeof (new_buckets[0]);
+    new_buckets = (struct bstring **) xmalloc (new_size);
+    memset (new_buckets, 0, new_size);
+
+    bcache->structure_size -= (bcache->num_buckets
+                              * sizeof (bcache->bucket[0]));
+    bcache->structure_size += new_size;
+  }
 
-  hashtablep = bcachep -> indextable[count];
-  if (hashtablep != NULL)
+  /* Rehash all existing strings.  */
+  for (i = 0; i < bcache->num_buckets; i++)
     {
-      linkp = hashtablep[hashval];
-      while (linkp != NULL)
+      struct bstring *s, *next;
+
+      for (s = bcache->bucket[i]; s; s = next)
        {
-         if (memcmp (BCACHE_DATA (linkp), bytes, count) == 0)
-           {
-             location = BCACHE_DATA (linkp);
-             break;
-           }
-         linkp = linkp -> next;
+         struct bstring **new_bucket;
+         next = s->next;
+
+         new_bucket = &new_buckets[(hash (&s->d.data, s->length)
+                                    % new_num_buckets)];
+         s->next = *new_bucket;
+         *new_bucket = s;
        }
     }
-  return (location);
+
+  /* Plug in the new table.  */
+  if (bcache->bucket)
+    free (bcache->bucket);
+  bcache->bucket = new_buckets;
+  bcache->num_buckets = new_num_buckets;
 }
 
+\f
+/* Looking up things in the bcache.  */
+
+/* The number of bytes needed to allocate a struct bstring whose data
+   is N bytes long.  */
+#define BSTRING_SIZE(n) (offsetof (struct bstring, d.data) + (n))
+
+/* Find a copy of the LENGTH bytes at ADDR in BCACHE.  If BCACHE has
+   never seen those bytes before, add a copy of them to BCACHE.  In
+   either case, return a pointer to BCACHE's copy of that string.  */
 void *
-bcache (bytes, count, bcachep)
-     void *bytes;
-     int count;
-     struct bcache *bcachep;
+bcache (void *addr, int length, struct bcache *bcache)
 {
-  int hashval;
-  void *location;
-  struct hashlink *newlink;
-  struct hashlink **linkpp;
-  struct hashlink ***hashtablepp;
+  int hash_index;
+  struct bstring *s;
 
-  if (count >= BCACHE_MAXLENGTH)
-    {
-      /* Rare enough to just stash unique copies */
-      location = (void *) obstack_alloc (&bcachep->cache, count);
-      bcachep -> cache_bytes += count;
-      memcpy (location, bytes, count);
-      bcachep -> bcache_overflows++;
-    }
-  else
-    {
-      hashval = hash (bytes, count);
-      location = lookup_cache (bytes, count, hashval, bcachep);
-      if (location != NULL)
-       {
-         bcachep -> cache_savings += count;
-         bcachep -> cache_hits++;
-       }
-      else
-       {
-         bcachep -> cache_misses++;
-         hashtablepp = &bcachep -> indextable[count];
-         if (*hashtablepp == NULL)
-           {
-             *hashtablepp = (struct hashlink **)
-               obstack_alloc (&bcachep->cache, BCACHE_HASHSIZE * sizeof (struct hashlink *));
-             bcachep -> cache_bytes += BCACHE_HASHSIZE * sizeof (struct hashlink *);
-             memset (*hashtablepp, 0, BCACHE_HASHSIZE * sizeof (struct hashlink *));
-           }
-         linkpp = &(*hashtablepp)[hashval];
-         newlink = (struct hashlink *)
-           obstack_alloc (&bcachep->cache, BCACHE_DATA_ALIGNMENT + count);
-         bcachep -> cache_bytes += BCACHE_DATA_ALIGNMENT + count;
-         memcpy (BCACHE_DATA (newlink), bytes, count);
-         newlink -> next = *linkpp;
-         *linkpp = newlink;
-         location = BCACHE_DATA (newlink);
-       }
-    }
-  return (location);
+  /* If our average chain length is too high, expand the hash table.  */
+  if (bcache->unique_count >= bcache->num_buckets * CHAIN_LENGTH_THRESHOLD)
+    expand_hash_table (bcache);
+
+  bcache->total_count++;
+  bcache->total_size += length;
+
+  hash_index = hash (addr, length) % bcache->num_buckets;
+
+  /* Search the hash bucket for a string identical to the caller's.  */
+  for (s = bcache->bucket[hash_index]; s; s = s->next)
+    if (s->length == length
+       && ! memcmp (&s->d.data, addr, length))
+      return &s->d.data;
+
+  /* The user's string isn't in the list.  Insert it after *ps.  */
+  {
+    struct bstring *new
+      = obstack_alloc (&bcache->cache, BSTRING_SIZE (length));
+    memcpy (&new->d.data, addr, length);
+    new->length = length;
+    new->next = bcache->bucket[hash_index];
+    bcache->bucket[hash_index] = new;
+
+    bcache->unique_count++;
+    bcache->unique_size += length;
+    bcache->structure_size += BSTRING_SIZE (length);
+
+    return &new->d.data;
+  }
 }
 
-#if MAINTENANCE_CMDS
+\f
+/* Freeing bcaches.  */
 
+/* Free all the storage associated with BCACHE.  */
 void
-print_bcache_statistics (bcachep, id)
-     struct bcache *bcachep;
-     char *id;
+free_bcache (struct bcache *bcache)
 {
-  struct hashlink **hashtablep;
-  struct hashlink *linkp;
-  int tidx, tcount, hidx, hcount, lcount, lmax, temp, lmaxt, lmaxh;
+  obstack_free (&bcache->cache, 0);
+  free (bcache->bucket);
 
-  for (lmax = lcount = tcount = hcount = tidx = 0; tidx < BCACHE_MAXLENGTH; tidx++)
-    {
-      hashtablep = bcachep -> indextable[tidx];
-      if (hashtablep != NULL)
-       {
-         tcount++;
-         for (hidx = 0; hidx < BCACHE_HASHSIZE; hidx++)
-           {
-             linkp = hashtablep[hidx];
-             if (linkp != NULL)
-               {
-                 hcount++;
-                 for (temp = 0; linkp != NULL; linkp = linkp -> next)
-                   {
-                     lcount++;
-                     temp++;
-                   }
-                 if (temp > lmax)
-                   {
-                     lmax = temp;
-                     lmaxt = tidx;
-                     lmaxh = hidx;
-                   }
-               }
-           }
-       }
-    }
-  printf_filtered ("  Cached '%s' statistics:\n", id);
-  printf_filtered ("    Cache hits: %d\n", bcachep -> cache_hits);
-  printf_filtered ("    Cache misses: %d\n", bcachep -> cache_misses);
-  printf_filtered ("    Cache hit ratio: ");
-  if (bcachep -> cache_hits + bcachep -> cache_misses > 0)
-    {
-      printf_filtered ("%d%%\n", ((bcachep -> cache_hits) * 100) /
-                      (bcachep -> cache_hits + bcachep -> cache_misses));
-    }
-  else
-    {
-      printf_filtered ("(not applicable)\n");
-    }
-  printf_filtered ("    Space used for caching: %d\n", bcachep -> cache_bytes);
-  printf_filtered ("    Space saved by cache hits: %d\n", bcachep -> cache_savings);
-  printf_filtered ("    Number of bcache overflows: %d\n", bcachep -> bcache_overflows);
-  printf_filtered ("    Number of index buckets used: %d\n", tcount);
-  printf_filtered ("    Number of hash table buckets used: %d\n", hcount);
-  printf_filtered ("    Number of chained items: %d\n", lcount);
-  printf_filtered ("    Average hash table population: ");
-  if (tcount > 0)
-    {
-      printf_filtered ("%d%%\n", (hcount * 100) / (tcount * BCACHE_HASHSIZE));
-    }
-  else
-    {
-      printf_filtered ("(not applicable)\n");
-    }
-  printf_filtered ("    Average chain length ");
-  if (hcount > 0)
-    {
-      printf_filtered ("%d\n", lcount / hcount);
-    }
+  /* This isn't necessary, but at least the bcache is always in a
+     consistent state.  */
+  memset (bcache, 0, sizeof (*bcache));
+}
+
+
+\f
+/* Printing statistics.  */
+
+static int
+compare_ints (const void *ap, const void *bp)
+{
+  /* Because we know we're comparing two ints which are positive,
+     there's no danger of overflow here.  */
+  return * (int *) ap - * (int *) bp;
+}
+
+
+static void
+print_percentage (int portion, int total)
+{
+  if (total == 0)
+    printf_filtered ("(not applicable)\n");
   else
-    {
-      printf_filtered ("(not applicable)\n");
-    }
-  printf_filtered ("    Maximum chain length %d at %d:%d\n", lmax, lmaxt, lmaxh);
+    printf_filtered ("%3d%%\n", portion * 100 / total);
 }
 
-#endif /* MAINTENANCE_CMDS */
+
+/* Print statistics on BCACHE's memory usage and efficacity at
+   eliminating duplication.  NAME should describe the kind of data
+   BCACHE holds.  Statistics are printed using `printf_filtered' and
+   its ilk.  */
+void
+print_bcache_statistics (struct bcache *c, char *type)
+{
+  int occupied_buckets;
+  int max_chain_length;
+  int median_chain_length;
+
+  /* Count the number of occupied buckets, and measure chain lengths.  */
+  {
+    unsigned int b;
+    int *chain_length
+      = (int *) alloca (c->num_buckets * sizeof (*chain_length));
+
+    occupied_buckets = 0;
+
+    for (b = 0; b < c->num_buckets; b++)
+      {
+       struct bstring *s = c->bucket[b];
+
+       chain_length[b] = 0;
+
+       if (s)
+         {
+           occupied_buckets++;
+           
+           while (s)
+             {
+               chain_length[b]++;
+               s = s->next;
+             }
+         }
+      }
+
+    /* To compute the median, we need the set of chain lengths sorted.  */
+    qsort (chain_length, c->num_buckets, sizeof (chain_length[0]),
+          compare_ints);
+
+    if (c->num_buckets > 0)
+      {
+       max_chain_length = chain_length[c->num_buckets - 1];
+       median_chain_length = chain_length[c->num_buckets / 2];
+      }
+    else
+      {
+       max_chain_length = 0;
+       median_chain_length = 0;
+      }
+  }
+
+  printf_filtered ("  Cached '%s' statistics:\n", type);
+  printf_filtered ("    Total object count:  %ld\n", c->total_count);
+  printf_filtered ("    Unique object count: %lu\n", c->unique_count);
+  printf_filtered ("    Percentage of duplicates, by count: ");
+  print_percentage (c->total_count - c->unique_count, c->total_count);
+  printf_filtered ("\n");
+
+  printf_filtered ("    Total object size:   %ld\n", c->total_size);
+  printf_filtered ("    Unique object size:  %ld\n", c->unique_size);
+  printf_filtered ("    Percentage of duplicates, by size:  ");
+  print_percentage (c->total_size - c->unique_size, c->total_size);
+  printf_filtered ("\n");
+
+  printf_filtered ("    Total memory used by bcache, including overhead: %ld\n",
+                  c->structure_size);
+  printf_filtered ("    Percentage memory overhead: ");
+  print_percentage (c->structure_size - c->unique_size, c->unique_size);
+  printf_filtered ("    Net memory savings:         ");
+  print_percentage (c->total_size - c->structure_size, c->total_size);
+  printf_filtered ("\n");
+
+  printf_filtered ("    Hash table size:           %3d\n", c->num_buckets);
+  printf_filtered ("    Hash table population:     ");
+  print_percentage (occupied_buckets, c->num_buckets);
+  printf_filtered ("    Median hash chain length:  %3d\n",
+                  median_chain_length);
+  printf_filtered ("    Average hash chain length: ");
+  if (c->num_buckets > 0)
+    printf_filtered ("%3lu\n", c->unique_count / c->num_buckets);
+  else
+    printf_filtered ("(not applicable)\n");
+  printf_filtered ("    Maximum hash chain length: %3d\n", max_chain_length);
+  printf_filtered ("\n");
+}
index cf0c62e..4735af7 100644 (file)
 /* Include file cached obstack implementation.
-   Written by Fred Fish (fnf@cygnus.com)
-   Copyright 1995 Free Software Foundation, Inc.
+   Written by Fred Fish <fnf@cygnus.com>
+   Rewritten by Jim Blandy <jimb@cygnus.com>
+   Copyright 1999 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #ifndef BCACHE_H
 #define BCACHE_H 1
 
-#define BCACHE_HASHLENGTH      12      /* Number of bits in hash value */
-#define BCACHE_HASHSIZE        (1 << BCACHE_HASHLENGTH)
-#define BCACHE_MAXLENGTH       128
-
-/* Note that the user data is stored in data[].  Since it can be any type,
-   it needs to have the same alignment  as the most strict alignment of 
-   any type on the host machine.  So do it the same way obstack does. */
-
-struct hashlink {
-  struct hashlink *next;
-  union {
+/* A bcache is a data structure for factoring out duplication in
+   read-only structures.  You give the bcache some string of bytes S.
+   If the bcache already contains a copy of S, it hands you back a
+   pointer to its copy.  Otherwise, it makes a fresh copy of S, and
+   hands you back a pointer to that.  In either case, you can throw
+   away your copy of S, and use the bcache's.
+
+   The "strings" in question are arbitrary strings of bytes --- they
+   can contain zero bytes.  You pass in the length explicitly when you
+   call the bcache function.
+
+   This means that you can put ordinary C objects in a bcache.
+   However, if you do this, remember that structs can contain `holes'
+   between members, added for alignment.  These bytes usually contain
+   garbage.  If you try to bcache two objects which are identical from
+   your code's point of view, but have different garbage values in the
+   structure's holes, then the bcache will treat them as separate
+   strings, and you won't get the nice elimination of duplicates you
+   were hoping for.  So, remember to memset your structures full of
+   zeros before bcaching them!
+
+   You shouldn't modify the strings you get from a bcache, because:
+
+   - You don't necessarily know who you're sharing space with.  If I
+     stick eight bytes of text in a bcache, and then stick an
+     eight-byte structure in the same bcache, there's no guarantee
+     those two objects don't actually comprise the same sequence of
+     bytes.  If they happen to, the bcache will use a single byte
+     string for both of them.  Then, modifying the structure will
+     change the string.  In bizarre ways.
+
+   - Even if you know for some other reason that all that's okay,
+     there's another problem.  A bcache stores all its strings in a
+     hash table.  If you modify a string's contents, you will probably
+     change its hash value.  This means that the modified string is
+     now in the wrong place in the hash table, and future bcache
+     probes will never find it.  So by mutating a string, you give up
+     any chance of sharing its space with future duplicates.  */
+
+
+/* The type used to hold a single bcache string.  The user data is
+   stored in d.data.  Since it can be any type, it needs to have the
+   same alignment as the most strict alignment of any type on the host
+   machine.  I don't know of any really correct way to do this in
+   stock ANSI C, so just do it the same way obstack.h does.
+
+   It would be nicer to have this stuff hidden away in bcache.c, but
+   struct objstack contains a struct bcache directly --- not a pointer
+   to one --- and then the memory-mapped stuff makes this a real pain.
+   We don't strictly need to expose struct bstring, but it's better to
+   have it all in one place.  */
+
+struct bstring {
+  struct bstring *next;
+  size_t length;
+
+  union
+  {
     char data[1];
     double dummy;
-  } d;
+  }
+  d;
 };
 
-/* BCACHE_DATA is used to get the address of the cached data. */
-
-#define BCACHE_DATA(p) ((p)->d.data)
-
-/* BCACHE_DATA_ALIGNMENT is used to get the offset of the start of
-   cached data within the hashlink struct.  This value, plus the
-   size of the cached data, is the amount of space to allocate for
-   a hashlink struct to hold the next pointer and the data. */
-
-#define BCACHE_DATA_ALIGNMENT \
-       (((char *) BCACHE_DATA((struct hashlink*) 0) - (char *) 0))
 
+/* The structure for a bcache itself.
+   To initialize a bcache, just fill it with zeros.  */
 struct bcache {
+  /* All the bstrings are allocated here.  */
   struct obstack cache;
-  struct hashlink **indextable[BCACHE_MAXLENGTH];
-  int cache_hits;
-  int cache_misses;
-  int cache_bytes;
-  int cache_savings;
-  int bcache_overflows;
+
+  /* How many hash buckets we're using.  */
+  unsigned int num_buckets;
+  
+  /* Hash buckets.  This table is allocated using malloc, so when we
+     grow the table we can return the old table to the system.  */
+  struct bstring **bucket;
+
+  /* Statistics.  */
+  unsigned long unique_count;  /* number of unique strings */
+  long total_count;    /* total number of strings cached, including dups */
+  long unique_size;    /* size of unique strings, in bytes */
+  long total_size;      /* total number of bytes cached, including dups */
+  long structure_size; /* total size of bcache, including infrastructure */
 };
 
-extern void *
-bcache PARAMS ((void *bytes, int count, struct bcache *bcachep));
 
-#if MAINTENANCE_CMDS
+/* Find a copy of the LENGTH bytes at ADDR in BCACHE.  If BCACHE has
+   never seen those bytes before, add a copy of them to BCACHE.  In
+   either case, return a pointer to BCACHE's copy of that string.  */
+extern void *bcache (void *addr, int length, struct bcache *bcache);
 
-extern void
-print_bcache_statistics PARAMS ((struct bcache *, char *));
+/* Free all the storage that BCACHE refers to.  The result is a valid,
+   but empty, bcache.  This does not free BCACHE itself, since that
+   might be part of some larger object.  */
+extern void free_bcache (struct bcache *bcache);
 
-#endif /* MAINTENANCE_CMDS */
+/* Print statistics on BCACHE's memory usage and efficacity at
+   eliminating duplication.  TYPE should be a string describing the
+   kind of data BCACHE holds.  Statistics are printed using
+   `printf_filtered' and its ilk.  */
+extern void print_bcache_statistics (struct bcache *bcache, char *type);
 
 #endif /* BCACHE_H */
index e7aa055..2211acb 100644 (file)
@@ -1,21 +1,22 @@
 /* C language support routines for GDB, the GNU debugger.
-   Copyright 1992, 1993, 1994 Free Software Foundation, Inc.
+   Copyright 1992, 1993, 1994, 2000 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -24,8 +25,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "parser-defs.h"
 #include "language.h"
 #include "c-lang.h"
+#include "valprint.h"
 
-static void c_emit_char PARAMS ((int c, GDB_FILE *stream, int quoter));
+extern void _initialize_c_language PARAMS ((void));
+static void c_emit_char (int c, struct ui_file * stream, int quoter);
 
 /* Print the character C on STREAM as part of the contents of a literal
    string whose delimiter is QUOTER.  Note that that format for printing
@@ -34,7 +37,7 @@ static void c_emit_char PARAMS ((int c, GDB_FILE *stream, int quoter));
 static void
 c_emit_char (c, stream, quoter)
      register int c;
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int quoter;
 {
   c &= 0xFF;                   /* Avoid sign bit follies */
@@ -82,7 +85,7 @@ c_emit_char (c, stream, quoter)
 void
 c_printchar (c, stream)
      int c;
-     GDB_FILE *stream;
+     struct ui_file *stream;
 {
   fputc_filtered ('\'', stream);
   LA_EMIT_CHAR (c, stream, '\'');
@@ -97,7 +100,7 @@ c_printchar (c, stream)
 
 void
 c_printstr (stream, string, length, width, force_ellipses)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      char *string;
      unsigned int length;
      int width;
@@ -108,15 +111,13 @@ c_printstr (stream, string, length, width, force_ellipses)
   int in_quotes = 0;
   int need_comma = 0;
   extern int inspect_it;
-  extern int repeat_count_threshold;
-  extern int print_max;
 
   /* If the string was not truncated due to `set print elements', and
      the last byte of it is a null, we don't print that, in traditional C
      style.  */
   if (!force_ellipses
       && length > 0
-      && extract_unsigned_integer (string + (length - 1) * width, width) == '\0')
+  && extract_unsigned_integer (string + (length - 1) * width, width) == '\0')
     length--;
 
   if (length == 0)
@@ -128,7 +129,7 @@ c_printstr (stream, string, length, width, force_ellipses)
   for (i = 0; i < length && things_printed < print_max; ++i)
     {
       /* Position of the character we are examining
-        to see whether it is repeated.  */
+         to see whether it is repeated.  */
       unsigned int rep1;
       /* Number of repetitions we have detected so far.  */
       unsigned int reps;
@@ -148,7 +149,7 @@ c_printstr (stream, string, length, width, force_ellipses)
       reps = 1;
       while (rep1 < length
             && extract_unsigned_integer (string + rep1 * width, width)
-               == current_char)
+            == current_char)
        {
          ++rep1;
          ++reps;
@@ -230,191 +231,190 @@ c_create_fundamental_type (objfile, typeid)
 
   switch (typeid)
     {
-      default:
-       /* FIXME:  For now, if we are asked to produce a type not in this
-          language, create the equivalent of a C integer type with the
-          name "<?type?>".  When all the dust settles from the type
-          reconstruction work, this should probably become an error. */
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         0, "<?type?>", objfile);
-        warning ("internal error: no C/C++ fundamental type %d", typeid);
-       break;
-      case FT_VOID:
-       type = init_type (TYPE_CODE_VOID,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         0, "void", objfile);
-       break;
-      case FT_BOOLEAN:
-        type = init_type (TYPE_CODE_BOOL,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                          0, "bool", objfile);
-                          
-        break;
-      case FT_CHAR:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         0, "char", objfile);
-        TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;
-       break;
-      case FT_SIGNED_CHAR:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         0, "signed char", objfile);
-       break;
-      case FT_UNSIGNED_CHAR:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
-       break;
-      case FT_SHORT:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
-                         0, "short", objfile);
-       break;
-      case FT_SIGNED_SHORT:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
-                         0, "short", objfile); /* FIXME-fnf */
-       break;
-      case FT_UNSIGNED_SHORT:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
-       break;
-      case FT_INTEGER:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         0, "int", objfile);
-       break;
-      case FT_SIGNED_INTEGER:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         0, "int", objfile); /* FIXME -fnf */
-       break;
-      case FT_UNSIGNED_INTEGER:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
-       break;
-      case FT_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
-                         0, "long", objfile);
-       break;
-      case FT_SIGNED_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
-                         0, "long", objfile); /* FIXME -fnf */
-       break;
-      case FT_UNSIGNED_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
-       break;
-      case FT_LONG_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
-                         0, "long long", objfile);
-       break;
-      case FT_SIGNED_LONG_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
-                         0, "signed long long", objfile);
-       break;
-      case FT_UNSIGNED_LONG_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
-       break;
-      case FT_FLOAT:
-       type = init_type (TYPE_CODE_FLT,
-                         TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
-                         0, "float", objfile);
-       break;
-      case FT_DBL_PREC_FLOAT:
-       type = init_type (TYPE_CODE_FLT,
-                         TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
-                         0, "double", objfile);
-       break;
-      case FT_EXT_PREC_FLOAT:
-       type = init_type (TYPE_CODE_FLT,
-                         TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
-                         0, "long double", objfile);
-        break;
-      case FT_TEMPLATE_ARG:
-        type = init_type (TYPE_CODE_TEMPLATE_ARG,
-                         0,
-                         0, "<template arg>", objfile);
-
-       break;
-      }
+    default:
+      /* FIXME:  For now, if we are asked to produce a type not in this
+         language, create the equivalent of a C integer type with the
+         name "<?type?>".  When all the dust settles from the type
+         reconstruction work, this should probably become an error. */
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       0, "<?type?>", objfile);
+      warning ("internal error: no C/C++ fundamental type %d", typeid);
+      break;
+    case FT_VOID:
+      type = init_type (TYPE_CODE_VOID,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       0, "void", objfile);
+      break;
+    case FT_BOOLEAN:
+      type = init_type (TYPE_CODE_BOOL,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       0, "bool", objfile);
+
+      break;
+    case FT_CHAR:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       0, "char", objfile);
+      TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN;
+      break;
+    case FT_SIGNED_CHAR:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       0, "signed char", objfile);
+      break;
+    case FT_UNSIGNED_CHAR:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
+      break;
+    case FT_SHORT:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                       0, "short", objfile);
+      break;
+    case FT_SIGNED_SHORT:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                       0, "short", objfile);   /* FIXME-fnf */
+      break;
+    case FT_UNSIGNED_SHORT:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
+      break;
+    case FT_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       0, "int", objfile);
+      break;
+    case FT_SIGNED_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       0, "int", objfile);     /* FIXME -fnf */
+      break;
+    case FT_UNSIGNED_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
+      break;
+    case FT_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                       0, "long", objfile);
+      break;
+    case FT_SIGNED_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                       0, "long", objfile);    /* FIXME -fnf */
+      break;
+    case FT_UNSIGNED_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
+      break;
+    case FT_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                       0, "long long", objfile);
+      break;
+    case FT_SIGNED_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                       0, "signed long long", objfile);
+      break;
+    case FT_UNSIGNED_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
+      break;
+    case FT_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+                       TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+                       0, "float", objfile);
+      break;
+    case FT_DBL_PREC_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+                       TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+                       0, "double", objfile);
+      break;
+    case FT_EXT_PREC_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+                       TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+                       0, "long double", objfile);
+      break;
+    case FT_TEMPLATE_ARG:
+      type = init_type (TYPE_CODE_TEMPLATE_ARG,
+                       0,
+                       0, "<template arg>", objfile);
+
+      break;
+    }
   return (type);
 }
-
 \f
+
 /* Table mapping opcodes into strings for printing operators
    and precedences of the operators.  */
 
 const struct op_print c_op_print_tab[] =
-  {
-    {",",  BINOP_COMMA, PREC_COMMA, 0},
-    {"=",  BINOP_ASSIGN, PREC_ASSIGN, 1},
-    {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
-    {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
-    {"|",  BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
-    {"^",  BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
-    {"&",  BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
-    {"==", BINOP_EQUAL, PREC_EQUAL, 0},
-    {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
-    {"<=", BINOP_LEQ, PREC_ORDER, 0},
-    {">=", BINOP_GEQ, PREC_ORDER, 0},
-    {">",  BINOP_GTR, PREC_ORDER, 0},
-    {"<",  BINOP_LESS, PREC_ORDER, 0},
-    {">>", BINOP_RSH, PREC_SHIFT, 0},
-    {"<<", BINOP_LSH, PREC_SHIFT, 0},
-    {"+",  BINOP_ADD, PREC_ADD, 0},
-    {"-",  BINOP_SUB, PREC_ADD, 0},
-    {"*",  BINOP_MUL, PREC_MUL, 0},
-    {"/",  BINOP_DIV, PREC_MUL, 0},
-    {"%",  BINOP_REM, PREC_MUL, 0},
-    {"@",  BINOP_REPEAT, PREC_REPEAT, 0},
-    {"-",  UNOP_NEG, PREC_PREFIX, 0},
-    {"!",  UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
-    {"~",  UNOP_COMPLEMENT, PREC_PREFIX, 0},
-    {"*",  UNOP_IND, PREC_PREFIX, 0},
-    {"&",  UNOP_ADDR, PREC_PREFIX, 0},
-    {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
-    {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
-    {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
-    /* C++  */
-    {"::", BINOP_SCOPE, PREC_PREFIX, 0},
-    {NULL, 0, 0, 0}
+{
+  {",", BINOP_COMMA, PREC_COMMA, 0},
+  {"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
+  {"||", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
+  {"&&", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
+  {"|", BINOP_BITWISE_IOR, PREC_BITWISE_IOR, 0},
+  {"^", BINOP_BITWISE_XOR, PREC_BITWISE_XOR, 0},
+  {"&", BINOP_BITWISE_AND, PREC_BITWISE_AND, 0},
+  {"==", BINOP_EQUAL, PREC_EQUAL, 0},
+  {"!=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
+  {"<=", BINOP_LEQ, PREC_ORDER, 0},
+  {">=", BINOP_GEQ, PREC_ORDER, 0},
+  {">", BINOP_GTR, PREC_ORDER, 0},
+  {"<", BINOP_LESS, PREC_ORDER, 0},
+  {">>", BINOP_RSH, PREC_SHIFT, 0},
+  {"<<", BINOP_LSH, PREC_SHIFT, 0},
+  {"+", BINOP_ADD, PREC_ADD, 0},
+  {"-", BINOP_SUB, PREC_ADD, 0},
+  {"*", BINOP_MUL, PREC_MUL, 0},
+  {"/", BINOP_DIV, PREC_MUL, 0},
+  {"%", BINOP_REM, PREC_MUL, 0},
+  {"@", BINOP_REPEAT, PREC_REPEAT, 0},
+  {"-", UNOP_NEG, PREC_PREFIX, 0},
+  {"!", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
+  {"~", UNOP_COMPLEMENT, PREC_PREFIX, 0},
+  {"*", UNOP_IND, PREC_PREFIX, 0},
+  {"&", UNOP_ADDR, PREC_PREFIX, 0},
+  {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
+  {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
+  {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
+  {NULL, 0, 0, 0}
 };
 \f
-struct type ** CONST_PTR (c_builtin_types[]) = 
+struct type **CONST_PTR (c_builtin_types[]) =
 {
   &builtin_type_int,
-  &builtin_type_long,
-  &builtin_type_short,
-  &builtin_type_char,
-  &builtin_type_float,
-  &builtin_type_double,
-  &builtin_type_void,
-  &builtin_type_long_long,
-  &builtin_type_signed_char,
-  &builtin_type_unsigned_char,
-  &builtin_type_unsigned_short,
-  &builtin_type_unsigned_int,
-  &builtin_type_unsigned_long,
-  &builtin_type_unsigned_long_long,
-  &builtin_type_long_double,
-  &builtin_type_complex,
-  &builtin_type_double_complex,
-  0
+    &builtin_type_long,
+    &builtin_type_short,
+    &builtin_type_char,
+    &builtin_type_float,
+    &builtin_type_double,
+    &builtin_type_void,
+    &builtin_type_long_long,
+    &builtin_type_signed_char,
+    &builtin_type_unsigned_char,
+    &builtin_type_unsigned_short,
+    &builtin_type_unsigned_int,
+    &builtin_type_unsigned_long,
+    &builtin_type_unsigned_long_long,
+    &builtin_type_long_double,
+    &builtin_type_complex,
+    &builtin_type_double_complex,
+    0
 };
 
-const struct language_defn c_language_defn = {
+const struct language_defn c_language_defn =
+{
   "c",                         /* Language name */
   language_c,
   c_builtin_types,
@@ -430,42 +430,43 @@ const struct language_defn c_language_defn = {
   c_print_type,                        /* Print a type using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
   c_value_print,               /* Print a top-level value */
-  {"",     "",    "",  ""},    /* Binary format info */
-  {"0%lo",  "0",   "o", ""},   /* Octal format info */
-  {"%ld",   "",    "d", ""},   /* Decimal format info */
-  {"0x%lx", "0x",  "x", ""},   /* Hex format info */
+  {"", "", "", ""},            /* Binary format info */
+  {"0%lo", "0", "o", ""},      /* Octal format info */
+  {"%ld", "", "d", ""},                /* Decimal format info */
+  {"0x%lx", "0x", "x", ""},    /* Hex format info */
   c_op_print_tab,              /* expression operators for printing */
   1,                           /* c-style arrays */
   0,                           /* String lower bound */
-  &builtin_type_char,          /* Type of string elements */ 
+  &builtin_type_char,          /* Type of string elements */
   LANG_MAGIC
 };
 
-struct type ** const (cplus_builtin_types[]) = 
+struct type **const (cplus_builtin_types[]) =
 {
   &builtin_type_int,
-  &builtin_type_long,
-  &builtin_type_short,
-  &builtin_type_char,
-  &builtin_type_float,
-  &builtin_type_double,
-  &builtin_type_void,
-  &builtin_type_long_long,
-  &builtin_type_signed_char,
-  &builtin_type_unsigned_char,
-  &builtin_type_unsigned_short,
-  &builtin_type_unsigned_int,
-  &builtin_type_unsigned_long,
-  &builtin_type_unsigned_long_long,
-  &builtin_type_long_double,
-  &builtin_type_complex,
-  &builtin_type_double_complex,
-  &builtin_type_bool,
-  0
+    &builtin_type_long,
+    &builtin_type_short,
+    &builtin_type_char,
+    &builtin_type_float,
+    &builtin_type_double,
+    &builtin_type_void,
+    &builtin_type_long_long,
+    &builtin_type_signed_char,
+    &builtin_type_unsigned_char,
+    &builtin_type_unsigned_short,
+    &builtin_type_unsigned_int,
+    &builtin_type_unsigned_long,
+    &builtin_type_unsigned_long_long,
+    &builtin_type_long_double,
+    &builtin_type_complex,
+    &builtin_type_double_complex,
+    &builtin_type_bool,
+    0
 };
 
-const struct language_defn cplus_language_defn = {
-  "c++",                               /* Language name */
+const struct language_defn cplus_language_defn =
+{
+  "c++",                       /* Language name */
   language_cplus,
   cplus_builtin_types,
   range_check_off,
@@ -480,18 +481,19 @@ const struct language_defn cplus_language_defn = {
   c_print_type,                        /* Print a type using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
   c_value_print,               /* Print a top-level value */
-  {"",      "",    "",   ""},  /* Binary format info */
-  {"0%lo",   "0",   "o",  ""}, /* Octal format info */
-  {"%ld",    "",    "d",  ""}, /* Decimal format info */
-  {"0x%lx",  "0x",  "x",  ""}, /* Hex format info */
+  {"", "", "", ""},            /* Binary format info */
+  {"0%lo", "0", "o", ""},      /* Octal format info */
+  {"%ld", "", "d", ""},                /* Decimal format info */
+  {"0x%lx", "0x", "x", ""},    /* Hex format info */
   c_op_print_tab,              /* expression operators for printing */
   1,                           /* c-style arrays */
   0,                           /* String lower bound */
-  &builtin_type_char,          /* Type of string elements */ 
+  &builtin_type_char,          /* Type of string elements */
   LANG_MAGIC
 };
 
-const struct language_defn asm_language_defn = {
+const struct language_defn asm_language_defn =
+{
   "asm",                       /* Language name */
   language_asm,
   c_builtin_types,
@@ -507,14 +509,14 @@ const struct language_defn asm_language_defn = {
   c_print_type,                        /* Print a type using appropriate syntax */
   c_val_print,                 /* Print a value using appropriate syntax */
   c_value_print,               /* Print a top-level value */
-  {"",     "",    "",  ""},    /* Binary format info */
-  {"0%lo",  "0",   "o", ""},   /* Octal format info */
-  {"%ld",   "",    "d", ""},   /* Decimal format info */
-  {"0x%lx", "0x",  "x", ""},   /* Hex format info */
+  {"", "", "", ""},            /* Binary format info */
+  {"0%lo", "0", "o", ""},      /* Octal format info */
+  {"%ld", "", "d", ""},                /* Decimal format info */
+  {"0x%lx", "0x", "x", ""},    /* Hex format info */
   c_op_print_tab,              /* expression operators for printing */
   1,                           /* c-style arrays */
   0,                           /* String lower bound */
-  &builtin_type_char,          /* Type of string elements */ 
+  &builtin_type_char,          /* Type of string elements */
   LANG_MAGIC
 };
 
index 7a9c6be..07289de 100644 (file)
@@ -1,22 +1,23 @@
 /* Support for printing C values for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997
-             Free Software Foundation, Inc.
+   Copyright 1986, 1988, 1989, 1991-1997, 2000
+   Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -27,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "valprint.h"
 #include "language.h"
 #include "c-lang.h"
-
 \f
+
 /* Print data of type TYPE located at VALADDR (within GDB), which came from
    the inferior at address ADDRESS, onto stdio stream STREAM according to
    FORMAT (a letter or 0 for natural format).  The data at VALADDR is in
@@ -49,13 +50,13 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
      char *valaddr;
      int embedded_offset;
      CORE_ADDR address;
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int format;
      int deref_ref;
      int recurse;
      enum val_prettyprint pretty;
 {
-  register unsigned int i = 0;         /* Number of characters printed */
+  register unsigned int i = 0; /* Number of characters printed */
   unsigned len;
   struct type *elttype;
   unsigned eltlen;
@@ -83,11 +84,11 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
              && (format == 0 || format == 's'))
            {
              /* If requested, look for the first null char and only print
-                elements up to it.  */
+                elements up to it.  */
              if (stop_print_at_null)
                {
-                 int temp_len;
-                 
+                 unsigned int temp_len;
+
                  /* Look for a NULL char. */
                  for (temp_len = 0;
                       (valaddr + embedded_offset)[temp_len]
@@ -95,7 +96,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
                       temp_len++);
                  len = temp_len;
                }
-             
+
              LA_PRINT_STRING (stream, valaddr + embedded_offset, len, eltlen, 0);
              i = len;
            }
@@ -103,7 +104,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
            {
              fprintf_filtered (stream, "{");
              /* If this is a virtual function table, print the 0th
-                entry specially, and the rest of the members normally.  */
+                entry specially, and the rest of the members normally.  */
              if (cp_is_vtbl_ptr_type (elttype))
                {
                  i = 1;
@@ -114,7 +115,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
                  i = 0;
                }
              val_print_array_elements (type, valaddr + embedded_offset, address, stream,
-                                       format, deref_ref, recurse, pretty, i);
+                                    format, deref_ref, recurse, pretty, i);
              fprintf_filtered (stream, "}");
            }
          break;
@@ -129,13 +130,13 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
          print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
          break;
        }
-      if (vtblprint && cp_is_vtbl_ptr_type(type))
+      if (vtblprint && cp_is_vtbl_ptr_type (type))
        {
-          /* Print the unmangled name if desired.  */
+         /* Print the unmangled name if desired.  */
          /* Print vtable entry - we only get here if we ARE using
             -fvtable_thunks.  (Otherwise, look under TYPE_CODE_STRUCT.) */
-         print_address_demangle(extract_address (valaddr + embedded_offset, TYPE_LENGTH (type)),
-                                stream, demangle);
+         print_address_demangle (extract_address (valaddr + embedded_offset, TYPE_LENGTH (type)),
+                                 stream, demangle);
          break;
        }
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
@@ -153,7 +154,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
        {
          addr = unpack_pointer (type, valaddr + embedded_offset);
        print_unpacked_pointer:
-          elttype = check_typedef (TYPE_TARGET_TYPE (type));
+         elttype = check_typedef (TYPE_TARGET_TYPE (type));
 
          if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
            {
@@ -179,13 +180,13 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
            {
              i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
            }
-         else if (cp_is_vtbl_member(type))
-           {
+         else if (cp_is_vtbl_member (type))
+           {
              /* print vtbl's nicely */
              CORE_ADDR vt_address = unpack_pointer (type, valaddr + embedded_offset);
 
              struct minimal_symbol *msymbol =
-               lookup_minimal_symbol_by_pc (vt_address);
+             lookup_minimal_symbol_by_pc (vt_address);
              if ((msymbol != NULL) &&
                  (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
                {
@@ -194,25 +195,25 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
                  fputs_filtered (">", stream);
                }
              if (vt_address && vtblprint)
-               {
+               {
                  value_ptr vt_val;
-                 struct symbol *wsym = (struct symbol *)NULL;
-                 struct type *wtype;
+                 struct symbol *wsym = (struct symbol *) NULL;
+                 struct type *wtype;
                  struct symtab *s;
-                 struct block *block = (struct block *)NULL;
+                 struct block *block = (struct block *) NULL;
                  int is_this_fld;
 
                  if (msymbol != NULL)
-                   wsym = lookup_symbol (SYMBOL_NAME(msymbol), block, 
-                               VAR_NAMESPACE, &is_this_fld, &s);
+                   wsym = lookup_symbol (SYMBOL_NAME (msymbol), block,
+                                         VAR_NAMESPACE, &is_this_fld, &s);
+
                  if (wsym)
                    {
-                     wtype = SYMBOL_TYPE(wsym);
+                     wtype = SYMBOL_TYPE (wsym);
                    }
                  else
                    {
-                     wtype = TYPE_TARGET_TYPE(type);
+                     wtype = TYPE_TARGET_TYPE (type);
                    }
                  vt_val = value_at (wtype, vt_address, NULL);
                  val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val), 0,
@@ -223,8 +224,8 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
                      fprintf_filtered (stream, "\n");
                      print_spaces_filtered (2 + 2 * recurse, stream);
                    }
-               }
-             }
+               }
+           }
 
          /* Return number of characters printed, including the terminating
             '\0' if we reached the end.  val_print_string takes care including
@@ -240,41 +241,41 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
     case TYPE_CODE_REF:
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
       if (TYPE_CODE (elttype) == TYPE_CODE_MEMBER)
-        {
+       {
          cp_print_class_member (valaddr + embedded_offset,
                                 TYPE_DOMAIN_TYPE (elttype),
                                 stream, "");
          break;
        }
       if (addressprint)
-        {
+       {
          fprintf_filtered (stream, "@");
          print_address_numeric
            (extract_address (valaddr + embedded_offset,
                              TARGET_PTR_BIT / HOST_CHAR_BIT), 1, stream);
          if (deref_ref)
            fputs_filtered (": ", stream);
-        }
+       }
       /* De-reference the reference.  */
       if (deref_ref)
        {
          if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
            {
              value_ptr deref_val =
-               value_at
-                 (TYPE_TARGET_TYPE (type),
-                  unpack_pointer (lookup_pointer_type (builtin_type_void),
-                                  valaddr + embedded_offset),
-                  NULL);
+             value_at
+             (TYPE_TARGET_TYPE (type),
+              unpack_pointer (lookup_pointer_type (builtin_type_void),
+                              valaddr + embedded_offset),
+              NULL);
              val_print (VALUE_TYPE (deref_val),
-                        VALUE_CONTENTS (deref_val), 
-                         0,
-                        VALUE_ADDRESS (deref_val), 
-                         stream, 
-                         format,
-                        deref_ref, 
-                         recurse, 
-                         pretty);
+                        VALUE_CONTENTS (deref_val),
+                        0,
+                        VALUE_ADDRESS (deref_val),
+                        stream,
+                        format,
+                        deref_ref,
+                        recurse,
+                        pretty);
            }
          else
            fputs_filtered ("???", stream);
@@ -289,16 +290,16 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
        }
       /* Fall through.  */
     case TYPE_CODE_STRUCT:
-      if (vtblprint && cp_is_vtbl_ptr_type(type))
+      if (vtblprint && cp_is_vtbl_ptr_type (type))
        {
-          /* Print the unmangled name if desired.  */
+         /* Print the unmangled name if desired.  */
          /* Print vtable entry - we only get here if NOT using
             -fvtable_thunks.  (Otherwise, look under TYPE_CODE_PTR.) */
-          print_address_demangle (extract_address (
-               valaddr + embedded_offset + 
-                TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
-               TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
-              stream, demangle);
+         print_address_demangle (extract_address (
+                                                valaddr + embedded_offset +
+                          TYPE_FIELD_BITPOS (type, VTBL_FNADDR_OFFSET) / 8,
+                 TYPE_LENGTH (TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET))),
+                                 stream, demangle);
        }
       else
        cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream, format,
@@ -338,7 +339,7 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
          break;
        }
       /* FIXME, we should consider, at least for ANSI C language, eliminating
-        the distinction made between FUNCs and POINTERs to FUNCs.  */
+         the distinction made between FUNCs and POINTERs to FUNCs.  */
       fprintf_filtered (stream, "{");
       type_print (type, "", stream, -1);
       fprintf_filtered (stream, "} ");
@@ -364,12 +365,12 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
 
     case TYPE_CODE_RANGE:
       /* FIXME: create_range_type does not set the unsigned bit in a
-        range type (I think it probably should copy it from the target
-        type), so we won't print values which are too large to
-        fit in a signed integer correctly.  */
+         range type (I think it probably should copy it from the target
+         type), so we won't print values which are too large to
+         fit in a signed integer correctly.  */
       /* FIXME: Doesn't handle ranges of enums correctly.  (Can't just
-        print with the target type, though, because the size of our type
-        and the target type might differ).  */
+         print with the target type, though, because the size of our type
+         and the target type might differ).  */
       /* FALLTHROUGH */
 
     case TYPE_CODE_INT:
@@ -402,10 +403,13 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
        }
       else
        {
-         fprintf_filtered (stream, TYPE_UNSIGNED (type) ? "%u" : "%d",
-                           unpack_long (type, valaddr + embedded_offset));
+         val = unpack_long (type, valaddr + embedded_offset);
+         if (TYPE_UNSIGNED (type))
+           fprintf_filtered (stream, "%u", (unsigned int) val);
+         else
+           fprintf_filtered (stream, "%d", (int) val);
          fputs_filtered (" ", stream);
-         LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset), stream);
+         LA_PRINT_CHAR ((unsigned char) val, stream);
        }
       break;
 
@@ -434,8 +438,8 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
 
     case TYPE_CODE_UNDEF:
       /* This happens (without TYPE_FLAG_STUB set) on systems which don't use
-        dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
-        and no complete type for struct foo in that file.  */
+         dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
+         and no complete type for struct foo in that file.  */
       fprintf_filtered (stream, "<incomplete type>");
       break;
 
@@ -449,14 +453,14 @@ c_val_print (type, valaddr, embedded_offset, address, stream, format, deref_ref,
 int
 c_value_print (val, stream, format, pretty)
      value_ptr val;
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int format;
      enum val_prettyprint pretty;
 {
   struct type *type = VALUE_TYPE (val);
-  struct type * real_type;
+  struct type *real_type;
   int full, top, using_enc;
+
   /* If it is a pointer, indicate what it points to.
 
      Print type also if it is a reference.
@@ -467,7 +471,7 @@ c_value_print (val, stream, format, pretty)
       TYPE_CODE (type) == TYPE_CODE_REF)
     {
       /* Hack:  remove (char *) for char strings.  Their
-        type is indicated by the quoted string anyway. */
+         type is indicated by the quoted string anyway. */
       if (TYPE_CODE (type) == TYPE_CODE_PTR &&
          TYPE_NAME (type) == NULL &&
          TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL &&
@@ -476,28 +480,32 @@ c_value_print (val, stream, format, pretty)
          /* Print nothing */
        }
       else if (objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
-        {
-          /* Pointer to class, check real type of object */
+       {
+         /* Pointer to class, check real type of object */
          fprintf_filtered (stream, "(");
-          type = value_rtti_target_type (val, &full, &top, &using_enc);
-          if (type) 
-            {
-              /* RTTI entry found */
-              type = lookup_pointer_type (type);
-              type_print (type, "", stream, -1);
-            }
-          else
-            {
-              /* No RTTI fields, do whatever we can */
-              type = VALUE_ENCLOSING_TYPE (val);
-              type_print (type, "", stream, -1);
-              fprintf_filtered (stream, " ?");
+          real_type = value_rtti_target_type (val, &full, &top, &using_enc);
+          if (real_type)
+           {
+             /* RTTI entry found */
+              if (TYPE_CODE (type) == TYPE_CODE_PTR)
+                {
+                  /* create a pointer type pointing to the real type */
+                  type = lookup_pointer_type (real_type);
+                }
+              else
+                {
+                  /* create a reference type referencing the real type */
+                  type = lookup_reference_type (real_type);
+                }
+              /* Note: When we look up RTTI entries, we don't get any 
+                 information on const or volatile attributes */
             }
+          type_print (type, "", stream, -1);
          fprintf_filtered (stream, ") ");
-        }
+       }
       else
        {
-          /* normal case */ 
+         /* normal case */
          fprintf_filtered (stream, "(");
          type_print (type, "", stream, -1);
          fprintf_filtered (stream, ") ");
@@ -507,29 +515,31 @@ c_value_print (val, stream, format, pretty)
     {
       /* Attempt to determine real type of object */
       real_type = value_rtti_type (val, &full, &top, &using_enc);
-      if (real_type) 
-        {
-          /* We have RTTI information, so use it */
-          val = value_full_object (val, real_type, full, top, using_enc);
-          fprintf_filtered (stream, "(%s%s) ",
-                            TYPE_NAME (real_type),
-                            full ? "" : " [incomplete object]");
-          /* Print out object: enclosing type is same as real_type if full */
-          return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
-                            VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
-        }
+      if (real_type)
+       {
+         /* We have RTTI information, so use it */
+         val = value_full_object (val, real_type, full, top, using_enc);
+         fprintf_filtered (stream, "(%s%s) ",
+                           TYPE_NAME (real_type),
+                           full ? "" : " [incomplete object]");
+         /* Print out object: enclosing type is same as real_type if full */
+         return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
+                        VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
+          /* Note: When we look up RTTI entries, we don't get any information on
+             const or volatile attributes */
+       }
       else if (type != VALUE_ENCLOSING_TYPE (val))
-        {
-          /* No RTTI information, so let's do our best */
-          fprintf_filtered (stream, "(%s ?) ",
-                            TYPE_NAME (VALUE_ENCLOSING_TYPE (val)));
-          return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
-                            VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
-        }
+       {
+         /* No RTTI information, so let's do our best */
+         fprintf_filtered (stream, "(%s ?) ",
+                           TYPE_NAME (VALUE_ENCLOSING_TYPE (val)));
+         return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
+                        VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
+       }
       /* Otherwise, we end up at the return outside this "if" */
     }
-  
-   return val_print (type, VALUE_CONTENTS_ALL (val), VALUE_EMBEDDED_OFFSET (val),
+
+  return val_print (type, VALUE_CONTENTS_ALL (val), VALUE_EMBEDDED_OFFSET (val),
                    VALUE_ADDRESS (val),
                    stream, format, 1, 0, pretty);
 }
index 45436a3..7892475 100644 (file)
@@ -1,21 +1,22 @@
 /* Parser for GNU CHILL (CCITT High-Level Language)  -*- C -*-
    Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* Parse a Chill expression from text in a string,
    and return the result as a  struct expression  pointer.
@@ -51,9 +52,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "value.h"
 #include "parser-defs.h"
 #include "ch-lang.h"
-#include "bfd.h" /* Required by objfiles.h.  */
-#include "symfile.h" /* Required by objfiles.h.  */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
+#include "bfd.h"               /* Required by objfiles.h.  */
+#include "symfile.h"           /* Required by objfiles.h.  */
+#include "objfiles.h"          /* For have_full_symbols and have_partial_symbols */
 
 #ifdef __GNUC__
 #define INLINE __inline__
@@ -64,75 +65,79 @@ typedef union
   {
     LONGEST lval;
     ULONGEST ulval;
-    struct {
-      LONGEST val;
-      struct type *type;
-    } typed_val;
+    struct
+      {
+       LONGEST val;
+       struct type *type;
+      }
+    typed_val;
     double dval;
     struct symbol *sym;
     struct type *tval;
     struct stoken sval;
     struct ttype tsym;
     struct symtoken ssym;
-  }YYSTYPE;
-
-enum ch_terminal {
-  END_TOKEN = 0,
-  /* '\001' ... '\xff' come first. */
-  OPEN_PAREN = '(',
-  TOKEN_NOT_READ = 999,
-  INTEGER_LITERAL,
-  BOOLEAN_LITERAL,
-  CHARACTER_LITERAL,
-  FLOAT_LITERAL,
-  GENERAL_PROCEDURE_NAME,
-  LOCATION_NAME,
-  EMPTINESS_LITERAL,
-  CHARACTER_STRING_LITERAL,
-  BIT_STRING_LITERAL,
-  TYPENAME,
-  DOT_FIELD_NAME, /* '.' followed by <field name> */
-  CASE,
-  OF,
-  ESAC,
-  LOGIOR,
-  ORIF,
-  LOGXOR,
-  LOGAND,
-  ANDIF,
-  NOTEQUAL,
-  GEQ,
-  LEQ,
-  IN,
-  SLASH_SLASH,
-  MOD,
-  REM,
-  NOT,
-  POINTER,
-  RECEIVE,
-  UP,
-  IF,
-  THEN,
-  ELSE,
-  FI,
-  ELSIF,
-  ILLEGAL_TOKEN,
-  NUM,
-  PRED,
-  SUCC,
-  ABS,
-  CARD,
-  MAX_TOKEN,
-  MIN_TOKEN,
-  ADDR_TOKEN,
-  SIZE,
-  UPPER,
-  LOWER,
-  LENGTH,
-  ARRAY,
-  GDB_VARIABLE,
-  GDB_ASSIGNMENT
-};
+  }
+YYSTYPE;
+
+enum ch_terminal
+  {
+    END_TOKEN = 0,
+    /* '\001' ... '\xff' come first. */
+    OPEN_PAREN = '(',
+    TOKEN_NOT_READ = 999,
+    INTEGER_LITERAL,
+    BOOLEAN_LITERAL,
+    CHARACTER_LITERAL,
+    FLOAT_LITERAL,
+    GENERAL_PROCEDURE_NAME,
+    LOCATION_NAME,
+    EMPTINESS_LITERAL,
+    CHARACTER_STRING_LITERAL,
+    BIT_STRING_LITERAL,
+    TYPENAME,
+    DOT_FIELD_NAME,            /* '.' followed by <field name> */
+    CASE,
+    OF,
+    ESAC,
+    LOGIOR,
+    ORIF,
+    LOGXOR,
+    LOGAND,
+    ANDIF,
+    NOTEQUAL,
+    GEQ,
+    LEQ,
+    IN,
+    SLASH_SLASH,
+    MOD,
+    REM,
+    NOT,
+    POINTER,
+    RECEIVE,
+    UP,
+    IF,
+    THEN,
+    ELSE,
+    FI,
+    ELSIF,
+    ILLEGAL_TOKEN,
+    NUM,
+    PRED,
+    SUCC,
+    ABS,
+    CARD,
+    MAX_TOKEN,
+    MIN_TOKEN,
+    ADDR_TOKEN,
+    SIZE,
+    UPPER,
+    LOWER,
+    LENGTH,
+    ARRAY,
+    GDB_VARIABLE,
+    GDB_ASSIGNMENT
+  };
 
 /* Forward declarations. */
 
@@ -177,7 +182,7 @@ static void parse_expr PARAMS ((void));
 static void parse_primval PARAMS ((void));
 static void parse_untyped_expr PARAMS ((void));
 static int parse_opt_untyped_expr PARAMS ((void));
-static void parse_if_expression_body PARAMS((void));
+static void parse_if_expression_body PARAMS ((void));
 static enum ch_terminal ch_lex PARAMS ((void));
 INLINE static enum ch_terminal PEEK_TOKEN PARAMS ((void));
 static enum ch_terminal peek_token_ PARAMS ((int));
@@ -186,15 +191,16 @@ static void require PARAMS ((enum ch_terminal));
 static int check_token PARAMS ((enum ch_terminal));
 
 #define MAX_LOOK_AHEAD 2
-static enum ch_terminal terminal_buffer[MAX_LOOK_AHEAD+1] = {
+static enum ch_terminal terminal_buffer[MAX_LOOK_AHEAD + 1] =
+{
   TOKEN_NOT_READ, TOKEN_NOT_READ, TOKEN_NOT_READ};
 static YYSTYPE yylval;
-static YYSTYPE val_buffer[MAX_LOOK_AHEAD+1];
+static YYSTYPE val_buffer[MAX_LOOK_AHEAD + 1];
 
-/*int current_token, lookahead_token;*/
+/*int current_token, lookahead_token; */
 
 INLINE static enum ch_terminal
-PEEK_TOKEN()
+PEEK_TOKEN ()
 {
   if (terminal_buffer[0] == TOKEN_NOT_READ)
     {
@@ -211,7 +217,7 @@ peek_token_ (i)
      int i;
 {
   if (i > MAX_LOOK_AHEAD)
-    fatal ("internal error - too much lookahead");
+    internal_error ("ch-exp.c - too much lookahead");
   if (terminal_buffer[i] == TOKEN_NOT_READ)
     {
       terminal_buffer[i] = ch_lex ();
@@ -229,12 +235,12 @@ pushback_token (code, node)
 {
   int i;
   if (terminal_buffer[MAX_LOOK_AHEAD] != TOKEN_NOT_READ)
-    fatal ("internal error - cannot pushback token");
+    internal_error ("ch-exp.c - cannot pushback token");
   for (i = MAX_LOOK_AHEAD; i > 0; i--)
-    { 
-      terminal_buffer[i] = terminal_buffer[i - 1]; 
+    {
+      terminal_buffer[i] = terminal_buffer[i - 1];
       val_buffer[i] = val_buffer[i - 1];
-  }
+    }
   terminal_buffer[0] = code;
   val_buffer[0] = node;
 }
@@ -242,13 +248,13 @@ pushback_token (code, node)
 #endif
 
 static void
-forward_token_()
+forward_token_ ()
 {
   int i;
   for (i = 0; i < MAX_LOOK_AHEAD; i++)
     {
-      terminal_buffer[i] = terminal_buffer[i+1];
-      val_buffer[i] = val_buffer[i+1];
+      terminal_buffer[i] = terminal_buffer[i + 1];
+      val_buffer[i] = val_buffer[i + 1];
     }
   terminal_buffer[MAX_LOOK_AHEAD] = TOKEN_NOT_READ;
 }
@@ -258,23 +264,21 @@ forward_token_()
    if it isn't TOKEN, the parser is broken. */
 
 static void
-require(token)
+require (token)
      enum ch_terminal token;
 {
-  if (PEEK_TOKEN() != token)
+  if (PEEK_TOKEN () != token)
     {
-      char buf[80];
-      sprintf (buf, "internal parser error - expected token %d", (int)token);
-      fatal(buf);
+      internal_error ("ch-exp.c - expected token %d", (int) token);
     }
-  FORWARD_TOKEN();
+  FORWARD_TOKEN ();
 }
 
 static int
 check_token (token)
      enum ch_terminal token;
 {
-  if (PEEK_TOKEN() != token)
+  if (PEEK_TOKEN () != token)
     return 0;
   FORWARD_TOKEN ();
   return 1;
@@ -282,13 +286,13 @@ check_token (token)
 
 /* return 0 if expected token was not found,
    else return 1.
-*/
+ */
 static int
 expect (token, message)
      enum ch_terminal token;
      char *message;
 {
-  if (PEEK_TOKEN() != token)
+  if (PEEK_TOKEN () != token)
     {
       if (message)
        error (message);
@@ -299,16 +303,16 @@ expect (token, message)
       return 0;
     }
   else
-    FORWARD_TOKEN();
+    FORWARD_TOKEN ();
   return 1;
 }
 
 #if 0
 static tree
 parse_opt_name_string (allow_all)
-     int allow_all; /* 1 if ALL is allowed as a postfix */
+     int allow_all;            /* 1 if ALL is allowed as a postfix */
 {
-  int token = PEEK_TOKEN();
+  int token = PEEK_TOKEN ();
   tree name;
   if (token != NAME)
     {
@@ -319,17 +323,17 @@ parse_opt_name_string (allow_all)
        }
       return NULL_TREE;
     }
-  name = PEEK_LVAL();
+  name = PEEK_LVAL ();
   for (;;)
     {
       FORWARD_TOKEN ();
-      token = PEEK_TOKEN();
+      token = PEEK_TOKEN ();
       if (token != '!')
        return name;
-      FORWARD_TOKEN();
-      token = PEEK_TOKEN();
+      FORWARD_TOKEN ();
+      token = PEEK_TOKEN ();
       if (token == ALL && allow_all)
-       return get_identifier3(IDENTIFIER_POINTER (name), "!", "*");
+       return get_identifier3 (IDENTIFIER_POINTER (name), "!", "*");
       if (token != NAME)
        {
          if (pass == 1)
@@ -337,15 +341,15 @@ parse_opt_name_string (allow_all)
                   IDENTIFIER_POINTER (name));
          return name;
        }
-      name = get_identifier3(IDENTIFIER_POINTER(name),
-                            "!", IDENTIFIER_POINTER(PEEK_LVAL()));
+      name = get_identifier3 (IDENTIFIER_POINTER (name),
+                             "!", IDENTIFIER_POINTER (PEEK_LVAL ()));
     }
 }
 
 static tree
 parse_simple_name_string ()
 {
-  int token = PEEK_TOKEN();
+  int token = PEEK_TOKEN ();
   tree name;
   if (token != NAME)
     {
@@ -394,7 +398,7 @@ parse_name ()
        return convert_from_reference (decl);
       else
        return decl;
-    } 
+    }
 }
 #endif
 
@@ -461,7 +465,7 @@ parse_mode_call ()
   expect ('(', NULL);
   if (PEEK_TOKEN () != TYPENAME)
     error ("expect MODENAME here `%s'", lexptr);
-  type = PEEK_LVAL().tsym.type;
+  type = PEEK_LVAL ().tsym.type;
   FORWARD_TOKEN ();
   expect (')', NULL);
   return type;
@@ -477,7 +481,7 @@ parse_mode_or_normal_call ()
   expect ('(', NULL);
   if (PEEK_TOKEN () == TYPENAME)
     {
-      type = PEEK_LVAL().tsym.type;
+      type = PEEK_LVAL ().tsym.type;
       FORWARD_TOKEN ();
     }
   else
@@ -675,7 +679,7 @@ parse_primval ()
   char *op_name;
   switch (PEEK_TOKEN ())
     {
-    case INTEGER_LITERAL: 
+    case INTEGER_LITERAL:
     case CHARACTER_LITERAL:
       write_exp_elt_opcode (OP_LONG);
       write_exp_elt_type (PEEK_LVAL ().typed_val.type);
@@ -718,12 +722,12 @@ parse_primval ()
     case ARRAY:
       FORWARD_TOKEN ();
       /* This is pseudo-Chill, similar to C's '(TYPE[])EXPR'
-        which casts to an artificial array. */
+         which casts to an artificial array. */
       expect ('(', NULL);
       expect (')', NULL);
       if (PEEK_TOKEN () != TYPENAME)
        error ("missing MODENAME after ARRAY()");
-      type = PEEK_LVAL().tsym.type;
+      type = PEEK_LVAL ().tsym.type;
       FORWARD_TOKEN ();
       expect ('(', NULL);
       parse_expr ();
@@ -731,7 +735,7 @@ parse_primval ()
       type = create_array_type ((struct type *) NULL, type,
                                create_range_type ((struct type *) NULL,
                                                   builtin_type_int, 0, 0));
-      TYPE_ARRAY_UPPER_BOUND_TYPE(type) = BOUND_CANNOT_BE_DETERMINED;
+      TYPE_ARRAY_UPPER_BOUND_TYPE (type) = BOUND_CANNOT_BE_DETERMINED;
       write_exp_elt_opcode (UNOP_CAST);
       write_exp_elt_type (type);
       write_exp_elt_opcode (UNOP_CAST);
@@ -739,7 +743,7 @@ parse_primval ()
 #if 0
     case CONST:
     case EXPR:
-      val = PEEK_LVAL();
+      val = PEEK_LVAL ();
       FORWARD_TOKEN ();
       break;
 #endif
@@ -759,7 +763,7 @@ parse_primval ()
       write_exp_elt_opcode (OP_VAR_VALUE);
       FORWARD_TOKEN ();
       break;
-    case GDB_VARIABLE: /* gdb specific */
+    case GDB_VARIABLE:         /* gdb specific */
       FORWARD_TOKEN ();
       break;
     case NUM:
@@ -780,9 +784,15 @@ parse_primval ()
       parse_unary_call ();
       write_exp_elt_opcode (UNOP_CHMIN);
       break;
-    case PRED:      op_name = "PRED"; goto unimplemented_unary_builtin;
-    case SUCC:      op_name = "SUCC"; goto unimplemented_unary_builtin;
-    case ABS:       op_name = "ABS";  goto unimplemented_unary_builtin;
+    case PRED:
+      op_name = "PRED";
+      goto unimplemented_unary_builtin;
+    case SUCC:
+      op_name = "SUCC";
+      goto unimplemented_unary_builtin;
+    case ABS:
+      op_name = "ABS";
+      goto unimplemented_unary_builtin;
     unimplemented_unary_builtin:
       parse_unary_call ();
       error ("not implemented:  %s builtin function", op_name);
@@ -794,7 +804,8 @@ parse_primval ()
     case SIZE:
       type = parse_mode_or_normal_call ();
       if (type)
-       { write_exp_elt_opcode (OP_LONG);
+       {
+         write_exp_elt_opcode (OP_LONG);
          write_exp_elt_type (builtin_type_int);
          CHECK_TYPEDEF (type);
          write_exp_elt_longcst ((LONGEST) TYPE_LENGTH (type));
@@ -820,7 +831,7 @@ parse_primval ()
     case TYPENAME:
       type = PEEK_LVAL ().tsym.type;
       FORWARD_TOKEN ();
-      switch (PEEK_TOKEN())
+      switch (PEEK_TOKEN ())
        {
        case '[':
          parse_tuple (type);
@@ -837,8 +848,8 @@ parse_primval ()
          error ("typename in invalid context");
        }
       break;
-      
-    default: 
+
+    default:
       error ("invalid expression syntax at `%s'", lexptr);
     }
   for (;;)
@@ -944,11 +955,11 @@ parse_operand6 ()
       write_exp_elt_opcode (UNOP_ADDR);
     }
   else
-    parse_primval();
+    parse_primval ();
 }
 
 static void
-parse_operand5()
+parse_operand5 ()
 {
   enum exp_opcode op;
   /* We are supposed to be looking for a <string repetition operator>,
@@ -960,16 +971,20 @@ parse_operand5()
      Is that a function call or string repetition?
      Instead, we handle string repetition in parse_primval,
      and build_generalized_call. */
-  switch (PEEK_TOKEN())
+  switch (PEEK_TOKEN ())
     {
-    case NOT:  op = UNOP_LOGICAL_NOT; break;
-    case '-':  op = UNOP_NEG; break;
+    case NOT:
+      op = UNOP_LOGICAL_NOT;
+      break;
+    case '-':
+      op = UNOP_NEG;
+      break;
     default:
       op = OP_NULL;
     }
   if (op != OP_NULL)
-    FORWARD_TOKEN();
-  parse_operand6();
+    FORWARD_TOKEN ();
+  parse_operand6 ();
   if (op != OP_NULL)
     write_exp_elt_opcode (op);
 }
@@ -978,20 +993,28 @@ static void
 parse_operand4 ()
 {
   enum exp_opcode op;
-  parse_operand5();
+  parse_operand5 ();
   for (;;)
     {
-      switch (PEEK_TOKEN())
+      switch (PEEK_TOKEN ())
        {
-       case '*':  op = BINOP_MUL; break;
-       case '/':  op = BINOP_DIV; break;
-       case MOD:  op = BINOP_MOD; break;
-       case REM:  op = BINOP_REM; break;
+       case '*':
+         op = BINOP_MUL;
+         break;
+       case '/':
+         op = BINOP_DIV;
+         break;
+       case MOD:
+         op = BINOP_MOD;
+         break;
+       case REM:
+         op = BINOP_REM;
+         break;
        default:
          return;
        }
-      FORWARD_TOKEN();
-      parse_operand5();
+      FORWARD_TOKEN ();
+      parse_operand5 ();
       write_exp_elt_opcode (op);
     }
 }
@@ -1003,16 +1026,22 @@ parse_operand3 ()
   parse_operand4 ();
   for (;;)
     {
-      switch (PEEK_TOKEN())
+      switch (PEEK_TOKEN ())
        {
-       case '+':    op = BINOP_ADD; break;
-       case '-':    op = BINOP_SUB; break;
-       case SLASH_SLASH: op = BINOP_CONCAT; break;
+       case '+':
+         op = BINOP_ADD;
+         break;
+       case '-':
+         op = BINOP_SUB;
+         break;
+       case SLASH_SLASH:
+         op = BINOP_CONCAT;
+         break;
        default:
          return;
        }
-      FORWARD_TOKEN();
-      parse_operand4();
+      FORWARD_TOKEN ();
+      parse_operand4 ();
       write_exp_elt_opcode (op);
     }
 }
@@ -1026,24 +1055,36 @@ parse_operand2 ()
     {
       if (check_token (IN))
        {
-         parse_operand3();
+         parse_operand3 ();
          write_exp_elt_opcode (BINOP_IN);
        }
       else
        {
-         switch (PEEK_TOKEN())
+         switch (PEEK_TOKEN ())
            {
-           case '>':      op = BINOP_GTR; break;
-           case GEQ:      op = BINOP_GEQ; break;
-           case '<':      op = BINOP_LESS; break;
-           case LEQ:      op = BINOP_LEQ; break;
-           case '=':      op = BINOP_EQUAL; break;
-           case NOTEQUAL: op = BINOP_NOTEQUAL; break;
+           case '>':
+             op = BINOP_GTR;
+             break;
+           case GEQ:
+             op = BINOP_GEQ;
+             break;
+           case '<':
+             op = BINOP_LESS;
+             break;
+           case LEQ:
+             op = BINOP_LEQ;
+             break;
+           case '=':
+             op = BINOP_EQUAL;
+             break;
+           case NOTEQUAL:
+             op = BINOP_NOTEQUAL;
+             break;
            default:
              return;
            }
-         FORWARD_TOKEN();
-         parse_operand3();
+         FORWARD_TOKEN ();
+         parse_operand3 ();
          write_exp_elt_opcode (op);
        }
     }
@@ -1056,36 +1097,46 @@ parse_operand1 ()
   parse_operand2 ();
   for (;;)
     {
-      switch (PEEK_TOKEN())
+      switch (PEEK_TOKEN ())
        {
-       case LOGAND: op = BINOP_BITWISE_AND; break;
-       case ANDIF:  op = BINOP_LOGICAL_AND; break;
+       case LOGAND:
+         op = BINOP_BITWISE_AND;
+         break;
+       case ANDIF:
+         op = BINOP_LOGICAL_AND;
+         break;
        default:
          return;
        }
-      FORWARD_TOKEN();
-      parse_operand2();
+      FORWARD_TOKEN ();
+      parse_operand2 ();
       write_exp_elt_opcode (op);
     }
 }
 
 static void
 parse_operand0 ()
-{ 
+{
   enum exp_opcode op;
-  parse_operand1();
+  parse_operand1 ();
   for (;;)
     {
-      switch (PEEK_TOKEN())
+      switch (PEEK_TOKEN ())
        {
-       case LOGIOR:  op = BINOP_BITWISE_IOR; break;
-       case LOGXOR:  op = BINOP_BITWISE_XOR; break;
-       case ORIF:    op = BINOP_LOGICAL_OR; break;
+       case LOGIOR:
+         op = BINOP_BITWISE_IOR;
+         break;
+       case LOGXOR:
+         op = BINOP_BITWISE_XOR;
+         break;
+       case ORIF:
+         op = BINOP_LOGICAL_OR;
+         break;
        default:
          return;
        }
-      FORWARD_TOKEN();
-      parse_operand1();
+      FORWARD_TOKEN ();
+      parse_operand1 ();
       write_exp_elt_opcode (op);
     }
 }
@@ -1147,7 +1198,7 @@ parse_if_expression ()
 static void
 parse_untyped_expr ()
 {
-  switch (PEEK_TOKEN())
+  switch (PEEK_TOKEN ())
     {
     case IF:
       parse_if_expression ();
@@ -1155,7 +1206,7 @@ parse_untyped_expr ()
     case CASE:
       error ("not implemented:  CASE expression");
     case '(':
-      switch (PEEK_TOKEN1())
+      switch (PEEK_TOKEN1 ())
        {
        case IF:
        case CASE:
@@ -1166,7 +1217,7 @@ parse_untyped_expr ()
          parse_untyped_expr ();
          expect (')', "missing ')'");
          return;
-       default: ;
+       default:;
          /* fall through */
        }
     default:
@@ -1180,9 +1231,9 @@ chill_parse ()
   terminal_buffer[0] = TOKEN_NOT_READ;
   if (PEEK_TOKEN () == TYPENAME && PEEK_TOKEN1 () == END_TOKEN)
     {
-      write_exp_elt_opcode(OP_TYPE);
-      write_exp_elt_type(PEEK_LVAL ().tsym.type);
-      write_exp_elt_opcode(OP_TYPE);
+      write_exp_elt_opcode (OP_TYPE);
+      write_exp_elt_type (PEEK_LVAL ().tsym.type);
+      write_exp_elt_opcode (OP_TYPE);
       FORWARD_TOKEN ();
     }
   else
@@ -1190,7 +1241,7 @@ chill_parse ()
   if (terminal_buffer[0] != END_TOKEN)
     {
       if (comma_terminates && terminal_buffer[0] == ',')
-       lexptr--;  /* Put the comma back.  */
+       lexptr--;               /* Put the comma back.  */
       else
        error ("Junk after end of expression.");
     }
@@ -1249,9 +1300,11 @@ match_simple_name_string ()
   if (isalpha (*tokptr) || *tokptr == '_')
     {
       char *result;
-      do {
-       tokptr++;
-      } while (isalnum (*tokptr) || (*tokptr == '_'));
+      do
+       {
+         tokptr++;
+       }
+      while (isalnum (*tokptr) || (*tokptr == '_'));
       yylval.sval.ptr = lexptr;
       yylval.sval.length = tokptr - lexptr;
       lexptr = tokptr;
@@ -1266,12 +1319,12 @@ match_simple_name_string ()
    and are simply ignored.  Since we must find at least one valid digit,
    or reject this token as an integer literal, we keep track of how many
    digits we have encountered. */
-  
+
 static int
 decode_integer_value (base, tokptrptr, ivalptr)
-  int base;
-  char **tokptrptr;
-  LONGEST *ivalptr;
+     int base;
+     char **tokptrptr;
+     LONGEST *ivalptr;
 {
   char *tokptr = *tokptrptr;
   int temp;
@@ -1281,17 +1334,30 @@ decode_integer_value (base, tokptrptr, ivalptr)
     {
       temp = *tokptr;
       if (isupper (temp))
-        temp = tolower (temp);
+       temp = tolower (temp);
       tokptr++;
       switch (temp)
        {
        case '_':
          continue;
-       case '0':  case '1':  case '2':  case '3':  case '4':
-       case '5':  case '6':  case '7':  case '8':  case '9':
+       case '0':
+       case '1':
+       case '2':
+       case '3':
+       case '4':
+       case '5':
+       case '6':
+       case '7':
+       case '8':
+       case '9':
          temp -= '0';
          break;
-       case 'a':  case 'b':  case 'c':  case 'd':  case 'e': case 'f':
+       case 'a':
+       case 'b':
+       case 'c':
+       case 'd':
+       case 'e':
+       case 'f':
          temp -= 'a';
          temp += 10;
          break;
@@ -1308,15 +1374,15 @@ decode_integer_value (base, tokptrptr, ivalptr)
       else
        {
          /* Found something not in domain for current base. */
-         tokptr--;     /* Unconsume what gave us indigestion. */
+         tokptr--;             /* Unconsume what gave us indigestion. */
          break;
        }
     }
-  
+
   /* If we didn't find any digits, then we don't have a valid integer
      value, so reject the entire token.  Otherwise, update the lexical
      scan pointer, and return non-zero for success. */
-  
+
   if (digits == 0)
     {
       return (0);
@@ -1330,16 +1396,16 @@ decode_integer_value (base, tokptrptr, ivalptr)
 
 static int
 decode_integer_literal (valptr, tokptrptr)
-  LONGEST *valptr;
-  char **tokptrptr;
+     LONGEST *valptr;
+     char **tokptrptr;
 {
   char *tokptr = *tokptrptr;
   int base = 0;
   LONGEST ival = 0;
   int explicit_base = 0;
-  
+
   /* Look for an explicit base specifier, which is optional. */
-  
+
   switch (*tokptr)
     {
     case 'd':
@@ -1370,15 +1436,15 @@ decode_integer_literal (valptr, tokptrptr)
       base = 10;
       break;
     }
-  
+
   /* If we found an explicit base ensure that the character after the
      explicit base is a single quote. */
-  
+
   if (explicit_base && (*tokptr++ != '\''))
     {
       return (0);
     }
-  
+
   /* Attempt to decode whatever follows as an integer value in the
      indicated base, updating the token pointer in the process and
      computing the value into ival.  Also, if we have an explicit
@@ -1404,15 +1470,15 @@ decode_integer_literal (valptr, tokptrptr)
 }
 
 /*  If it wasn't for the fact that floating point values can contain '_'
-    characters, we could just let strtod do all the hard work by letting it
-    try to consume as much of the current token buffer as possible and
-    find a legal conversion.  Unfortunately we need to filter out the '_'
-    characters before calling strtod, which we do by copying the other
-    legal chars to a local buffer to be converted.  However since we also
-    need to keep track of where the last unconsumed character in the input
-    buffer is, we have transfer only as many characters as may compose a
-    legal floating point value. */
-    
+   characters, we could just let strtod do all the hard work by letting it
+   try to consume as much of the current token buffer as possible and
+   find a legal conversion.  Unfortunately we need to filter out the '_'
+   characters before calling strtod, which we do by copying the other
+   legal chars to a local buffer to be converted.  However since we also
+   need to keep track of where the last unconsumed character in the input
+   buffer is, we have transfer only as many characters as may compose a
+   legal floating point value. */
+
 static enum ch_terminal
 match_float_literal ()
 {
@@ -1421,12 +1487,12 @@ match_float_literal ()
   char *copy;
   double dval;
   extern double strtod ();
-  
+
   /* Make local buffer in which to build the string to convert.  This is
      required because underscores are valid in chill floating point numbers
      but not in the string passed to strtod to convert.  The string will be
      no longer than our input string. */
-     
+
   copy = buf = (char *) alloca (strlen (tokptr) + 1);
 
   /* Transfer all leading digits to the conversion buffer, discarding any
@@ -1450,26 +1516,26 @@ match_float_literal ()
 
   switch (*tokptr++)
     {
-      case '.':
-        /* Accept and then look for fractional part and/or exponent. */
-       *copy++ = '.';
-       break;
+    case '.':
+      /* Accept and then look for fractional part and/or exponent. */
+      *copy++ = '.';
+      break;
 
-      case 'e':
-      case 'E':
-      case 'd':
-      case 'D':
-       if (copy == buf)
-         {
-           return (0);
-         }
-       *copy++ = 'e';
-       goto collect_exponent;
-       break;
+    case 'e':
+    case 'E':
+    case 'd':
+    case 'D':
+      if (copy == buf)
+       {
+         return (0);
+       }
+      *copy++ = 'e';
+      goto collect_exponent;
+      break;
 
-      default:
-       return (0);
-        break;
+    default:
+      return (0);
+      break;
     }
 
   /* We found a '.', copy any fractional digits to the conversion buffer, up
@@ -1490,21 +1556,21 @@ match_float_literal ()
 
   switch (*tokptr)
     {
-      case 'e':
-      case 'E':
-      case 'd':
-      case 'D':
-       *copy++ = 'e';
-       tokptr++;
-       break;
-      default:
-       goto convert_float;
-       break;
+    case 'e':
+    case 'E':
+    case 'd':
+    case 'D':
+      *copy++ = 'e';
+      tokptr++;
+      break;
+    default:
+      goto convert_float;
+      break;
     }
 
   /* Accept an optional '-' or '+' following one of [eEdD]. */
 
-  collect_exponent:
+collect_exponent:
   if (*tokptr == '+' || *tokptr == '-')
     {
       *copy++ = *tokptr++;
@@ -1522,18 +1588,18 @@ match_float_literal ()
      contents as a floating point value.  If any characters remain, then we
      must not have a valid floating point string. */
 
-  convert_float:
+convert_float:
   *copy = '\0';
   if (copy != buf)
-      {
-        dval = strtod (buf, &copy);
-        if (*copy == '\0')
-         {
-           yylval.dval = dval;
-           lexptr = tokptr;
-           return (FLOAT_LITERAL);
-         }
-      }
+    {
+      dval = strtod (buf, &copy);
+      if (*copy == '\0')
+       {
+         yylval.dval = dval;
+         lexptr = tokptr;
+         return (FLOAT_LITERAL);
+       }
+    }
   return (0);
 }
 
@@ -1553,7 +1619,7 @@ match_string_literal ()
   for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
     {
       CHECKBUF (1);
-    tryagain: ;
+    tryagain:;
       if (in_ctrlseq)
        {
          /* skip possible whitespaces */
@@ -1608,7 +1674,7 @@ match_string_literal ()
   if (in_ctrlseq)
     error ("Invalid control sequence");
 
-  if (*tokptr == '\0'                                  /* no terminator */
+  if (*tokptr == '\0'          /* no terminator */
       || (tempbufindex == 1 && *tokptr == '\''))       /* char literal */
     {
       return (0);
@@ -1637,19 +1703,19 @@ match_string_literal ()
    a string literal.
 
    Returns CHARACTER_LITERAL if a match is found.
  */
+ */
 
 static enum ch_terminal
 match_character_literal ()
 {
   char *tokptr = lexptr;
   LONGEST ival = 0;
-  
+
   if ((*tokptr == 'c' || *tokptr == 'C') && (*(tokptr + 1) == '\''))
     {
       /* We have a GNU chill extension form, so skip the leading "C'",
-        decode the hex value, and then ensure that we have a trailing
-        single quote character. */
+         decode the hex value, and then ensure that we have a trailing
+         single quote character. */
       tokptr += 2;
       if (!decode_integer_value (16, &tokptr, &ival) || (*tokptr != '\''))
        {
@@ -1662,15 +1728,15 @@ match_character_literal ()
       tokptr++;
 
       /* Determine which form we have, either a control sequence or the
-        single character form. */
-      
+         single character form. */
+
       if (*tokptr == '^')
        {
          if (*(tokptr + 1) == '(')
            {
              /* Match and decode a control sequence.  Return zero if we don't
-                find a valid integer literal, or if the next unconsumed character
-                after the integer literal is not the trailing ')'. */
+                find a valid integer literal, or if the next unconsumed character
+                after the integer literal is not the trailing ')'. */
              tokptr += 2;
              if (!decode_integer_literal (&ival, &tokptr) || (*tokptr++ != ')'))
                {
@@ -1698,8 +1764,8 @@ match_character_literal ()
        }
 
       /* The trailing quote has not yet been consumed.  If we don't find
-        it, then we have no match. */
-      
+         it, then we have no match. */
+
       if (*tokptr++ != '\'')
        {
          return (0);
@@ -1726,16 +1792,16 @@ match_integer_literal ()
 {
   char *tokptr = lexptr;
   LONGEST ival;
-  
+
   if (!decode_integer_literal (&ival, &tokptr))
     {
       return (0);
     }
-  else 
+  else
     {
       yylval.typed_val.val = ival;
 #if defined(CC_HAS_LONG_LONG) && defined(__STDC__)
-      if (ival > (LONGEST)2147483647U || ival < -(LONGEST)2147483648U)
+      if (ival > (LONGEST) 2147483647U || ival < -(LONGEST) 2147483648U)
        yylval.typed_val.type = builtin_type_long_long;
       else
 #endif
@@ -1758,13 +1824,13 @@ match_bitstring_literal ()
   int bitcount = 0;
   int bits_per_char;
   int digit;
-  
+
   tempbufindex = 0;
   CHECKBUF (1);
   tempbuf[0] = 0;
 
   /* Look for the required explicit base specifier. */
-  
+
   switch (*tokptr++)
     {
     case 'b':
@@ -1785,33 +1851,46 @@ match_bitstring_literal ()
     }
 
   /* Ensure that the character after the explicit base is a single quote. */
-  
+
   if (*tokptr++ != '\'')
     {
       return (0);
     }
-  
+
   while (*tokptr != '\0' && *tokptr != '\'')
     {
       digit = *tokptr;
       if (isupper (digit))
-        digit = tolower (digit);
+       digit = tolower (digit);
       tokptr++;
       switch (digit)
        {
-         case '_':
-           continue;
-         case '0':  case '1':  case '2':  case '3':  case '4':
-         case '5':  case '6':  case '7':  case '8':  case '9':
-           digit -= '0';
-           break;
-         case 'a':  case 'b':  case 'c':  case 'd':  case 'e': case 'f':
-           digit -= 'a';
-           digit += 10;
-           break;
-         default:
-           /* this is not a bitstring literal, probably an integer */
-           return 0;
+       case '_':
+         continue;
+       case '0':
+       case '1':
+       case '2':
+       case '3':
+       case '4':
+       case '5':
+       case '6':
+       case '7':
+       case '8':
+       case '9':
+         digit -= '0';
+         break;
+       case 'a':
+       case 'b':
+       case 'c':
+       case 'd':
+       case 'e':
+       case 'f':
+         digit -= 'a';
+         digit += 10;
+         break;
+       default:
+         /* this is not a bitstring literal, probably an integer */
+         return 0;
        }
       if (digit >= 1 << bits_per_char)
        {
@@ -1830,21 +1909,21 @@ match_bitstring_literal ()
                {
                  tempbuf[tempbufindex] |=
                    (TARGET_BYTE_ORDER == BIG_ENDIAN)
-                     ? (1 << (HOST_CHAR_BIT - 1 - bitoffset))
-                       : (1 << bitoffset);
+                   ? (1 << (HOST_CHAR_BIT - 1 - bitoffset))
+                   : (1 << bitoffset);
                }
              bitoffset++;
              if (bitoffset == HOST_CHAR_BIT)
                {
                  bitoffset = 0;
                  tempbufindex++;
-                 CHECKBUF(1);
+                 CHECKBUF (1);
                  tempbuf[tempbufindex] = 0;
                }
            }
        }
     }
-  
+
   /* Verify that we consumed everything up to the trailing single quote,
      and that we found some bits (IE not just underbars). */
 
@@ -1852,7 +1931,7 @@ match_bitstring_literal ()
     {
       return (0);
     }
-  else 
+  else
     {
       yylval.sval.ptr = tempbuf;
       yylval.sval.length = bitcount;
@@ -1869,40 +1948,40 @@ struct token
 
 static const struct token idtokentab[] =
 {
-    { "array", ARRAY },
-    { "length", LENGTH },
-    { "lower", LOWER },
-    { "upper", UPPER },
-    { "andif", ANDIF },
-    { "pred", PRED },
-    { "succ", SUCC },
-    { "card", CARD },
-    { "size", SIZE },
-    { "orif", ORIF },
-    { "num", NUM },
-    { "abs", ABS },
-    { "max", MAX_TOKEN },
-    { "min", MIN_TOKEN },
-    { "mod", MOD },
-    { "rem", REM },
-    { "not", NOT },
-    { "xor", LOGXOR },
-    { "and", LOGAND },
-    { "in", IN },
-    { "or", LOGIOR },
-    { "up", UP },
-    { "addr", ADDR_TOKEN },
-    { "null", EMPTINESS_LITERAL }
+  {"array", ARRAY},
+  {"length", LENGTH},
+  {"lower", LOWER},
+  {"upper", UPPER},
+  {"andif", ANDIF},
+  {"pred", PRED},
+  {"succ", SUCC},
+  {"card", CARD},
+  {"size", SIZE},
+  {"orif", ORIF},
+  {"num", NUM},
+  {"abs", ABS},
+  {"max", MAX_TOKEN},
+  {"min", MIN_TOKEN},
+  {"mod", MOD},
+  {"rem", REM},
+  {"not", NOT},
+  {"xor", LOGXOR},
+  {"and", LOGAND},
+  {"in", IN},
+  {"or", LOGIOR},
+  {"up", UP},
+  {"addr", ADDR_TOKEN},
+  {"null", EMPTINESS_LITERAL}
 };
 
 static const struct token tokentab2[] =
 {
-    { ":=", GDB_ASSIGNMENT },
-    { "//", SLASH_SLASH },
-    { "->", POINTER },
-    { "/=", NOTEQUAL },
-    { "<=", LEQ },
-    { ">=", GEQ }
+  {":=", GDB_ASSIGNMENT},
+  {"//", SLASH_SLASH},
+  {"->", POINTER},
+  {"/=", NOTEQUAL},
+  {"<=", LEQ},
+  {">=", GEQ}
 };
 
 /* Read one token, getting characters through lexptr.  */
@@ -1912,240 +1991,243 @@ static const struct token tokentab2[] =
 static enum ch_terminal
 ch_lex ()
 {
-    unsigned int i;
-    enum ch_terminal token;
-    char *inputname;
-    struct symbol *sym;
+  unsigned int i;
+  enum ch_terminal token;
+  char *inputname;
+  struct symbol *sym;
 
-    /* Skip over any leading whitespace. */
-    while (isspace (*lexptr))
+  /* Skip over any leading whitespace. */
+  while (isspace (*lexptr))
+    {
+      lexptr++;
+    }
+  /* Look for special single character cases which can't be the first
+     character of some other multicharacter token. */
+  switch (*lexptr)
+    {
+    case '\0':
+      return END_TOKEN;
+    case ',':
+    case '=':
+    case ';':
+    case '!':
+    case '+':
+    case '*':
+    case '(':
+    case ')':
+    case '[':
+    case ']':
+      return (*lexptr++);
+    }
+  /* Look for characters which start a particular kind of multicharacter
+     token, such as a character literal, register name, convenience
+     variable name, string literal, etc. */
+  switch (*lexptr)
+    {
+    case '\'':
+    case '\"':
+      /* First try to match a string literal, which is any
+         sequence of characters enclosed in matching single or double
+         quotes, except that a single character inside single quotes
+         is a character literal, so we have to catch that case also. */
+      token = match_string_literal ();
+      if (token != 0)
        {
-           lexptr++;
+         return (token);
        }
-    /* Look for special single character cases which can't be the first
-       character of some other multicharacter token. */
-    switch (*lexptr)
+      if (*lexptr == '\'')
        {
-           case '\0':
-               return END_TOKEN;
-           case ',':
-           case '=':
-           case ';':
-           case '!':
-           case '+':
-           case '*':
-           case '(':
-           case ')':
-           case '[':
-           case ']':
-               return (*lexptr++);
-       }
-    /* Look for characters which start a particular kind of multicharacter
-       token, such as a character literal, register name, convenience
-       variable name, string literal, etc. */
-    switch (*lexptr)
-      {
-       case '\'':
-       case '\"':
-         /* First try to match a string literal, which is any
-            sequence of characters enclosed in matching single or double
-            quotes, except that a single character inside single quotes
-            is a character literal, so we have to catch that case also. */
-         token = match_string_literal ();
-         if (token != 0)
-           {
-             return (token);
-           }
-         if (*lexptr == '\'')
-           {
-             token = match_character_literal ();
-             if (token != 0)
-               {
-                 return (token);
-               }
-           }
-         break;
-        case 'C':
-        case 'c':
          token = match_character_literal ();
          if (token != 0)
            {
              return (token);
            }
-         break;
-       case '$':
-         yylval.sval.ptr = lexptr;
-         do {
-           lexptr++;
-         } while (isalnum (*lexptr) || *lexptr == '_' || *lexptr == '$');
-         yylval.sval.length = lexptr - yylval.sval.ptr;
-         write_dollar_variable (yylval.sval);
-         return GDB_VARIABLE;
-         break;
-      }
-    /* See if it is a special token of length 2.  */
-    for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
-       {
-           if (STREQN (lexptr, tokentab2[i].operator, 2))
-               {
-                   lexptr += 2;
-                   return (tokentab2[i].token);
-               }
-       }
-    /* Look for single character cases which which could be the first
-       character of some other multicharacter token, but aren't, or we
-       would already have found it. */
-    switch (*lexptr)
-       {
-           case '-':
-           case ':':
-           case '/':
-           case '<':
-           case '>':
-               return (*lexptr++);
        }
-    /* Look for a float literal before looking for an integer literal, so
-       we match as much of the input stream as possible. */
-    token = match_float_literal ();
-    if (token != 0)
+      break;
+    case 'C':
+    case 'c':
+      token = match_character_literal ();
+      if (token != 0)
        {
-           return (token);
+         return (token);
        }
-    token = match_bitstring_literal ();
-    if (token != 0)
+      break;
+    case '$':
+      yylval.sval.ptr = lexptr;
+      do
        {
-           return (token);
+         lexptr++;
        }
-    token = match_integer_literal ();
-    if (token != 0)
+      while (isalnum (*lexptr) || *lexptr == '_' || *lexptr == '$');
+      yylval.sval.length = lexptr - yylval.sval.ptr;
+      write_dollar_variable (yylval.sval);
+      return GDB_VARIABLE;
+      break;
+    }
+  /* See if it is a special token of length 2.  */
+  for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
+    {
+      if (STREQN (lexptr, tokentab2[i].operator, 2))
        {
-           return (token);
+         lexptr += 2;
+         return (tokentab2[i].token);
        }
+    }
+  /* Look for single character cases which which could be the first
+     character of some other multicharacter token, but aren't, or we
+     would already have found it. */
+  switch (*lexptr)
+    {
+    case '-':
+    case ':':
+    case '/':
+    case '<':
+    case '>':
+      return (*lexptr++);
+    }
+  /* Look for a float literal before looking for an integer literal, so
+     we match as much of the input stream as possible. */
+  token = match_float_literal ();
+  if (token != 0)
+    {
+      return (token);
+    }
+  token = match_bitstring_literal ();
+  if (token != 0)
+    {
+      return (token);
+    }
+  token = match_integer_literal ();
+  if (token != 0)
+    {
+      return (token);
+    }
 
-    /* Try to match a simple name string, and if a match is found, then
-       further classify what sort of name it is and return an appropriate
-       token.  Note that attempting to match a simple name string consumes
-       the token from lexptr, so we can't back out if we later find that
-       we can't classify what sort of name it is. */
+  /* Try to match a simple name string, and if a match is found, then
+     further classify what sort of name it is and return an appropriate
+     token.  Note that attempting to match a simple name string consumes
+     the token from lexptr, so we can't back out if we later find that
+     we can't classify what sort of name it is. */
 
-    inputname = match_simple_name_string ();
+  inputname = match_simple_name_string ();
 
-    if (inputname != NULL)
-      {
-       char *simplename = (char*) alloca (strlen (inputname) + 1);
+  if (inputname != NULL)
+    {
+      char *simplename = (char *) alloca (strlen (inputname) + 1);
 
-       char *dptr = simplename, *sptr = inputname;
-       for (; *sptr; sptr++)
-         *dptr++ = isupper (*sptr) ? tolower(*sptr) : *sptr;
-       *dptr = '\0';
+      char *dptr = simplename, *sptr = inputname;
+      for (; *sptr; sptr++)
+       *dptr++ = isupper (*sptr) ? tolower (*sptr) : *sptr;
+      *dptr = '\0';
 
-       /* See if it is a reserved identifier. */
-       for (i = 0; i < sizeof (idtokentab) / sizeof (idtokentab[0]); i++)
+      /* See if it is a reserved identifier. */
+      for (i = 0; i < sizeof (idtokentab) / sizeof (idtokentab[0]); i++)
+       {
+         if (STREQ (simplename, idtokentab[i].operator))
            {
-               if (STREQ (simplename, idtokentab[i].operator))
-                   {
-                       return (idtokentab[i].token);
-                   }
+             return (idtokentab[i].token);
            }
+       }
 
-       /* Look for other special tokens. */
-       if (STREQ (simplename, "true"))
-           {
-               yylval.ulval = 1;
-               return (BOOLEAN_LITERAL);
-           }
-       if (STREQ (simplename, "false"))
+      /* Look for other special tokens. */
+      if (STREQ (simplename, "true"))
+       {
+         yylval.ulval = 1;
+         return (BOOLEAN_LITERAL);
+       }
+      if (STREQ (simplename, "false"))
+       {
+         yylval.ulval = 0;
+         return (BOOLEAN_LITERAL);
+       }
+
+      sym = lookup_symbol (inputname, expression_context_block,
+                          VAR_NAMESPACE, (int *) NULL,
+                          (struct symtab **) NULL);
+      if (sym == NULL && strcmp (inputname, simplename) != 0)
+       {
+         sym = lookup_symbol (simplename, expression_context_block,
+                              VAR_NAMESPACE, (int *) NULL,
+                              (struct symtab **) NULL);
+       }
+      if (sym != NULL)
+       {
+         yylval.ssym.stoken.ptr = NULL;
+         yylval.ssym.stoken.length = 0;
+         yylval.ssym.sym = sym;
+         yylval.ssym.is_a_field_of_this = 0;   /* FIXME, C++'ism */
+         switch (SYMBOL_CLASS (sym))
            {
-               yylval.ulval = 0;
-               return (BOOLEAN_LITERAL);
+           case LOC_BLOCK:
+             /* Found a procedure name. */
+             return (GENERAL_PROCEDURE_NAME);
+           case LOC_STATIC:
+             /* Found a global or local static variable. */
+             return (LOCATION_NAME);
+           case LOC_REGISTER:
+           case LOC_ARG:
+           case LOC_REF_ARG:
+           case LOC_REGPARM:
+           case LOC_REGPARM_ADDR:
+           case LOC_LOCAL:
+           case LOC_LOCAL_ARG:
+           case LOC_BASEREG:
+           case LOC_BASEREG_ARG:
+             if (innermost_block == NULL
+                 || contained_in (block_found, innermost_block))
+               {
+                 innermost_block = block_found;
+               }
+             return (LOCATION_NAME);
+             break;
+           case LOC_CONST:
+           case LOC_LABEL:
+             return (LOCATION_NAME);
+             break;
+           case LOC_TYPEDEF:
+             yylval.tsym.type = SYMBOL_TYPE (sym);
+             return TYPENAME;
+           case LOC_UNDEF:
+           case LOC_CONST_BYTES:
+           case LOC_OPTIMIZED_OUT:
+             error ("Symbol \"%s\" names no location.", inputname);
+             break;
+           default:
+             internal_error ("unhandled SYMBOL_CLASS in ch_lex()");
+             break;
            }
+       }
+      else if (!have_full_symbols () && !have_partial_symbols ())
+       {
+         error ("No symbol table is loaded.  Use the \"file\" command.");
+       }
+      else
+       {
+         error ("No symbol \"%s\" in current context.", inputname);
+       }
+    }
 
-       sym = lookup_symbol (inputname, expression_context_block,
-                            VAR_NAMESPACE, (int *) NULL,
-                            (struct symtab **) NULL);
-       if (sym == NULL && strcmp (inputname, simplename) != 0)
-         {
-           sym = lookup_symbol (simplename, expression_context_block,
-                                VAR_NAMESPACE, (int *) NULL,
-                                (struct symtab **) NULL);
-         }
-       if (sym != NULL)
-         {
-           yylval.ssym.stoken.ptr = NULL;
-           yylval.ssym.stoken.length = 0;
-           yylval.ssym.sym = sym;
-           yylval.ssym.is_a_field_of_this = 0; /* FIXME, C++'ism */
-           switch (SYMBOL_CLASS (sym))
-             {
-             case LOC_BLOCK:
-               /* Found a procedure name. */
-               return (GENERAL_PROCEDURE_NAME);
-             case LOC_STATIC:
-               /* Found a global or local static variable. */
-               return (LOCATION_NAME);
-             case LOC_REGISTER:
-             case LOC_ARG:
-             case LOC_REF_ARG:
-             case LOC_REGPARM:
-             case LOC_REGPARM_ADDR:
-             case LOC_LOCAL:
-             case LOC_LOCAL_ARG:
-             case LOC_BASEREG:
-             case LOC_BASEREG_ARG:
-               if (innermost_block == NULL
-                   || contained_in (block_found, innermost_block))
-                 {
-                   innermost_block = block_found;
-                 }
-               return (LOCATION_NAME);
-               break;
-             case LOC_CONST:
-             case LOC_LABEL:
-               return (LOCATION_NAME);
-               break;
-             case LOC_TYPEDEF:
-               yylval.tsym.type = SYMBOL_TYPE (sym);
-               return TYPENAME;
-             case LOC_UNDEF:
-             case LOC_CONST_BYTES:
-             case LOC_OPTIMIZED_OUT:
-               error ("Symbol \"%s\" names no location.", inputname);
-               break;
-             case LOC_UNRESOLVED:
-               error ("unhandled SYMBOL_CLASS in ch_lex()");
-               break;
-             }
-         }
-       else if (!have_full_symbols () && !have_partial_symbols ())
-         {
-           error ("No symbol table is loaded.  Use the \"file\" command.");
-         }
-       else
-         {
-           error ("No symbol \"%s\" in current context.", inputname);
-         }
-      }
-
-    /* Catch single character tokens which are not part of some
-       longer token. */
+  /* Catch single character tokens which are not part of some
+     longer token. */
 
-    switch (*lexptr)
-      {
-       case '.':                       /* Not float for example. */
-         lexptr++;
-         while (isspace (*lexptr)) lexptr++;
-         inputname = match_simple_name_string ();
-         if (!inputname)
-           return '.';
-         return DOT_FIELD_NAME;
-      }
+  switch (*lexptr)
+    {
+    case '.':                  /* Not float for example. */
+      lexptr++;
+      while (isspace (*lexptr))
+       lexptr++;
+      inputname = match_simple_name_string ();
+      if (!inputname)
+       return '.';
+      return DOT_FIELD_NAME;
+    }
 
-    return (ILLEGAL_TOKEN);
+  return (ILLEGAL_TOKEN);
 }
 
 static void
 write_lower_upper_value (opcode, type)
-     enum exp_opcode opcode;  /* Either UNOP_LOWER or UNOP_UPPER */
+     enum exp_opcode opcode;   /* Either UNOP_LOWER or UNOP_UPPER */
      struct type *type;
 {
   if (type == NULL)
index c54e8bb..cf63257 100644 (file)
@@ -1,21 +1,22 @@
 /* Chill language support routines for GDB, the GNU debugger.
-   Copyright 1992, 1995, 1996 Free Software Foundation, Inc.
+   Copyright 1992, 1995, 1996, 2000 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -25,27 +26,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "parser-defs.h"
 #include "language.h"
 #include "ch-lang.h"
+#include "valprint.h"
+
+extern void _initialize_chill_language PARAMS ((void));
 
 static value_ptr
-evaluate_subexp_chill PARAMS ((struct type *, struct expression *, int *, enum noside));
+  evaluate_subexp_chill PARAMS ((struct type *, struct expression *, int *, enum noside));
 
 static value_ptr
-value_chill_max_min PARAMS ((enum exp_opcode, value_ptr));
+  value_chill_max_min PARAMS ((enum exp_opcode, value_ptr));
 
 static value_ptr
-value_chill_card PARAMS ((value_ptr));
+  value_chill_card PARAMS ((value_ptr));
 
 static value_ptr
- value_chill_length PARAMS ((value_ptr));
 value_chill_length PARAMS ((value_ptr));
 
 static struct type *
-chill_create_fundamental_type PARAMS ((struct objfile *, int));
+  chill_create_fundamental_type PARAMS ((struct objfile *, int));
 
-static void
-chill_printstr PARAMS ((GDB_FILE *stream, char *string, unsigned int length, int width, int force_ellipses));
+static void chill_printstr (struct ui_file * stream, char *string,
+                           unsigned int length, int width,
+                           int force_ellipses);
 
-static void
-chill_printchar PARAMS ((int, GDB_FILE *));
+static void chill_printchar (int, struct ui_file *);
 
 /* For now, Chill uses a simple mangling algorithm whereby you simply
    discard everything after the occurance of two successive CPLUS_MARKER
@@ -82,7 +86,7 @@ chill_demangle (mangled)
 static void
 chill_printchar (c, stream)
      register int c;
-     GDB_FILE *stream;
+     struct ui_file *stream;
 {
   c &= 0xFF;                   /* Avoid sign bit follies */
 
@@ -108,11 +112,11 @@ chill_printchar (c, stream)
    an explicit null byte.  So we always assume an implied null byte
    until gdb is able to maintain non-null terminated strings as well
    as null terminated strings (FIXME).
 */
+ */
 
 static void
 chill_printstr (stream, string, length, width, force_ellipses)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      char *string;
      unsigned int length;
      int width;
@@ -124,8 +128,6 @@ chill_printstr (stream, string, length, width, force_ellipses)
   int in_control_form = 0;
   int need_slashslash = 0;
   unsigned int c;
-  extern int repeat_count_threshold;
-  extern int print_max;
 
   if (length == 0)
     {
@@ -136,7 +138,7 @@ chill_printstr (stream, string, length, width, force_ellipses)
   for (i = 0; i < length && things_printed < print_max; ++i)
     {
       /* Position of the character we are examining
-        to see whether it is repeated.  */
+         to see whether it is repeated.  */
       unsigned int rep1;
       /* Number of repetitions we have detected so far.  */
       unsigned int reps;
@@ -175,7 +177,7 @@ chill_printstr (stream, string, length, width, force_ellipses)
        }
       else
        {
-         if (! in_literal_form && ! in_control_form)
+         if (!in_literal_form && !in_control_form)
            fputs_filtered ("\"", stream);
          if (PRINT_LITERAL_FORM (c))
            {
@@ -237,90 +239,91 @@ chill_create_fundamental_type (objfile, typeid)
 
   switch (typeid)
     {
-      default:
-       /* FIXME:  For now, if we are asked to produce a type not in this
-          language, create the equivalent of a C integer type with the
-          name "<?type?>".  When all the dust settles from the type
-          reconstruction work, this should probably become an error. */
-       type = init_type (TYPE_CODE_INT, 2, 0, "<?type?>", objfile);
-        warning ("internal error: no chill fundamental type %d", typeid);
-       break;
-      case FT_VOID:
-       /* FIXME:  Currently the GNU Chill compiler emits some DWARF entries for
-          typedefs, unrelated to anything directly in the code being compiled,
-          that have some FT_VOID types.  Just fake it for now. */
-       type = init_type (TYPE_CODE_VOID, 0, 0, "<?VOID?>", objfile);
-       break;
-      case FT_BOOLEAN:
-       type = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED, "BOOL", objfile);
-       break;
-      case FT_CHAR:
-       type = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED, "CHAR", objfile);
-       break;
-      case FT_SIGNED_CHAR:
-       type = init_type (TYPE_CODE_INT, 1, 0, "BYTE", objfile);
-       break;
-      case FT_UNSIGNED_CHAR:
-       type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, "UBYTE", objfile);
-       break;
-      case FT_SHORT:                   /* Chill ints are 2 bytes */
-       type = init_type (TYPE_CODE_INT, 2, 0, "INT", objfile);
-       break;
-      case FT_UNSIGNED_SHORT:          /* Chill ints are 2 bytes */
-       type = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, "UINT", objfile);
-       break;
-      case FT_INTEGER:                 /* FIXME? */
-      case FT_SIGNED_INTEGER:          /* FIXME? */
-      case FT_LONG:                    /* Chill longs are 4 bytes */
-      case FT_SIGNED_LONG:             /* Chill longs are 4 bytes */
-       type = init_type (TYPE_CODE_INT, 4, 0, "LONG", objfile);
-       break;
-      case FT_UNSIGNED_INTEGER:                /* FIXME? */
-      case FT_UNSIGNED_LONG:           /* Chill longs are 4 bytes */
-       type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED, "ULONG", objfile);
-       break;
-      case FT_FLOAT:
-       type = init_type (TYPE_CODE_FLT, 4, 0, "REAL", objfile);
-       break;
-      case FT_DBL_PREC_FLOAT:
-       type = init_type (TYPE_CODE_FLT, 8, 0, "LONG_REAL", objfile);
-       break;
-      }
+    default:
+      /* FIXME:  For now, if we are asked to produce a type not in this
+         language, create the equivalent of a C integer type with the
+         name "<?type?>".  When all the dust settles from the type
+         reconstruction work, this should probably become an error. */
+      type = init_type (TYPE_CODE_INT, 2, 0, "<?type?>", objfile);
+      warning ("internal error: no chill fundamental type %d", typeid);
+      break;
+    case FT_VOID:
+      /* FIXME:  Currently the GNU Chill compiler emits some DWARF entries for
+         typedefs, unrelated to anything directly in the code being compiled,
+         that have some FT_VOID types.  Just fake it for now. */
+      type = init_type (TYPE_CODE_VOID, 0, 0, "<?VOID?>", objfile);
+      break;
+    case FT_BOOLEAN:
+      type = init_type (TYPE_CODE_BOOL, 1, TYPE_FLAG_UNSIGNED, "BOOL", objfile);
+      break;
+    case FT_CHAR:
+      type = init_type (TYPE_CODE_CHAR, 1, TYPE_FLAG_UNSIGNED, "CHAR", objfile);
+      break;
+    case FT_SIGNED_CHAR:
+      type = init_type (TYPE_CODE_INT, 1, 0, "BYTE", objfile);
+      break;
+    case FT_UNSIGNED_CHAR:
+      type = init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, "UBYTE", objfile);
+      break;
+    case FT_SHORT:             /* Chill ints are 2 bytes */
+      type = init_type (TYPE_CODE_INT, 2, 0, "INT", objfile);
+      break;
+    case FT_UNSIGNED_SHORT:    /* Chill ints are 2 bytes */
+      type = init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, "UINT", objfile);
+      break;
+    case FT_INTEGER:           /* FIXME? */
+    case FT_SIGNED_INTEGER:    /* FIXME? */
+    case FT_LONG:              /* Chill longs are 4 bytes */
+    case FT_SIGNED_LONG:       /* Chill longs are 4 bytes */
+      type = init_type (TYPE_CODE_INT, 4, 0, "LONG", objfile);
+      break;
+    case FT_UNSIGNED_INTEGER:  /* FIXME? */
+    case FT_UNSIGNED_LONG:     /* Chill longs are 4 bytes */
+      type = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED, "ULONG", objfile);
+      break;
+    case FT_FLOAT:
+      type = init_type (TYPE_CODE_FLT, 4, 0, "REAL", objfile);
+      break;
+    case FT_DBL_PREC_FLOAT:
+      type = init_type (TYPE_CODE_FLT, 8, 0, "LONG_REAL", objfile);
+      break;
+    }
   return (type);
 }
-
 \f
+
 /* Table of operators and their precedences for printing expressions.  */
 
-static const struct op_print chill_op_print_tab[] = {
-    {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
-    {"OR",  BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
-    {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
-    {"MOD", BINOP_MOD, PREC_MUL, 0},
-    {"REM", BINOP_REM, PREC_MUL, 0},
-    {"SIZE",UNOP_SIZEOF, PREC_BUILTIN_FUNCTION, 0},
-    {"LOWER",UNOP_LOWER, PREC_BUILTIN_FUNCTION, 0},
-    {"UPPER",UNOP_UPPER, PREC_BUILTIN_FUNCTION, 0},
-    {"CARD",UNOP_CARD, PREC_BUILTIN_FUNCTION, 0},
-    {"MAX",UNOP_CHMAX, PREC_BUILTIN_FUNCTION, 0},
-    {"MIN",UNOP_CHMIN, PREC_BUILTIN_FUNCTION, 0},
-    {":=",  BINOP_ASSIGN, PREC_ASSIGN, 1},
-    {"=",   BINOP_EQUAL, PREC_EQUAL, 0},
-    {"/=",  BINOP_NOTEQUAL, PREC_EQUAL, 0},
-    {"<=",  BINOP_LEQ, PREC_ORDER, 0},
-    {">=",  BINOP_GEQ, PREC_ORDER, 0},
-    {">",   BINOP_GTR, PREC_ORDER, 0},
-    {"<",   BINOP_LESS, PREC_ORDER, 0},
-    {"+",   BINOP_ADD, PREC_ADD, 0},
-    {"-",   BINOP_SUB, PREC_ADD, 0},
-    {"*",   BINOP_MUL, PREC_MUL, 0},
-    {"/",   BINOP_DIV, PREC_MUL, 0},
-    {"//",  BINOP_CONCAT, PREC_PREFIX, 0},     /* FIXME: precedence? */
-    {"-",   UNOP_NEG, PREC_PREFIX, 0},
-    {"->",  UNOP_IND, PREC_SUFFIX, 1},
-    {"->",  UNOP_ADDR, PREC_PREFIX, 0},
-    {":",   BINOP_RANGE, PREC_ASSIGN, 0},
-    {NULL,  0, 0, 0}
+static const struct op_print chill_op_print_tab[] =
+{
+  {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
+  {"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
+  {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
+  {"MOD", BINOP_MOD, PREC_MUL, 0},
+  {"REM", BINOP_REM, PREC_MUL, 0},
+  {"SIZE", UNOP_SIZEOF, PREC_BUILTIN_FUNCTION, 0},
+  {"LOWER", UNOP_LOWER, PREC_BUILTIN_FUNCTION, 0},
+  {"UPPER", UNOP_UPPER, PREC_BUILTIN_FUNCTION, 0},
+  {"CARD", UNOP_CARD, PREC_BUILTIN_FUNCTION, 0},
+  {"MAX", UNOP_CHMAX, PREC_BUILTIN_FUNCTION, 0},
+  {"MIN", UNOP_CHMIN, PREC_BUILTIN_FUNCTION, 0},
+  {":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
+  {"=", BINOP_EQUAL, PREC_EQUAL, 0},
+  {"/=", BINOP_NOTEQUAL, PREC_EQUAL, 0},
+  {"<=", BINOP_LEQ, PREC_ORDER, 0},
+  {">=", BINOP_GEQ, PREC_ORDER, 0},
+  {">", BINOP_GTR, PREC_ORDER, 0},
+  {"<", BINOP_LESS, PREC_ORDER, 0},
+  {"+", BINOP_ADD, PREC_ADD, 0},
+  {"-", BINOP_SUB, PREC_ADD, 0},
+  {"*", BINOP_MUL, PREC_MUL, 0},
+  {"/", BINOP_DIV, PREC_MUL, 0},
+  {"//", BINOP_CONCAT, PREC_PREFIX, 0},                /* FIXME: precedence? */
+  {"-", UNOP_NEG, PREC_PREFIX, 0},
+  {"->", UNOP_IND, PREC_SUFFIX, 1},
+  {"->", UNOP_ADDR, PREC_PREFIX, 0},
+  {":", BINOP_RANGE, PREC_ASSIGN, 0},
+  {NULL, 0, 0, 0}
 };
 \f
 /* The built-in types of Chill.  */
@@ -331,14 +334,14 @@ struct type *builtin_type_chill_long;
 struct type *builtin_type_chill_ulong;
 struct type *builtin_type_chill_real;
 
-struct type ** CONST_PTR (chill_builtin_types[]) = 
+struct type **CONST_PTR (chill_builtin_types[]) =
 {
   &builtin_type_chill_bool,
-  &builtin_type_chill_char,
-  &builtin_type_chill_long,
-  &builtin_type_chill_ulong,
-  &builtin_type_chill_real,
-  0
+    &builtin_type_chill_char,
+    &builtin_type_chill_long,
+    &builtin_type_chill_ulong,
+    &builtin_type_chill_real,
+    0
 };
 
 /* Calculate LOWER or UPPER of TYPE.
@@ -347,7 +350,7 @@ struct type ** CONST_PTR (chill_builtin_types[]) =
 
 LONGEST
 type_lower_upper (op, type, result_type)
-     enum exp_opcode op;  /* Either UNOP_LOWER or UNOP_UPPER */
+     enum exp_opcode op;       /* Either UNOP_LOWER or UNOP_UPPER */
      struct type *type;
      struct type **result_type;
 {
@@ -364,7 +367,7 @@ type_lower_upper (op, type, result_type)
     case TYPE_CODE_ARRAY:
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_STRING:
-      type = TYPE_FIELD_TYPE (type, 0);  /* Get index type */
+      type = TYPE_FIELD_TYPE (type, 0);                /* Get index type */
 
       /* ... fall through ... */
     case TYPE_CODE_RANGE:
@@ -503,8 +506,8 @@ value_chill_max_min (op, val)
     error ("bad argument to %s builtin", op == UNOP_CHMAX ? "MAX" : "MIN");
 
   return value_from_longest (TYPE_CODE (elttype) == TYPE_CODE_RANGE
-                              ? TYPE_TARGET_TYPE (elttype)
-                              : elttype,
+                            ? TYPE_TARGET_TYPE (elttype)
+                            : elttype,
                             tmp);
 }
 
@@ -558,12 +561,12 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
          for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
            {
              argvec[tem]
-               = evaluate_subexp_chill (TYPE_FIELD_TYPE (type, tem-1),
+               = evaluate_subexp_chill (TYPE_FIELD_TYPE (type, tem - 1),
                                         exp, pos, noside);
            }
          for (; tem <= nargs; tem++)
            argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
-         argvec[tem] = 0; /* signal end of arglist */
+         argvec[tem] = 0;      /* signal end of arglist */
 
          return call_function_by_hand (argvec[0], nargs, argvec + 1);
        default:
@@ -614,11 +617,12 @@ evaluate_subexp_chill (expect_type, exp, pos, noside)
     }
 
   return evaluate_subexp_standard (expect_type, exp, pos, noside);
- nosideret:
+nosideret:
   return value_from_longest (builtin_type_long, (LONGEST) 1);
 }
 
-const struct language_defn chill_language_defn = {
+const struct language_defn chill_language_defn =
+{
   "chill",
   language_chill,
   chill_builtin_types,
@@ -630,18 +634,18 @@ const struct language_defn chill_language_defn = {
   chill_printchar,             /* print a character constant */
   chill_printstr,              /* function to print a string constant */
   NULL,                                /* Function to print a single char */
-  chill_create_fundamental_type,/* Create fundamental type in this language */
+  chill_create_fundamental_type,       /* Create fundamental type in this language */
   chill_print_type,            /* Print a type using appropriate syntax */
   chill_val_print,             /* Print a value using appropriate syntax */
   chill_value_print,           /* Print a top-levl value */
-  {"",      "B'",  "",   ""},  /* Binary format info */
-  {"O'%lo",  "O'",  "o",  ""}, /* Octal format info */
-  {"D'%ld",  "D'",  "d",  ""}, /* Decimal format info */
-  {"H'%lx",  "H'",  "x",  ""}, /* Hex format info */
+  {"", "B'", "", ""},          /* Binary format info */
+  {"O'%lo", "O'", "o", ""},    /* Octal format info */
+  {"D'%ld", "D'", "d", ""},    /* Decimal format info */
+  {"H'%lx", "H'", "x", ""},    /* Hex format info */
   chill_op_print_tab,          /* expression operators for printing */
   0,                           /* arrays are first-class (not c-style) */
   0,                           /* String lower bound */
-  &builtin_type_chill_char,    /* Type of string elements */ 
+  &builtin_type_chill_char,    /* Type of string elements */
   LANG_MAGIC
 };
 
index 340e77f..b3c191b 100644 (file)
@@ -1,23 +1,24 @@
 /* Read coff symbol tables and convert to internal format, for GDB.
    Copyright 1987, 88, 89, 90, 91, 92, 93, 94, 96, 97, 1998
-             Free Software Foundation, Inc.
+   Free Software Foundation, Inc.
    Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu).
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -42,16 +43,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "complaints.h"
 #include "target.h"
 
-struct coff_symfile_info {
-  file_ptr min_lineno_offset;          /* Where in file lowest line#s are */
-  file_ptr max_lineno_offset;          /* 1+last byte of line#s in file */
+extern void _initialize_coffread PARAMS ((void));
 
-  CORE_ADDR textaddr;                  /* Addr of .text section. */
-  unsigned int textsize;               /* Size of .text section. */
-  struct stab_section_list *stabsects; /* .stab sections.  */
-  asection *stabstrsect;               /* Section pointer for .stab section */
-  char *stabstrdata;
-};
+struct coff_symfile_info
+  {
+    file_ptr min_lineno_offset;        /* Where in file lowest line#s are */
+    file_ptr max_lineno_offset;        /* 1+last byte of line#s in file */
+
+    CORE_ADDR textaddr;                /* Addr of .text section. */
+    unsigned int textsize;     /* Size of .text section. */
+    struct stab_section_list *stabsects;       /* .stab sections.  */
+    asection *stabstrsect;     /* Section pointer for .stab section */
+    char *stabstrdata;
+  };
 
 /* Translate an external name string into a user-visible name.  */
 #define        EXTERNAL_NAME(string, abfd) \
@@ -69,7 +73,7 @@ struct coff_symfile_info {
    to map one to one onto the sdb register numbers.  */
 
 #ifndef SDB_REG_TO_REGNUM
-# define SDB_REG_TO_REGNUM(value)     (value)
+#define SDB_REG_TO_REGNUM(value)     (value)
 #endif
 
 /* Core address of start and end of text of current source file.
@@ -84,21 +88,6 @@ static CORE_ADDR current_source_end_addr;
 static bfd *nlist_bfd_global;
 static int nlist_nsyms_global;
 
-/* Vector of line number information.  */
-
-static struct linetable *line_vector;
-
-/* Index of next entry to go in line_vector_index.  */
-
-static int line_vector_index;
-
-/* Last line number recorded in the line vector.  */
-
-static int prev_line_number;
-
-/* Number of elements allocated for line_vector currently.  */
-
-static int line_vector_length;
 
 /* Pointers to scratch storage, used for reading raw symbols and auxents.  */
 
@@ -111,24 +100,24 @@ static char *temp_aux;
    internally to the BTYPE, ISPTR, ISFCN, ISARY, ISTAG, and DECREF
    macros from include/coff/internal.h .  */
 
-static unsigned        local_n_btmask;
-static unsigned        local_n_btshft;
-static unsigned        local_n_tmask;
-static unsigned        local_n_tshift;
+static unsigned local_n_btmask;
+static unsigned local_n_btshft;
+static unsigned local_n_tmask;
+static unsigned local_n_tshift;
 
 #define        N_BTMASK        local_n_btmask
 #define        N_BTSHFT        local_n_btshft
 #define        N_TMASK         local_n_tmask
 #define        N_TSHIFT        local_n_tshift
+
 /* Local variables that hold the sizes in the file of various COFF structures.
    (We only need to know this to read them from the file -- BFD will then
    translate the data in them, into `internal_xxx' structs in the right
    byte order, alignment, etc.)  */
 
-static unsigned        local_linesz;
-static unsigned        local_symesz;
-static unsigned        local_auxesz;
+static unsigned local_linesz;
+static unsigned local_symesz;
+static unsigned local_auxesz;
 
 /* This is set if this is a PE format file.  */
 
@@ -141,50 +130,53 @@ static struct symbol *opaque_type_chain[HASHSIZE];
 
 /* Complaints about various problems in the file being read  */
 
-struct complaint ef_complaint = 
-  {"Unmatched .ef symbol(s) ignored starting at symnum %d", 0, 0};
+struct complaint ef_complaint =
+{"Unmatched .ef symbol(s) ignored starting at symnum %d", 0, 0};
 
-struct complaint ef_stack_complaint = 
-  {"`.ef' symbol without matching `.bf' symbol ignored starting at symnum %d", 0, 0};
+struct complaint ef_stack_complaint =
+{"`.ef' symbol without matching `.bf' symbol ignored starting at symnum %d", 0, 0};
 
-struct complaint eb_stack_complaint = 
-  {"`.eb' symbol without matching `.bb' symbol ignored starting at symnum %d", 0, 0};
+struct complaint eb_stack_complaint =
+{"`.eb' symbol without matching `.bb' symbol ignored starting at symnum %d", 0, 0};
 
 struct complaint bf_no_aux_complaint =
-  {"`.bf' symbol %d has no aux entry", 0, 0};
+{"`.bf' symbol %d has no aux entry", 0, 0};
 
 struct complaint ef_no_aux_complaint =
-  {"`.ef' symbol %d has no aux entry", 0, 0};
+{"`.ef' symbol %d has no aux entry", 0, 0};
 
 struct complaint lineno_complaint =
-  {"Line number pointer %d lower than start of line numbers", 0, 0};
+{"Line number pointer %d lower than start of line numbers", 0, 0};
 
 struct complaint unexpected_type_complaint =
-  {"Unexpected type for symbol %s", 0, 0};
+{"Unexpected type for symbol %s", 0, 0};
 
 struct complaint bad_sclass_complaint =
-  {"Bad n_sclass for symbol %s", 0, 0};
+{"Bad n_sclass for symbol %s", 0, 0};
 
 struct complaint misordered_blocks_complaint =
-  {"Blocks out of order at address %x", 0, 0};
+{"Blocks out of order at address %x", 0, 0};
 
 struct complaint tagndx_bad_complaint =
-  {"Symbol table entry for %s has bad tagndx value", 0, 0};
+{"Symbol table entry for %s has bad tagndx value", 0, 0};
 
-struct complaint eb_complaint = 
-  {"Mismatched .eb symbol ignored starting at symnum %d", 0, 0};
+struct complaint eb_complaint =
+{"Mismatched .eb symbol ignored starting at symnum %d", 0, 0};
 
 /* Simplified internal version of coff symbol table information */
 
-struct coff_symbol {
-  char *c_name;
-  int c_symnum;                /* symbol number of this entry */
-  int c_naux;          /* 0 if syment only, 1 if syment + auxent, etc */
-  long c_value;
-  int c_sclass;
-  int c_secnum;
-  unsigned int c_type;
-};
+struct coff_symbol
+  {
+    char *c_name;
+    int c_symnum;              /* symbol number of this entry */
+    int c_naux;                        /* 0 if syment only, 1 if syment + auxent, etc */
+    long c_value;
+    int c_sclass;
+    int c_secnum;
+    unsigned int c_type;
+  };
+
+extern void stabsread_clear_cache PARAMS ((void));
 
 static struct type *coff_read_struct_type PARAMS ((int, int, int));
 
@@ -203,14 +195,13 @@ static struct type *coff_read_enum_type PARAMS ((int, int, int));
 
 static struct symbol *process_coff_symbol PARAMS ((struct coff_symbol *,
                                                   union internal_auxent *,
-                                                  struct section_offsets *,
                                                   struct objfile *));
 
 static void patch_opaque_types PARAMS ((struct symtab *));
 
 static void patch_type PARAMS ((struct type *, struct type *));
 
-static void enter_linenos PARAMS ((long, int, int, struct section_offsets *));
+static void enter_linenos PARAMS ((long, int, int, struct objfile *));
 
 static void free_linetab PARAMS ((void));
 
@@ -228,8 +219,7 @@ static void read_one_sym PARAMS ((struct coff_symbol *,
                                  struct internal_syment *,
                                  union internal_auxent *));
 
-static void coff_symtab_read PARAMS ((long, int, struct section_offsets *,
-                                     struct objfile *));
+static void coff_symtab_read PARAMS ((long, unsigned int, struct objfile *));
 
 static void find_linenos PARAMS ((bfd *, sec_ptr, PTR));
 
@@ -237,8 +227,7 @@ static void coff_symfile_init PARAMS ((struct objfile *));
 
 static void coff_new_init PARAMS ((struct objfile *));
 
-static void coff_symfile_read PARAMS ((struct objfile *,
-                                      struct section_offsets *, int));
+static void coff_symfile_read PARAMS ((struct objfile *, int));
 
 static void coff_symfile_finish PARAMS ((struct objfile *));
 
@@ -252,8 +241,6 @@ static void complete_symtab PARAMS ((char *, CORE_ADDR, unsigned int));
 
 static void coff_start_symtab PARAMS ((char *));
 
-static void coff_record_line PARAMS ((int, CORE_ADDR));
-
 static struct type *coff_alloc_type PARAMS ((int));
 
 static struct type **coff_lookup_type PARAMS ((int));
@@ -301,7 +288,7 @@ coff_locate_sections (abfd, sectp, csip)
       /* We can have multiple .stab sections if linked with
          --split-by-reloc.  */
       for (s = name + sizeof ".stab" - 1; *s != '\0'; s++)
-       if (! isdigit (*s))
+       if (!isdigit (*s))
          break;
       if (*s == '\0')
        {
@@ -316,8 +303,8 @@ coff_locate_sections (abfd, sectp, csip)
          *pn = n;
 
          /* This will be run after coffstab_build_psymtabs is called
-             in coff_symfile_read, at which point we no longer need
-             the information.  */
+            in coff_symfile_read, at which point we no longer need
+            the information.  */
          make_cleanup (free, n);
        }
     }
@@ -326,19 +313,21 @@ coff_locate_sections (abfd, sectp, csip)
 /* Return the section_offsets* that CS points to.  */
 static int cs_to_section PARAMS ((struct coff_symbol *, struct objfile *));
 
-struct find_targ_sec_arg {
-  int targ_index;
-  asection **resultp;
-};
+struct find_targ_sec_arg
+  {
+    int targ_index;
+    asection **resultp;
+  };
 
 static void find_targ_sec PARAMS ((bfd *, asection *, void *));
 
-static void find_targ_sec (abfd, sect, obj)
+static void
+find_targ_sec (abfd, sect, obj)
      bfd *abfd;
      asection *sect;
      PTR obj;
 {
-  struct find_targ_sec_arg *args = (struct find_targ_sec_arg *)obj;
+  struct find_targ_sec_arg *args = (struct find_targ_sec_arg *) obj;
   if (sect->target_index == args->targ_index)
     *args->resultp = sect;
 }
@@ -406,14 +395,14 @@ coff_lookup_type (index)
       int old_vector_length = type_vector_length;
 
       type_vector_length *= 2;
-      if (index /* is still */ >= type_vector_length)
+      if (index /* is still */  >= type_vector_length)
        type_vector_length = index * 2;
 
       type_vector = (struct type **)
        xrealloc ((char *) type_vector,
                  type_vector_length * sizeof (struct type *));
       memset (&type_vector[old_vector_length], 0,
-            (type_vector_length - old_vector_length) * sizeof(struct type *));
+        (type_vector_length - old_vector_length) * sizeof (struct type *));
     }
   return &type_vector[index];
 }
@@ -440,61 +429,26 @@ coff_alloc_type (index)
   return type;
 }
 \f
-/* Record a line number entry for line LINE at address PC.
-   FIXME:  Use record_line instead.  */
-
-static void
-coff_record_line (line, pc)
-     int line;
-     CORE_ADDR pc;
-{
-  struct linetable_entry *e;
-  /* Make sure line vector is big enough.  */
-
-  if (line_vector_index + 2 >= line_vector_length)
-    {
-      line_vector_length *= 2;
-      line_vector = (struct linetable *)
-       xrealloc ((char *) line_vector, sizeof (struct linetable)
-                 + (line_vector_length
-                    * sizeof (struct linetable_entry)));
-    }
-
-  e = line_vector->item + line_vector_index++;
-  e->line = line; e->pc = pc;
-}
-\f
 /* Start a new symtab for a new source file.
    This is called when a COFF ".file" symbol is seen;
    it indicates the start of data for one original source file.  */
 
 static void
 coff_start_symtab (name)
-    char *name;
+     char *name;
 {
   start_symtab (
-               /* We fill in the filename later.  start_symtab puts
-                  this pointer into last_source_file and we put it in
-                  subfiles->name, which end_symtab frees; that's why
-                  it must be malloc'd.  */
-               savestring (name, strlen(name)),
-               /* We never know the directory name for COFF.  */
-               NULL,
-               /* The start address is irrelevant, since we set
-                  last_source_start_addr in coff_end_symtab.  */
-               0);
+  /* We fill in the filename later.  start_symtab puts
+     this pointer into last_source_file and we put it in
+     subfiles->name, which end_symtab frees; that's why
+     it must be malloc'd.  */
+                savestring (name, strlen (name)),
+  /* We never know the directory name for COFF.  */
+                NULL,
+  /* The start address is irrelevant, since we set
+     last_source_start_addr in coff_end_symtab.  */
+                0);
   record_debugformat ("COFF");
-
-  /* Initialize the source file line number information for this file.  */
-
-  if (line_vector)             /* Unlikely, but maybe possible? */
-    free ((PTR)line_vector);
-  line_vector_index = 0;
-  line_vector_length = 1000;
-  prev_line_number = -2;       /* Force first line number to be explicit */
-  line_vector = (struct linetable *)
-    xmalloc (sizeof (struct linetable)
-            + line_vector_length * sizeof (struct linetable_entry));
 }
 
 /* Save the vital information from when starting to read a file,
@@ -504,9 +458,9 @@ coff_start_symtab (name)
 
 static void
 complete_symtab (name, start_addr, size)
-    char *name;
-    CORE_ADDR start_addr;
-    unsigned int size;
+     char *name;
+     CORE_ADDR start_addr;
+     unsigned int size;
 {
   if (last_source_file != NULL)
     free (last_source_file);
@@ -514,11 +468,11 @@ complete_symtab (name, start_addr, size)
   current_source_start_addr = start_addr;
   current_source_end_addr = start_addr + size;
 
-  if (current_objfile -> ei.entry_point >= current_source_start_addr &&
-      current_objfile -> ei.entry_point <  current_source_end_addr)
+  if (current_objfile->ei.entry_point >= current_source_start_addr &&
+      current_objfile->ei.entry_point < current_source_end_addr)
     {
-      current_objfile -> ei.entry_file_lowpc = current_source_start_addr;
-      current_objfile -> ei.entry_file_highpc = current_source_end_addr;
+      current_objfile->ei.entry_file_lowpc = current_source_start_addr;
+      current_objfile->ei.entry_file_highpc = current_source_end_addr;
     }
 }
 
@@ -535,26 +489,12 @@ coff_end_symtab (objfile)
 
   last_source_start_addr = current_source_start_addr;
 
-  /* For no good reason, this file stores the number of entries in a
-     separate variable instead of in line_vector->nitems.  Fix it.  */
-  if (line_vector)
-    line_vector->nitems = line_vector_index;
-
-  /* For COFF, we only have one subfile, so we can just look at
-     subfiles and not worry about there being other elements in the
-     chain.  We fill in various fields now because we didn't know them
-     before (or because doing it now is simply an artifact of how this
-     file used to be written).  */
-  subfiles->line_vector = line_vector;
-
   symtab = end_symtab (current_source_end_addr, objfile, 0);
 
   if (symtab != NULL)
     free_named_symtabs (symtab->filename);
 
   /* Reinitialize for beginning of new file. */
-  line_vector = 0;
-  line_vector_length = -1;
   last_source_file = NULL;
 }
 \f
@@ -566,7 +506,8 @@ record_minimal_symbol (name, address, type, objfile)
      struct objfile *objfile;
 {
   /* We don't want TDESC entry points in the minimal symbol table */
-  if (name[0] == '@') return;
+  if (name[0] == '@')
+    return;
 
   prim_record_minimal_symbol (name, address, type, objfile);
 }
@@ -631,7 +572,7 @@ find_linenos (abfd, asect, vpinfo)
     return;
   size = count * local_linesz;
 
-  info = (struct coff_symfile_info *)vpinfo;
+  info = (struct coff_symfile_info *) vpinfo;
 /* WARNING WILL ROBINSON!  ACCESSING BFD-PRIVATE DATA HERE!  FIXME!  */
   offset = asect->line_filepos;
 /* End of warning */
@@ -654,9 +595,8 @@ static bfd *symfile_bfd;
 
 /* ARGSUSED */
 static void
-coff_symfile_read (objfile, section_offsets, mainline)
+coff_symfile_read (objfile, mainline)
      struct objfile *objfile;
-     struct section_offsets *section_offsets;
      int mainline;
 {
   struct coff_symfile_info *info;
@@ -665,37 +605,38 @@ coff_symfile_read (objfile, section_offsets, mainline)
   coff_data_type *cdata = coff_data (abfd);
   char *name = bfd_get_filename (abfd);
   register int val;
-  int num_symbols;
+  unsigned int num_symbols;
   int symtab_offset;
   int stringtab_offset;
   struct cleanup *back_to;
   int stabstrsize;
-
-  info = (struct coff_symfile_info *) objfile -> sym_private;
+  int len;
+  char * target;
+  
+  info = (struct coff_symfile_info *) objfile->sym_private;
   dbxinfo = objfile->sym_stab_info;
-  symfile_bfd = abfd;                  /* Kludge for swap routines */
+  symfile_bfd = abfd;          /* Kludge for swap routines */
 
 /* WARNING WILL ROBINSON!  ACCESSING BFD-PRIVATE DATA HERE!  FIXME!  */
-   num_symbols = bfd_get_symcount (abfd);      /* How many syms */
-   symtab_offset = cdata->sym_filepos;         /* Symbol table file offset */
-   stringtab_offset = symtab_offset +          /* String table file offset */
-                     num_symbols * cdata->local_symesz;
+  num_symbols = bfd_get_symcount (abfd);       /* How many syms */
+  symtab_offset = cdata->sym_filepos;  /* Symbol table file offset */
+  stringtab_offset = symtab_offset +   /* String table file offset */
+    num_symbols * cdata->local_symesz;
 
   /* Set a few file-statics that give us specific information about
      the particular COFF file format we're reading.  */
-  local_linesz   = cdata->local_linesz;
   local_n_btmask = cdata->local_n_btmask;
   local_n_btshft = cdata->local_n_btshft;
-  local_n_tmask  = cdata->local_n_tmask;
+  local_n_tmask = cdata->local_n_tmask;
   local_n_tshift = cdata->local_n_tshift;
-  local_linesz   = cdata->local_linesz;
-  local_symesz   = cdata->local_symesz;
-  local_auxesz   = cdata->local_auxesz;
+  local_linesz = cdata->local_linesz;
+  local_symesz = cdata->local_symesz;
+  local_auxesz = cdata->local_auxesz;
 
   /* Allocate space for raw symbol and aux entries, based on their
      space requirements as reported by BFD.  */
   temp_sym = (char *) xmalloc
-        (cdata->local_symesz + cdata->local_auxesz);
+    (cdata->local_symesz + cdata->local_auxesz);
   temp_aux = temp_sym + cdata->local_symesz;
   back_to = make_cleanup ((make_cleanup_func) free_current_contents, &temp_sym);
 
@@ -704,7 +645,9 @@ coff_symfile_read (objfile, section_offsets, mainline)
      from the section address, rather than as absolute addresses.
      FIXME: We should use BFD to read the symbol table, and thus avoid
      this problem.  */
-  pe_file = strncmp (bfd_get_target (objfile->obfd), "pe", 2) == 0;
+  pe_file =
+    strncmp (bfd_get_target (objfile->obfd), "pe", 2) == 0
+    || strncmp (bfd_get_target (objfile->obfd), "epoc-pe", 7) == 0;
 
 /* End of warning */
 
@@ -714,7 +657,7 @@ coff_symfile_read (objfile, section_offsets, mainline)
   bfd_map_over_sections (abfd, find_linenos, (PTR) info);
 
   make_cleanup ((make_cleanup_func) free_linetab, 0);
-  val = init_lineno (abfd, info->min_lineno_offset, 
+  val = init_lineno (abfd, info->min_lineno_offset,
                     info->max_lineno_offset - info->min_lineno_offset);
   if (val < 0)
     error ("\"%s\": error reading line numbers\n", name);
@@ -732,15 +675,14 @@ coff_symfile_read (objfile, section_offsets, mainline)
   /* Now that the executable file is positioned at symbol table,
      process it and define symbols accordingly.  */
 
-  coff_symtab_read ((long) symtab_offset, num_symbols, section_offsets,
-                   objfile);
+  coff_symtab_read ((long) symtab_offset, num_symbols, objfile);
 
   /* Sort symbols alphabetically within each block.  */
 
   {
     struct symtab *s;
 
-    for (s = objfile -> symtabs; s != NULL; s = s -> next)
+    for (s = objfile->symtabs; s != NULL; s = s->next)
       sort_symtab_syms (s);
   }
 
@@ -753,14 +695,24 @@ coff_symfile_read (objfile, section_offsets, mainline)
 
   if (info->stabsects)
     {
+      if (!info->stabstrsect)
+       {
+         error_begin ();
+         fprintf_filtered
+           (gdb_stderr,
+            ("The debugging information in `%s' is corrupted.\n"
+          "The file has a `.stabs' section, but no `.stabstr' section.\n"),
+            name);
+         return_to_top_level (RETURN_ERROR);
+       }
+
       /* FIXME: dubious.  Why can't we use something normal like
-        bfd_get_section_contents?  */
+         bfd_get_section_contents?  */
       bfd_seek (abfd, abfd->where, 0);
 
       stabstrsize = bfd_section_size (abfd, info->stabstrsect);
 
       coffstab_build_psymtabs (objfile,
-                              section_offsets,
                               mainline,
                               info->textaddr, info->textsize,
                               info->stabsects,
@@ -785,23 +737,25 @@ static void
 coff_symfile_finish (objfile)
      struct objfile *objfile;
 {
-  if (objfile -> sym_private != NULL)
+  if (objfile->sym_private != NULL)
     {
-      mfree (objfile -> md, objfile -> sym_private);
+      mfree (objfile->md, objfile->sym_private);
     }
-}
 
+  /* Let stabs reader clean up */
+  stabsread_clear_cache ();
+}
 \f
+
 /* Given pointers to a symbol table in coff style exec file,
    analyze them and create struct symtab's describing the symbols.
    NSYMS is the number of symbols in the symbol table.
    We read them one at a time using read_one_sym ().  */
 
 static void
-coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
+coff_symtab_read (symtab_offset, nsyms, objfile)
      long symtab_offset;
-     int nsyms;
-     struct section_offsets *section_offsets;
+     unsigned int nsyms;
      struct objfile *objfile;
 {
   register struct context_stack *new;
@@ -820,6 +774,7 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
   char *filestring = "";
   int depth = 0;
   int fcn_first_line = 0;
+  CORE_ADDR fcn_first_line_addr;
   int fcn_last_line = 0;
   int fcn_start_addr = 0;
   long fcn_line_ptr = 0;
@@ -853,7 +808,7 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
   last_source_file = NULL;
   memset (opaque_type_chain, 0, sizeof opaque_type_chain);
 
-  if (type_vector)                     /* Get rid of previous one */
+  if (type_vector)             /* Get rid of previous one */
     free ((PTR) type_vector);
   type_vector_length = 160;
   type_vector = (struct type **)
@@ -888,7 +843,7 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
       if (ISFCN (cs->c_type) && cs->c_sclass != C_TPDEF)
        {
          /* Record all functions -- external and static -- in minsyms. */
-         tmpaddr = cs->c_value + ANOFFSET (section_offsets, SECT_OFF_TEXT);
+         tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
          record_minimal_symbol (cs->c_name, tmpaddr, mst_text, objfile);
 
          fcn_line_ptr = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr;
@@ -901,50 +856,51 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
 
       switch (cs->c_sclass)
        {
-         case C_EFCN:
-         case C_EXTDEF:
-         case C_ULABEL:
-         case C_USTATIC:
-         case C_LINE:
-         case C_ALIAS:
-         case C_HIDDEN:
-           complain (&bad_sclass_complaint, cs->c_name);
-           break;
-
-         case C_FILE:
-           /* c_value field contains symnum of next .file entry in table
-              or symnum of first global after last .file.  */
-           next_file_symnum = cs->c_value;
-           if (cs->c_naux > 0)
-             filestring = coff_getfilename (&main_aux);
-           else
-             filestring = "";
+       case C_EFCN:
+       case C_EXTDEF:
+       case C_ULABEL:
+       case C_USTATIC:
+       case C_LINE:
+       case C_ALIAS:
+       case C_HIDDEN:
+         complain (&bad_sclass_complaint, cs->c_name);
+         break;
 
-           /* Complete symbol table for last object file
-              containing debugging information.  */
-           if (last_source_file)
-             {
-               coff_end_symtab (objfile);
-               coff_start_symtab (filestring);
-             }
-           in_source_file = 1;
-           break;
+       case C_FILE:
+         /* c_value field contains symnum of next .file entry in table
+            or symnum of first global after last .file.  */
+         next_file_symnum = cs->c_value;
+         if (cs->c_naux > 0)
+           filestring = coff_getfilename (&main_aux);
+         else
+           filestring = "";
+
+         /* Complete symbol table for last object file
+            containing debugging information.  */
+         if (last_source_file)
+           {
+             coff_end_symtab (objfile);
+             coff_start_symtab (filestring);
+           }
+         in_source_file = 1;
+         break;
 
          /* C_LABEL is used for labels and static functions.  Including
             it here allows gdb to see static functions when no debug
             info is available.  */
-         case C_LABEL:
-           /* However, labels within a function can make weird backtraces,
-              so filter them out (from phdm@macqel.be). */
-           if (within_function)
-             break;
-          case C_STAT:
-         case C_THUMBLABEL:
-         case C_THUMBSTAT:
-         case C_THUMBSTATFUNC:
-           if (cs->c_name[0] == '.')
-             {
-               if (STREQ (cs->c_name, ".text")) {
+       case C_LABEL:
+         /* However, labels within a function can make weird backtraces,
+            so filter them out (from phdm@macqel.be). */
+         if (within_function)
+           break;
+       case C_STAT:
+       case C_THUMBLABEL:
+       case C_THUMBSTAT:
+       case C_THUMBSTATFUNC:
+         if (cs->c_name[0] == '.')
+           {
+             if (STREQ (cs->c_name, ".text"))
+               {
                  /* FIXME:  don't wire in ".text" as section name
                     or symbol name! */
                  /* Check for in_source_file deals with case of
@@ -952,236 +908,246 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
                     followed by a later file with no symbols.  */
                  if (in_source_file)
                    complete_symtab (filestring,
-                                    cs->c_value + ANOFFSET (section_offsets, SECT_OFF_TEXT),
+                   cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
                                     main_aux.x_scn.x_scnlen);
                  in_source_file = 0;
                }
-               /* flush rest of '.' symbols */
-               break;
-             }
-           else if (!SDB_TYPE (cs->c_type)
-                    && cs->c_name[0] == 'L'
-                    && (strncmp (cs->c_name, "LI%", 3) == 0
-                        || strncmp (cs->c_name, "LF%", 3) == 0
-                        || strncmp (cs->c_name,"LC%",3) == 0
-                        || strncmp (cs->c_name,"LP%",3) == 0
-                        || strncmp (cs->c_name,"LPB%",4) == 0
-                        || strncmp (cs->c_name,"LBB%",4) == 0
-                        || strncmp (cs->c_name,"LBE%",4) == 0
-                        || strncmp (cs->c_name,"LPBX%",5) == 0))
-             /* At least on a 3b1, gcc generates swbeg and string labels
-                that look like this.  Ignore them.  */
+             /* flush rest of '.' symbols */
              break;
-           /* fall in for static symbols that don't start with '.' */
-         case C_THUMBEXT:
-         case C_THUMBEXTFUNC:
-         case C_EXT:
-           {
-             /* Record it in the minimal symbols regardless of
-                SDB_TYPE.  This parallels what we do for other debug
-                formats, and probably is needed to make
-                print_address_symbolic work right without the (now
-                gone) "set fast-symbolic-addr off" kludge.  */
+           }
+         else if (!SDB_TYPE (cs->c_type)
+                  && cs->c_name[0] == 'L'
+                  && (strncmp (cs->c_name, "LI%", 3) == 0
+                      || strncmp (cs->c_name, "LF%", 3) == 0
+                      || strncmp (cs->c_name, "LC%", 3) == 0
+                      || strncmp (cs->c_name, "LP%", 3) == 0
+                      || strncmp (cs->c_name, "LPB%", 4) == 0
+                      || strncmp (cs->c_name, "LBB%", 4) == 0
+                      || strncmp (cs->c_name, "LBE%", 4) == 0
+                      || strncmp (cs->c_name, "LPBX%", 5) == 0))
+           /* At least on a 3b1, gcc generates swbeg and string labels
+              that look like this.  Ignore them.  */
+           break;
+         /* fall in for static symbols that don't start with '.' */
+       case C_THUMBEXT:
+       case C_THUMBEXTFUNC:
+       case C_EXT:
+         {
+           /* Record it in the minimal symbols regardless of
+              SDB_TYPE.  This parallels what we do for other debug
+              formats, and probably is needed to make
+              print_address_symbolic work right without the (now
+              gone) "set fast-symbolic-addr off" kludge.  */
 
-             /* FIXME: should use mst_abs, and not relocate, if absolute.  */
-             enum minimal_symbol_type ms_type;
-             int sec;
+           /* FIXME: should use mst_abs, and not relocate, if absolute.  */
+           enum minimal_symbol_type ms_type;
+           int sec;
 
-             if (cs->c_secnum == N_UNDEF)
-               {
-                 /* This is a common symbol.  See if the target
-                    environment knows where it has been relocated to.  */
-                 CORE_ADDR reladdr;
-                 if (target_lookup_symbol (cs->c_name, &reladdr))
-                   {
-                     /* Error in lookup; ignore symbol.  */
-                     break;
-                   }
-                 tmpaddr = reladdr;
-                 /* The address has already been relocated; make sure that
-                    objfile_relocate doesn't relocate it again.  */
-                 sec = -2;
-                 ms_type = cs->c_sclass == C_EXT
-                           || cs->c_sclass == C_THUMBEXT ?
-                              mst_bss : mst_file_bss;
-               }
-             else
-               {
-                 sec = cs_to_section (cs, objfile);
-                 tmpaddr = cs->c_value;
-                 if (cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
-                     || cs->c_sclass == C_THUMBEXT)
-                   tmpaddr += ANOFFSET (section_offsets, sec);
+           if (cs->c_secnum == N_UNDEF)
+             {
+               /* This is a common symbol.  See if the target
+                  environment knows where it has been relocated to.  */
+               CORE_ADDR reladdr;
+               if (target_lookup_symbol (cs->c_name, &reladdr))
+                 {
+                   /* Error in lookup; ignore symbol.  */
+                   break;
+                 }
+               tmpaddr = reladdr;
+               /* The address has already been relocated; make sure that
+                  objfile_relocate doesn't relocate it again.  */
+               sec = -2;
+               ms_type = cs->c_sclass == C_EXT
+                 || cs->c_sclass == C_THUMBEXT ?
+                 mst_bss : mst_file_bss;
+             }
+           else
+             {
+               sec = cs_to_section (cs, objfile);
+               tmpaddr = cs->c_value;
+               if (cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
+                   || cs->c_sclass == C_THUMBEXT)
+                 tmpaddr += ANOFFSET (objfile->section_offsets, sec);
 
-                 switch (sec)
-                   {
-                   case SECT_OFF_TEXT:
-                   case SECT_OFF_RODATA:
-                     ms_type =
-                       cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
-                                       || cs->c_sclass == C_THUMBEXT ?
-                                         mst_text : mst_file_text;
+               switch (sec)
+                 {
+                 case SECT_OFF_TEXT:
+                 case SECT_OFF_RODATA:
+                   ms_type =
+                     cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
+                     || cs->c_sclass == C_THUMBEXT ?
+                     mst_text : mst_file_text;
 #ifdef SMASH_TEXT_ADDRESS
-                     if (tmpaddr & 1)  /* FIXME: delete this line */
-                       SMASH_TEXT_ADDRESS (tmpaddr);
+                   if (tmpaddr & 1)    /* FIXME: delete this line */
+                     SMASH_TEXT_ADDRESS (tmpaddr);
 #endif
-                     break;
-                   case SECT_OFF_DATA:
-                     ms_type =
-                       cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
-                         mst_data : mst_file_data;
-                     break;
-                   case SECT_OFF_BSS:
-                     ms_type =
-                       cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
-                         mst_data : mst_file_data;
-                     break;
-                   default:
-                     ms_type = mst_unknown;
-                     break;
-                   }
-               }
+                   break;
+                 case SECT_OFF_DATA:
+                   ms_type =
+                     cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
+                     mst_data : mst_file_data;
+                   break;
+                 case SECT_OFF_BSS:
+                   ms_type =
+                     cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
+                     mst_data : mst_file_data;
+                   break;
+                 default:
+                   ms_type = mst_unknown;
+                   break;
+                 }
+             }
 
-             if (cs->c_name[0] != '@' /* Skip tdesc symbols */)
-               {
-                 struct minimal_symbol *msym;
+           if (cs->c_name[0] != '@' /* Skip tdesc symbols */ )
+             {
+               struct minimal_symbol *msym;
 
-                 msym = prim_record_minimal_symbol_and_info
-                 (cs->c_name, tmpaddr, ms_type, (char *)cs->c_sclass, sec,
+               msym = prim_record_minimal_symbol_and_info
+                 (cs->c_name, tmpaddr, ms_type, (char *) cs->c_sclass, sec,
                   NULL, objfile);
 #ifdef COFF_MAKE_MSYMBOL_SPECIAL
-                 if(msym)
-                   COFF_MAKE_MSYMBOL_SPECIAL(cs->c_sclass, msym);              
+               if (msym)
+                 COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);
 #endif
-               }
-             if (SDB_TYPE (cs->c_type))
-               {
-                 struct symbol *sym;
-                 sym = process_coff_symbol
-                   (cs, &main_aux, section_offsets, objfile);
-                 SYMBOL_VALUE (sym) = tmpaddr;
-                 SYMBOL_SECTION (sym) = sec;
-               }
-           }
-           break;
-
-         case C_FCN:
-           if (STREQ (cs->c_name, ".bf"))
-             {
-               within_function = 1;
-
-               /* value contains address of first non-init type code */
-               /* main_aux.x_sym.x_misc.x_lnsz.x_lnno
-                           contains line number of '{' } */
-               if (cs->c_naux != 1)
-                 complain (&bf_no_aux_complaint, cs->c_symnum);
-               fcn_first_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
-
-               /* Might want to check that locals are 0 and
-                  context_stack_depth is zero, and complain if not.  */
-
-               depth = 0;
-               new = push_context (depth, fcn_start_addr);
-               fcn_cs_saved.c_name = getsymname (&fcn_sym_saved);
-               new->name =
-                 process_coff_symbol (&fcn_cs_saved, &fcn_aux_saved,
-                                      section_offsets, objfile);
              }
-           else if (STREQ (cs->c_name, ".ef"))
+           if (SDB_TYPE (cs->c_type))
              {
-               /* the value of .ef is the address of epilogue code;
-                  not useful for gdb.  */
-               /* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
-                           contains number of lines to '}' */
-
-               if (context_stack_depth <= 0)
-                 {             /* We attempted to pop an empty context stack */
-                   complain (&ef_stack_complaint, cs->c_symnum);
-                   within_function = 0;
-                   break;
-                 }
+               struct symbol *sym;
+               sym = process_coff_symbol
+                 (cs, &main_aux, objfile);
+               SYMBOL_VALUE (sym) = tmpaddr;
+               SYMBOL_SECTION (sym) = sec;
+             }
+         }
+         break;
 
-               new = pop_context ();
-               /* Stack must be empty now.  */
-               if (context_stack_depth > 0 || new == NULL)
-                 {
-                   complain (&ef_complaint, cs->c_symnum);
-                   within_function = 0;
-                   break;
-                 }
-               if (cs->c_naux != 1)
-                 {
-                   complain (&ef_no_aux_complaint, cs->c_symnum);
-                   fcn_last_line = 0x7FFFFFFF;
-                 }
-               else
-                 {
-                   fcn_last_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
-                 }
+       case C_FCN:
+         if (STREQ (cs->c_name, ".bf"))
+           {
+             within_function = 1;
+
+             /* value contains address of first non-init type code */
+             /* main_aux.x_sym.x_misc.x_lnsz.x_lnno
+                contains line number of '{' } */
+             if (cs->c_naux != 1)
+               complain (&bf_no_aux_complaint, cs->c_symnum);
+             fcn_first_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
+             fcn_first_line_addr = cs->c_value;
+
+             /* Might want to check that locals are 0 and
+                context_stack_depth is zero, and complain if not.  */
+
+             depth = 0;
+             new = push_context (depth, fcn_start_addr);
+             fcn_cs_saved.c_name = getsymname (&fcn_sym_saved);
+             new->name =
+               process_coff_symbol (&fcn_cs_saved, &fcn_aux_saved, objfile);
+           }
+         else if (STREQ (cs->c_name, ".ef"))
+           {
+             /* the value of .ef is the address of epilogue code;
+                not useful for gdb.  */
+             /* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
+                contains number of lines to '}' */
+
+             if (context_stack_depth <= 0)
+               {               /* We attempted to pop an empty context stack */
+                 complain (&ef_stack_complaint, cs->c_symnum);
+                 within_function = 0;
+                 break;
+               }
+
+             new = pop_context ();
+             /* Stack must be empty now.  */
+             if (context_stack_depth > 0 || new == NULL)
+               {
+                 complain (&ef_complaint, cs->c_symnum);
+                 within_function = 0;
+                 break;
+               }
+             if (cs->c_naux != 1)
+               {
+                 complain (&ef_no_aux_complaint, cs->c_symnum);
+                 fcn_last_line = 0x7FFFFFFF;
+               }
+             else
+               {
+                 fcn_last_line = main_aux.x_sym.x_misc.x_lnsz.x_lnno;
+               }
+             /* fcn_first_line is the line number of the opening '{'.
+                Do not record it - because it would affect gdb's idea
+                of the line number of the first statement of the function -
+                except for one-line functions, for which it is also the line
+                number of all the statements and of the closing '}', and
+                for which we do not have any other statement-line-number. */
+             if (fcn_last_line == 1)
+               record_line (current_subfile, fcn_first_line,
+                            fcn_first_line_addr);
+             else
                enter_linenos (fcn_line_ptr, fcn_first_line, fcn_last_line,
-                              section_offsets);
+                              objfile);
 
-               finish_block (new->name, &local_symbols, new->old_blocks,
-                             new->start_addr,
+             finish_block (new->name, &local_symbols, new->old_blocks,
+                           new->start_addr,
 #if defined (FUNCTION_EPILOGUE_SIZE)
-                             /* This macro should be defined only on
-                                machines where the
-                                fcn_aux_saved.x_sym.x_misc.x_fsize
-                                field is always zero.
-                                So use the .bf record information that
-                                points to the epilogue and add the size
-                                of the epilogue.  */
-                             cs->c_value
-                             + FUNCTION_EPILOGUE_SIZE
-                             + ANOFFSET (section_offsets, SECT_OFF_TEXT),
+             /* This macro should be defined only on
+                machines where the
+                fcn_aux_saved.x_sym.x_misc.x_fsize
+                field is always zero.
+                So use the .bf record information that
+                points to the epilogue and add the size
+                of the epilogue.  */
+                           cs->c_value
+                           + FUNCTION_EPILOGUE_SIZE
+                           + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
 #else
-                             fcn_cs_saved.c_value
-                             + fcn_aux_saved.x_sym.x_misc.x_fsize
-                             + ANOFFSET (section_offsets, SECT_OFF_TEXT),
+                           fcn_cs_saved.c_value
+                           + fcn_aux_saved.x_sym.x_misc.x_fsize
+                           + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
 #endif
-                             objfile
-                             );
-               within_function = 0;
-             }
-           break;
+                           objfile
+               );
+             within_function = 0;
+           }
+         break;
 
-         case C_BLOCK:
-           if (STREQ (cs->c_name, ".bb"))
-             {
-               tmpaddr = cs->c_value;
-               tmpaddr += ANOFFSET (section_offsets, SECT_OFF_TEXT);
-               push_context (++depth, tmpaddr);
-             }
-           else if (STREQ (cs->c_name, ".eb"))
-             {
-               if (context_stack_depth <= 0)
-                 {             /* We attempted to pop an empty context stack */
-                   complain (&eb_stack_complaint, cs->c_symnum);
-                   break;
-                 }
+       case C_BLOCK:
+         if (STREQ (cs->c_name, ".bb"))
+           {
+             tmpaddr = cs->c_value;
+             tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+             push_context (++depth, tmpaddr);
+           }
+         else if (STREQ (cs->c_name, ".eb"))
+           {
+             if (context_stack_depth <= 0)
+               {               /* We attempted to pop an empty context stack */
+                 complain (&eb_stack_complaint, cs->c_symnum);
+                 break;
+               }
 
-               new = pop_context ();
-               if (depth-- != new->depth)
-                 {
-                   complain (&eb_complaint, symnum);
-                   break;
-                 }
-               if (local_symbols && context_stack_depth > 0)
-                 {
-                   tmpaddr =
-                     cs->c_value + ANOFFSET (section_offsets, SECT_OFF_TEXT);
-                   /* Make a block for the local symbols within.  */
-                   finish_block (0, &local_symbols, new->old_blocks,
-                                 new->start_addr, tmpaddr, objfile);
-                 }
-               /* Now pop locals of block just finished.  */
-               local_symbols = new->locals;
-             }
-           break;
+             new = pop_context ();
+             if (depth-- != new->depth)
+               {
+                 complain (&eb_complaint, symnum);
+                 break;
+               }
+             if (local_symbols && context_stack_depth > 0)
+               {
+                 tmpaddr =
+                   cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+                 /* Make a block for the local symbols within.  */
+                 finish_block (0, &local_symbols, new->old_blocks,
+                               new->start_addr, tmpaddr, objfile);
+               }
+             /* Now pop locals of block just finished.  */
+             local_symbols = new->locals;
+           }
+         break;
 
-         default:
-           process_coff_symbol (cs, &main_aux, section_offsets, objfile);
-           break;
+       default:
+         process_coff_symbol (cs, &main_aux, objfile);
+         break;
        }
     }
 
@@ -1204,25 +1170,25 @@ coff_symtab_read (symtab_offset, nsyms, section_offsets, objfile)
 
 static void
 read_one_sym (cs, sym, aux)
-    register struct coff_symbol *cs;
-    register struct internal_syment *sym;
-    register union internal_auxent *aux;
+     register struct coff_symbol *cs;
+     register struct internal_syment *sym;
+     register union internal_auxent *aux;
 {
   int i;
 
   cs->c_symnum = symnum;
   bfd_read (temp_sym, local_symesz, 1, nlist_bfd_global);
-  bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *)sym);
+  bfd_coff_swap_sym_in (symfile_bfd, temp_sym, (char *) sym);
   cs->c_naux = sym->n_numaux & 0xff;
   if (cs->c_naux >= 1)
     {
-    bfd_read (temp_aux, local_auxesz, 1, nlist_bfd_global);
-    bfd_coff_swap_aux_in (symfile_bfd, temp_aux, sym->n_type, sym->n_sclass,
-                         0, cs->c_naux, (char *)aux);
-    /* If more than one aux entry, read past it (only the first aux
-       is important). */
-    for (i = 1; i < cs->c_naux; i++)
       bfd_read (temp_aux, local_auxesz, 1, nlist_bfd_global);
+      bfd_coff_swap_aux_in (symfile_bfd, temp_aux, sym->n_type, sym->n_sclass,
+                           0, cs->c_naux, (char *) aux);
+      /* If more than one aux entry, read past it (only the first aux
+         is important). */
+      for (i = 1; i < cs->c_naux; i++)
+       bfd_read (temp_aux, local_auxesz, 1, nlist_bfd_global);
     }
   cs->c_name = getsymname (sym);
   cs->c_value = sym->n_value;
@@ -1234,7 +1200,7 @@ read_one_sym (cs, sym, aux)
 
 #if 0
   if (cs->c_sclass & 128)
-    printf("thumb symbol %s, class 0x%x\n", cs->c_name, cs->c_sclass);
+    printf ("thumb symbol %s, class 0x%x\n", cs->c_name, cs->c_sclass);
 #endif
 
   symnum += 1 + cs->c_naux;
@@ -1274,8 +1240,8 @@ static char *stringtab = NULL;
 
 static int
 init_stringtab (abfd, offset)
-    bfd *abfd;
-    long offset;
+     bfd *abfd;
+     long offset;
 {
   long length;
   int val;
@@ -1291,9 +1257,9 @@ init_stringtab (abfd, offset)
   if (bfd_seek (abfd, offset, 0) < 0)
     return -1;
 
-  val = bfd_read ((char *)lengthbuf, sizeof lengthbuf, 1, abfd);
+  val = bfd_read ((char *) lengthbuf, sizeof lengthbuf, 1, abfd);
   length = bfd_h_get_32 (symfile_bfd, lengthbuf);
-       
+
   /* If no string table is needed, then the file may end immediately
      after the symbols.  Just return with `stringtab' set to null. */
   if (val != sizeof lengthbuf || length < sizeof lengthbuf)
@@ -1303,7 +1269,7 @@ init_stringtab (abfd, offset)
   /* This is in target format (probably not very useful, and not currently
      used), not host format.  */
   memcpy (stringtab, lengthbuf, sizeof lengthbuf);
-  if (length == sizeof length)         /* Empty table -- just the count */
+  if (length == sizeof length) /* Empty table -- just the count */
     return 0;
 
   val = bfd_read (stringtab + sizeof lengthbuf, length - sizeof lengthbuf, 1, abfd);
@@ -1323,15 +1289,15 @@ free_stringtab ()
 
 static char *
 getsymname (symbol_entry)
-    struct internal_syment *symbol_entry;
+     struct internal_syment *symbol_entry;
 {
-  static char buffer[SYMNMLEN+1];
+  static char buffer[SYMNMLEN + 1];
   char *result;
 
   if (symbol_entry->_n._n_n._n_zeroes == 0)
     {
       /* FIXME: Probably should be detecting corrupt symbol files by
-        seeing whether offset points to within the stringtab.  */
+         seeing whether offset points to within the stringtab.  */
       result = stringtab + symbol_entry->_n._n_n._n_offset;
     }
   else
@@ -1349,7 +1315,7 @@ getsymname (symbol_entry)
 
 static char *
 coff_getfilename (aux_entry)
-    union internal_auxent *aux_entry;
+     union internal_auxent *aux_entry;
 {
   static char buffer[BUFSIZ];
   register char *temp;
@@ -1381,26 +1347,26 @@ static unsigned long linetab_size;
 /* Read in all the line numbers for fast lookups later.  Leave them in
    external (unswapped) format in memory; we'll swap them as we enter
    them into GDB's data structures.  */
+
 static int
 init_lineno (abfd, offset, size)
-    bfd *abfd;
-    long offset;
-    int size;
+     bfd *abfd;
+     long offset;
+     int size;
 {
   int val;
 
   linetab_offset = offset;
   linetab_size = size;
 
-  free_linetab();
+  free_linetab ();
 
   if (size == 0)
     return 0;
 
   if (bfd_seek (abfd, offset, 0) < 0)
     return -1;
-  
+
   /* Allocate the desired table, plus a sentinel */
   linetab = (char *) xmalloc (size + local_linesz);
 
@@ -1427,25 +1393,25 @@ free_linetab ()
 #endif
 
 static void
-enter_linenos (file_offset, first_line, last_line, section_offsets)
+enter_linenos (file_offset, first_line, last_line, objfile)
      long file_offset;
      register int first_line;
      register int last_line;
-     struct section_offsets *section_offsets;
+     struct objfile *objfile;
 {
   register char *rawptr;
   struct internal_lineno lptr;
 
   if (!linetab)
-    return ;
+    return;
   if (file_offset < linetab_offset)
     {
       complain (&lineno_complaint, file_offset);
       if (file_offset > linetab_size)  /* Too big to be an offset? */
        return;
-      file_offset += linetab_offset;  /* Try reading at that linetab offset */
+      file_offset += linetab_offset;   /* Try reading at that linetab offset */
     }
-  
+
   rawptr = &linetab[file_offset - linetab_offset];
 
   /* skip first line entry for each function */
@@ -1453,23 +1419,24 @@ enter_linenos (file_offset, first_line, last_line, section_offsets)
   /* line numbers start at one for the first line of the function */
   first_line--;
 
-  for (;;) {
-    bfd_coff_swap_lineno_in (symfile_bfd, rawptr, &lptr);
-    rawptr += local_linesz;
-    /* The next function, or the sentinel, will have L_LNNO32 zero; we exit. */
-    if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
-      coff_record_line (first_line + L_LNNO32 (&lptr),
-                       lptr.l_addr.l_paddr
-                       + ANOFFSET (section_offsets, SECT_OFF_TEXT));
-    else
-      break;
-  } 
+  for (;;)
+    {
+      bfd_coff_swap_lineno_in (symfile_bfd, rawptr, &lptr);
+      rawptr += local_linesz;
+      /* The next function, or the sentinel, will have L_LNNO32 zero; we exit. */
+      if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
+       record_line (current_subfile, first_line + L_LNNO32 (&lptr),
+                    lptr.l_addr.l_paddr
+                    + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT));
+      else
+       break;
+    }
 }
 \f
 static void
 patch_type (type, real_type)
-    struct type *type;
-    struct type *real_type;
+     struct type *type;
+     struct type *real_type;
 {
   register struct type *target = TYPE_TARGET_TYPE (type);
   register struct type *real_target = TYPE_TARGET_TYPE (real_type);
@@ -1499,15 +1466,15 @@ patch_opaque_types (s)
   register struct block *b;
   register int i;
   register struct symbol *real_sym;
-  
+
   /* Go through the per-file symbols only */
   b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
   for (i = BLOCK_NSYMS (b) - 1; i >= 0; i--)
     {
       /* Find completed typedefs to use to fix opaque ones.
-        Remove syms from the chain when their types are stored,
-        but search the whole chain, as there may be several syms
-        from different files with the same name.  */
+         Remove syms from the chain when their types are stored,
+         but search the whole chain, as there may be several syms
+         from different files with the same name.  */
       real_sym = BLOCK_SYM (b, i);
       if (SYMBOL_CLASS (real_sym) == LOC_TYPEDEF &&
          SYMBOL_NAMESPACE (real_sym) == VAR_NAMESPACE &&
@@ -1517,7 +1484,7 @@ patch_opaque_types (s)
          register char *name = SYMBOL_NAME (real_sym);
          register int hash = hashname (name);
          register struct symbol *sym, *prev;
-         
+
          prev = 0;
          for (sym = opaque_type_chain[hash]; sym;)
            {
@@ -1532,9 +1499,9 @@ patch_opaque_types (s)
                    {
                      opaque_type_chain[hash] = SYMBOL_VALUE_CHAIN (sym);
                    }
-                 
+
                  patch_type (SYMBOL_TYPE (sym), SYMBOL_TYPE (real_sym));
-                 
+
                  if (prev)
                    {
                      sym = SYMBOL_VALUE_CHAIN (prev);
@@ -1555,15 +1522,14 @@ patch_opaque_types (s)
 }
 \f
 static struct symbol *
-process_coff_symbol (cs, aux, section_offsets, objfile)
+process_coff_symbol (cs, aux, objfile)
      register struct coff_symbol *cs;
      register union internal_auxent *aux;
-     struct section_offsets *section_offsets;
      struct objfile *objfile;
 {
   register struct symbol *sym
-    = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
-                                      sizeof (struct symbol));
+  = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
+                                    sizeof (struct symbol));
   char *name;
 
   memset (sym, 0, sizeof (struct symbol));
@@ -1581,9 +1547,9 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
 
   if (ISFCN (cs->c_type))
     {
-      SYMBOL_VALUE (sym) += ANOFFSET (section_offsets, SECT_OFF_TEXT);
-       SYMBOL_TYPE(sym) = 
-        lookup_function_type (decode_function_type (cs, cs->c_type, aux));
+      SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+      SYMBOL_TYPE (sym) =
+       lookup_function_type (decode_function_type (cs, cs->c_type, aux));
 
       SYMBOL_CLASS (sym) = LOC_BLOCK;
       if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT
@@ -1598,181 +1564,183 @@ process_coff_symbol (cs, aux, section_offsets, objfile)
       SYMBOL_TYPE (sym) = decode_type (cs, cs->c_type, aux);
       switch (cs->c_sclass)
        {
-         case C_NULL:
-           break;
+       case C_NULL:
+         break;
 
-         case C_AUTO:
-           SYMBOL_CLASS (sym) = LOC_LOCAL;
-           add_symbol_to_list (sym, &local_symbols);
-           break;
+       case C_AUTO:
+         SYMBOL_CLASS (sym) = LOC_LOCAL;
+         add_symbol_to_list (sym, &local_symbols);
+         break;
 
-         case C_THUMBEXT:
-         case C_THUMBEXTFUNC:
-         case C_EXT:
-           SYMBOL_CLASS (sym) = LOC_STATIC;
-           SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
-           SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (section_offsets, SECT_OFF_TEXT);
-           add_symbol_to_list (sym, &global_symbols);
-           break;
+       case C_THUMBEXT:
+       case C_THUMBEXTFUNC:
+       case C_EXT:
+         SYMBOL_CLASS (sym) = LOC_STATIC;
+         SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
+         SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+         add_symbol_to_list (sym, &global_symbols);
+         break;
 
-         case C_THUMBSTAT:
-         case C_THUMBSTATFUNC:
-         case C_STAT:
-           SYMBOL_CLASS (sym) = LOC_STATIC;
-           SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
-           SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (section_offsets, SECT_OFF_TEXT);
-           if (within_function) {
+       case C_THUMBSTAT:
+       case C_THUMBSTATFUNC:
+       case C_STAT:
+         SYMBOL_CLASS (sym) = LOC_STATIC;
+         SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
+         SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+         if (within_function)
+           {
              /* Static symbol of local scope */
              add_symbol_to_list (sym, &local_symbols);
            }
-           else {
+         else
+           {
              /* Static symbol at top level of file */
              add_symbol_to_list (sym, &file_symbols);
            }
-           break;
+         break;
 
 #ifdef C_GLBLREG               /* AMD coff */
-         case C_GLBLREG:
+       case C_GLBLREG:
 #endif
-         case C_REG:
-           SYMBOL_CLASS (sym) = LOC_REGISTER;
-           SYMBOL_VALUE (sym) = SDB_REG_TO_REGNUM(cs->c_value);
-           add_symbol_to_list (sym, &local_symbols);
-           break;
+       case C_REG:
+         SYMBOL_CLASS (sym) = LOC_REGISTER;
+         SYMBOL_VALUE (sym) = SDB_REG_TO_REGNUM (cs->c_value);
+         add_symbol_to_list (sym, &local_symbols);
+         break;
 
-         case C_THUMBLABEL:
-         case C_LABEL:
-           break;
+       case C_THUMBLABEL:
+       case C_LABEL:
+         break;
 
-         case C_ARG:
-           SYMBOL_CLASS (sym) = LOC_ARG;
-           add_symbol_to_list (sym, &local_symbols);
+       case C_ARG:
+         SYMBOL_CLASS (sym) = LOC_ARG;
+         add_symbol_to_list (sym, &local_symbols);
 #if !defined (BELIEVE_PCC_PROMOTION)
-           if (TARGET_BYTE_ORDER == BIG_ENDIAN)
-             {
-               /* If PCC says a parameter is a short or a char,
-                  aligned on an int boundary, realign it to the
-                  "little end" of the int.  */
-               struct type *temptype;
-               temptype = lookup_fundamental_type (current_objfile,
-                                                   FT_INTEGER);
-               if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype)
-                   && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT
-                   && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (temptype))
-                 {
-                   SYMBOL_VALUE (sym) +=
-                     TYPE_LENGTH (temptype)
-                       - TYPE_LENGTH (SYMBOL_TYPE (sym));
-                 }
-             }
+         if (TARGET_BYTE_ORDER == BIG_ENDIAN)
+           {
+             /* If PCC says a parameter is a short or a char,
+                aligned on an int boundary, realign it to the
+                "little end" of the int.  */
+             struct type *temptype;
+             temptype = lookup_fundamental_type (current_objfile,
+                                                 FT_INTEGER);
+             if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype)
+                 && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT
+                 && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (temptype))
+               {
+                 SYMBOL_VALUE (sym) +=
+                   TYPE_LENGTH (temptype)
+                   - TYPE_LENGTH (SYMBOL_TYPE (sym));
+               }
+           }
 #endif
-           break;
+         break;
 
-         case C_REGPARM:
-           SYMBOL_CLASS (sym) = LOC_REGPARM;
-           SYMBOL_VALUE (sym) = SDB_REG_TO_REGNUM(cs->c_value);
-           add_symbol_to_list (sym, &local_symbols);
+       case C_REGPARM:
+         SYMBOL_CLASS (sym) = LOC_REGPARM;
+         SYMBOL_VALUE (sym) = SDB_REG_TO_REGNUM (cs->c_value);
+         add_symbol_to_list (sym, &local_symbols);
 #if !defined (BELIEVE_PCC_PROMOTION)
-           /* FIXME:  This should retain the current type, since it's just
-              a register value.  gnu@adobe, 26Feb93 */
+         /* FIXME:  This should retain the current type, since it's just
+            a register value.  gnu@adobe, 26Feb93 */
+         {
+           /* If PCC says a parameter is a short or a char,
+              it is really an int.  */
+           struct type *temptype;
+           temptype =
+             lookup_fundamental_type (current_objfile, FT_INTEGER);
+           if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype)
+               && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT)
              {
-               /* If PCC says a parameter is a short or a char,
-                  it is really an int.  */
-               struct type *temptype;
-               temptype =
-                 lookup_fundamental_type (current_objfile, FT_INTEGER);
-               if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (temptype)
-                   && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT)
-                 {
-                   SYMBOL_TYPE (sym) =
-                     (TYPE_UNSIGNED (SYMBOL_TYPE (sym))
-                      ? lookup_fundamental_type (current_objfile,
-                                                 FT_UNSIGNED_INTEGER)
-                      : temptype);
-                 }
+               SYMBOL_TYPE (sym) =
+                 (TYPE_UNSIGNED (SYMBOL_TYPE (sym))
+                  ? lookup_fundamental_type (current_objfile,
+                                             FT_UNSIGNED_INTEGER)
+                  : temptype);
              }
+         }
 #endif
-           break;
-           
-         case C_TPDEF:
-           SYMBOL_CLASS (sym) = LOC_TYPEDEF;
-           SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+         break;
 
-           /* If type has no name, give it one */
-           if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
-             {
-               if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
-                   || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
-                 {
-                   /* If we are giving a name to a type such as "pointer to
-                      foo" or "function returning foo", we better not set
-                      the TYPE_NAME.  If the program contains "typedef char
-                      *caddr_t;", we don't want all variables of type char
-                      * to print as caddr_t.  This is not just a
-                      consequence of GDB's type management; CC and GCC (at
-                      least through version 2.4) both output variables of
-                      either type char * or caddr_t with the type
-                      refering to the C_TPDEF symbol for caddr_t.  If a future
-                      compiler cleans this up it GDB is not ready for it
-                      yet, but if it becomes ready we somehow need to
-                      disable this check (without breaking the PCC/GCC2.4
-                      case).
-
-                      Sigh.
-
-                      Fortunately, this check seems not to be necessary
-                      for anything except pointers or functions.  */
-                   ;
-                 }
-               else
-                 TYPE_NAME (SYMBOL_TYPE (sym)) =
-                   concat (SYMBOL_NAME (sym), NULL);
-             }
+       case C_TPDEF:
+         SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+         SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+
+         /* If type has no name, give it one */
+         if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
+           {
+             if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
+                 || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
+               {
+                 /* If we are giving a name to a type such as "pointer to
+                    foo" or "function returning foo", we better not set
+                    the TYPE_NAME.  If the program contains "typedef char
+                    *caddr_t;", we don't want all variables of type char
+                    * to print as caddr_t.  This is not just a
+                    consequence of GDB's type management; CC and GCC (at
+                    least through version 2.4) both output variables of
+                    either type char * or caddr_t with the type
+                    refering to the C_TPDEF symbol for caddr_t.  If a future
+                    compiler cleans this up it GDB is not ready for it
+                    yet, but if it becomes ready we somehow need to
+                    disable this check (without breaking the PCC/GCC2.4
+                    case).
+
+                    Sigh.
+
+                    Fortunately, this check seems not to be necessary
+                    for anything except pointers or functions.  */
+                 ;
+               }
+             else
+               TYPE_NAME (SYMBOL_TYPE (sym)) =
+                 concat (SYMBOL_NAME (sym), NULL);
+           }
 #ifdef CXUX_TARGET
-           /* Ignore vendor section for Harris CX/UX targets. */
-            else if (cs->c_name[0] == '$') 
-             break;
+         /* Ignore vendor section for Harris CX/UX targets. */
+         else if (cs->c_name[0] == '$')
+           break;
 #endif /* CXUX_TARGET */
 
-           /* Keep track of any type which points to empty structured type,
-               so it can be filled from a definition from another file.  A
-               simple forward reference (TYPE_CODE_UNDEF) is not an
-               empty structured type, though; the forward references
-               work themselves out via the magic of coff_lookup_type.  */
-           if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR &&
-               TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) == 0 &&
-               TYPE_CODE   (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) !=
-                                               TYPE_CODE_UNDEF)
-             {
-               register int i = hashname (SYMBOL_NAME (sym));
-
-               SYMBOL_VALUE_CHAIN (sym) = opaque_type_chain[i];
-               opaque_type_chain[i] = sym;
-             }
-           add_symbol_to_list (sym, &file_symbols);
-           break;
+         /* Keep track of any type which points to empty structured type,
+            so it can be filled from a definition from another file.  A
+            simple forward reference (TYPE_CODE_UNDEF) is not an
+            empty structured type, though; the forward references
+            work themselves out via the magic of coff_lookup_type.  */
+         if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR &&
+             TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) == 0 &&
+             TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) !=
+             TYPE_CODE_UNDEF)
+           {
+             register int i = hashname (SYMBOL_NAME (sym));
 
-         case C_STRTAG:
-         case C_UNTAG:
-         case C_ENTAG:
-           SYMBOL_CLASS (sym) = LOC_TYPEDEF;
-           SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
-
-            /* Some compilers try to be helpful by inventing "fake"
-               names for anonymous enums, structures, and unions, like
-               "~0fake" or ".0fake".  Thanks, but no thanks... */
-           if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
-             if (SYMBOL_NAME(sym) != NULL
-                 && *SYMBOL_NAME(sym) != '~'
-                 && *SYMBOL_NAME(sym) != '.')
-               TYPE_TAG_NAME (SYMBOL_TYPE (sym)) =
-                 concat (SYMBOL_NAME (sym), NULL);
+             SYMBOL_VALUE_CHAIN (sym) = opaque_type_chain[i];
+             opaque_type_chain[i] = sym;
+           }
+         add_symbol_to_list (sym, &file_symbols);
+         break;
 
-           add_symbol_to_list (sym, &file_symbols);
-           break;
+       case C_STRTAG:
+       case C_UNTAG:
+       case C_ENTAG:
+         SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+         SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
+
+         /* Some compilers try to be helpful by inventing "fake"
+            names for anonymous enums, structures, and unions, like
+            "~0fake" or ".0fake".  Thanks, but no thanks... */
+         if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
+           if (SYMBOL_NAME (sym) != NULL
+               && *SYMBOL_NAME (sym) != '~'
+               && *SYMBOL_NAME (sym) != '.')
+             TYPE_TAG_NAME (SYMBOL_TYPE (sym)) =
+               concat (SYMBOL_NAME (sym), NULL);
+
+         add_symbol_to_list (sym, &file_symbols);
+         break;
 
-         default:
-           break;
+       default:
+         break;
        }
     }
   return sym;
@@ -1868,7 +1836,7 @@ decode_function_type (cs, c_type, aux)
      register union internal_auxent *aux;
 {
   if (aux->x_sym.x_tagndx.l == 0)
-    cs->c_naux = 0;    /* auxent refers to function, not base type */
+    cs->c_naux = 0;            /* auxent refers to function, not base type */
 
   return decode_type (cs, DECREF (c_type), aux);
 }
@@ -1885,140 +1853,140 @@ decode_base_type (cs, c_type, aux)
 
   switch (c_type)
     {
-      case T_NULL:
-        /* shows up with "void (*foo)();" structure members */
-       return lookup_fundamental_type (current_objfile, FT_VOID);
+    case T_NULL:
+      /* shows up with "void (*foo)();" structure members */
+      return lookup_fundamental_type (current_objfile, FT_VOID);
 
 #if 0
 /* DGUX actually defines both T_ARG and T_VOID to the same value.  */
 #ifdef T_ARG
-      case T_ARG:
-       /* Shows up in DGUX, I think.  Not sure where.  */
-       return lookup_fundamental_type (current_objfile, FT_VOID);      /* shouldn't show up here */
+    case T_ARG:
+      /* Shows up in DGUX, I think.  Not sure where.  */
+      return lookup_fundamental_type (current_objfile, FT_VOID);       /* shouldn't show up here */
 #endif
 #endif /* 0 */
 
 #ifdef T_VOID
-      case T_VOID:
-       /* Intel 960 COFF has this symbol and meaning.  */
-       return lookup_fundamental_type (current_objfile, FT_VOID);
+    case T_VOID:
+      /* Intel 960 COFF has this symbol and meaning.  */
+      return lookup_fundamental_type (current_objfile, FT_VOID);
 #endif
 
-      case T_CHAR:
-       return lookup_fundamental_type (current_objfile, FT_CHAR);
+    case T_CHAR:
+      return lookup_fundamental_type (current_objfile, FT_CHAR);
 
-      case T_SHORT:
-       return lookup_fundamental_type (current_objfile, FT_SHORT);
+    case T_SHORT:
+      return lookup_fundamental_type (current_objfile, FT_SHORT);
 
-      case T_INT:
-       return lookup_fundamental_type (current_objfile, FT_INTEGER);
+    case T_INT:
+      return lookup_fundamental_type (current_objfile, FT_INTEGER);
 
-      case T_LONG:
-       if (cs->c_sclass == C_FIELD
-           && aux->x_sym.x_misc.x_lnsz.x_size > TARGET_LONG_BIT)
-         return lookup_fundamental_type (current_objfile, FT_LONG_LONG);
-       else
-         return lookup_fundamental_type (current_objfile, FT_LONG);
-
-      case T_FLOAT:
-       return lookup_fundamental_type (current_objfile, FT_FLOAT);
+    case T_LONG:
+      if (cs->c_sclass == C_FIELD
+         && aux->x_sym.x_misc.x_lnsz.x_size > TARGET_LONG_BIT)
+       return lookup_fundamental_type (current_objfile, FT_LONG_LONG);
+      else
+       return lookup_fundamental_type (current_objfile, FT_LONG);
 
-      case T_DOUBLE:
-       return lookup_fundamental_type (current_objfile, FT_DBL_PREC_FLOAT);
+    case T_FLOAT:
+      return lookup_fundamental_type (current_objfile, FT_FLOAT);
 
-      case T_LNGDBL:
-       return lookup_fundamental_type (current_objfile, FT_EXT_PREC_FLOAT);
+    case T_DOUBLE:
+      return lookup_fundamental_type (current_objfile, FT_DBL_PREC_FLOAT);
 
-      case T_STRUCT:
-       if (cs->c_naux != 1)
-         {
-           /* anonymous structure type */
-           type = coff_alloc_type (cs->c_symnum);
-           TYPE_CODE (type) = TYPE_CODE_STRUCT;
-           TYPE_NAME (type) = NULL;
-           /* This used to set the tag to "<opaque>".  But I think setting it
-              to NULL is right, and the printing code can print it as
-              "struct {...}".  */
-           TYPE_TAG_NAME (type) = NULL;
-           INIT_CPLUS_SPECIFIC(type);
-           TYPE_LENGTH (type) = 0;
-           TYPE_FIELDS (type) = 0;
-           TYPE_NFIELDS (type) = 0;
-         }
-       else
-         {
-           type = coff_read_struct_type (cs->c_symnum,
-                                   aux->x_sym.x_misc.x_lnsz.x_size,
-                                   aux->x_sym.x_fcnary.x_fcn.x_endndx.l);
-         }
-       return type;
+    case T_LNGDBL:
+      return lookup_fundamental_type (current_objfile, FT_EXT_PREC_FLOAT);
 
-      case T_UNION:
-       if (cs->c_naux != 1)
-         {
-           /* anonymous union type */
-           type = coff_alloc_type (cs->c_symnum);
-           TYPE_NAME (type) = NULL;
-           /* This used to set the tag to "<opaque>".  But I think setting it
-              to NULL is right, and the printing code can print it as
-              "union {...}".  */
-           TYPE_TAG_NAME (type) = NULL;
-           INIT_CPLUS_SPECIFIC(type);
-           TYPE_LENGTH (type) = 0;
-           TYPE_FIELDS (type) = 0;
-           TYPE_NFIELDS (type) = 0;
-         }
-       else
-         {
-           type = coff_read_struct_type (cs->c_symnum,
-                                   aux->x_sym.x_misc.x_lnsz.x_size,
-                                   aux->x_sym.x_fcnary.x_fcn.x_endndx.l);
-         }
-       TYPE_CODE (type) = TYPE_CODE_UNION;
-       return type;
+    case T_STRUCT:
+      if (cs->c_naux != 1)
+       {
+         /* anonymous structure type */
+         type = coff_alloc_type (cs->c_symnum);
+         TYPE_CODE (type) = TYPE_CODE_STRUCT;
+         TYPE_NAME (type) = NULL;
+         /* This used to set the tag to "<opaque>".  But I think setting it
+            to NULL is right, and the printing code can print it as
+            "struct {...}".  */
+         TYPE_TAG_NAME (type) = NULL;
+         INIT_CPLUS_SPECIFIC (type);
+         TYPE_LENGTH (type) = 0;
+         TYPE_FIELDS (type) = 0;
+         TYPE_NFIELDS (type) = 0;
+       }
+      else
+       {
+         type = coff_read_struct_type (cs->c_symnum,
+                                       aux->x_sym.x_misc.x_lnsz.x_size,
+                                     aux->x_sym.x_fcnary.x_fcn.x_endndx.l);
+       }
+      return type;
 
-      case T_ENUM:
-       if (cs->c_naux != 1)
-         {
-           /* anonymous enum type */
-           type = coff_alloc_type (cs->c_symnum);
-           TYPE_CODE (type) = TYPE_CODE_ENUM;
-           TYPE_NAME (type) = NULL;
-           /* This used to set the tag to "<opaque>".  But I think setting it
-              to NULL is right, and the printing code can print it as
-              "enum {...}".  */
-           TYPE_TAG_NAME (type) = NULL;
-           TYPE_LENGTH (type) = 0;
-           TYPE_FIELDS (type) = 0;
-           TYPE_NFIELDS(type) = 0;
-         }
-       else
-         {
-           type = coff_read_enum_type (cs->c_symnum,
+    case T_UNION:
+      if (cs->c_naux != 1)
+       {
+         /* anonymous union type */
+         type = coff_alloc_type (cs->c_symnum);
+         TYPE_NAME (type) = NULL;
+         /* This used to set the tag to "<opaque>".  But I think setting it
+            to NULL is right, and the printing code can print it as
+            "union {...}".  */
+         TYPE_TAG_NAME (type) = NULL;
+         INIT_CPLUS_SPECIFIC (type);
+         TYPE_LENGTH (type) = 0;
+         TYPE_FIELDS (type) = 0;
+         TYPE_NFIELDS (type) = 0;
+       }
+      else
+       {
+         type = coff_read_struct_type (cs->c_symnum,
                                        aux->x_sym.x_misc.x_lnsz.x_size,
-                                       aux->x_sym.x_fcnary.x_fcn.x_endndx.l);
-         }
-       return type;
+                                     aux->x_sym.x_fcnary.x_fcn.x_endndx.l);
+       }
+      TYPE_CODE (type) = TYPE_CODE_UNION;
+      return type;
 
-      case T_MOE:
-       /* shouldn't show up here */
-       break;
+    case T_ENUM:
+      if (cs->c_naux != 1)
+       {
+         /* anonymous enum type */
+         type = coff_alloc_type (cs->c_symnum);
+         TYPE_CODE (type) = TYPE_CODE_ENUM;
+         TYPE_NAME (type) = NULL;
+         /* This used to set the tag to "<opaque>".  But I think setting it
+            to NULL is right, and the printing code can print it as
+            "enum {...}".  */
+         TYPE_TAG_NAME (type) = NULL;
+         TYPE_LENGTH (type) = 0;
+         TYPE_FIELDS (type) = 0;
+         TYPE_NFIELDS (type) = 0;
+       }
+      else
+       {
+         type = coff_read_enum_type (cs->c_symnum,
+                                     aux->x_sym.x_misc.x_lnsz.x_size,
+                                     aux->x_sym.x_fcnary.x_fcn.x_endndx.l);
+       }
+      return type;
 
-      case T_UCHAR:
-       return lookup_fundamental_type (current_objfile, FT_UNSIGNED_CHAR);
+    case T_MOE:
+      /* shouldn't show up here */
+      break;
+
+    case T_UCHAR:
+      return lookup_fundamental_type (current_objfile, FT_UNSIGNED_CHAR);
 
-      case T_USHORT:
-       return lookup_fundamental_type (current_objfile, FT_UNSIGNED_SHORT);
+    case T_USHORT:
+      return lookup_fundamental_type (current_objfile, FT_UNSIGNED_SHORT);
 
-      case T_UINT:
-       return lookup_fundamental_type (current_objfile, FT_UNSIGNED_INTEGER);
+    case T_UINT:
+      return lookup_fundamental_type (current_objfile, FT_UNSIGNED_INTEGER);
 
-      case T_ULONG:
-       if (cs->c_sclass == C_FIELD
-           && aux->x_sym.x_misc.x_lnsz.x_size > TARGET_LONG_BIT)
-         return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG_LONG);
-       else
-         return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG);
+    case T_ULONG:
+      if (cs->c_sclass == C_FIELD
+         && aux->x_sym.x_misc.x_lnsz.x_size > TARGET_LONG_BIT)
+       return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG_LONG);
+      else
+       return lookup_fundamental_type (current_objfile, FT_UNSIGNED_LONG);
     }
   complain (&unexpected_type_complaint, cs->c_name);
   return lookup_fundamental_type (current_objfile, FT_VOID);
@@ -2055,7 +2023,7 @@ coff_read_struct_type (index, length, lastsym)
 
   type = coff_alloc_type (index);
   TYPE_CODE (type) = TYPE_CODE_STRUCT;
-  INIT_CPLUS_SPECIFIC(type);
+  INIT_CPLUS_SPECIFIC (type);
   TYPE_LENGTH (type) = length;
 
   while (!done && symnum < lastsym && symnum < nlist_nsyms_global)
@@ -2066,46 +2034,46 @@ coff_read_struct_type (index, length, lastsym)
 
       switch (ms->c_sclass)
        {
-         case C_MOS:
-         case C_MOU:
-
-           /* Get space to record the next field's data.  */
-           new = (struct nextfield *) alloca (sizeof (struct nextfield));
-           new->next = list;
-           list = new;
-
-           /* Save the data.  */
-           list->field.name =
-             obsavestring (name,
-                           strlen (name),
-                           &current_objfile->symbol_obstack);
-           FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
-           FIELD_BITPOS (list->field) = 8 * ms->c_value;
-           FIELD_BITSIZE (list->field) = 0;
-           nfields++;
-           break;
+       case C_MOS:
+       case C_MOU:
+
+         /* Get space to record the next field's data.  */
+         new = (struct nextfield *) alloca (sizeof (struct nextfield));
+         new->next = list;
+         list = new;
+
+         /* Save the data.  */
+         list->field.name =
+           obsavestring (name,
+                         strlen (name),
+                         &current_objfile->symbol_obstack);
+         FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
+         FIELD_BITPOS (list->field) = 8 * ms->c_value;
+         FIELD_BITSIZE (list->field) = 0;
+         nfields++;
+         break;
 
-         case C_FIELD:
-
-           /* Get space to record the next field's data.  */
-           new = (struct nextfield *) alloca (sizeof (struct nextfield));
-           new->next = list;
-           list = new;
-
-           /* Save the data.  */
-           list->field.name =
-             obsavestring (name,
-                           strlen (name),
-                           &current_objfile->symbol_obstack);
-           FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
-           FIELD_BITPOS (list->field) = ms->c_value;
-           FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
-           nfields++;
-           break;
+       case C_FIELD:
+
+         /* Get space to record the next field's data.  */
+         new = (struct nextfield *) alloca (sizeof (struct nextfield));
+         new->next = list;
+         list = new;
+
+         /* Save the data.  */
+         list->field.name =
+           obsavestring (name,
+                         strlen (name),
+                         &current_objfile->symbol_obstack);
+         FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux);
+         FIELD_BITPOS (list->field) = ms->c_value;
+         FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size;
+         nfields++;
+         break;
 
-         case C_EOS:
-           done = 1;
-           break;
+       case C_EOS:
+         done = 1;
+         break;
        }
     }
   /* Now create the vector of fields, and record how big it is.  */
@@ -2164,28 +2132,28 @@ coff_read_enum_type (index, length, lastsym)
 
       switch (ms->c_sclass)
        {
-         case C_MOE:
-           sym = (struct symbol *) obstack_alloc
-             (&current_objfile->symbol_obstack,
-              sizeof (struct symbol));
-           memset (sym, 0, sizeof (struct symbol));
-
-           SYMBOL_NAME (sym) =
-             obsavestring (name, strlen (name),
-                           &current_objfile->symbol_obstack);
-           SYMBOL_CLASS (sym) = LOC_CONST;
-           SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
-           SYMBOL_VALUE (sym) = ms->c_value;
-           add_symbol_to_list (sym, symlist);
-           nsyms++;
-           break;
+       case C_MOE:
+         sym = (struct symbol *) obstack_alloc
+           (&current_objfile->symbol_obstack,
+            sizeof (struct symbol));
+         memset (sym, 0, sizeof (struct symbol));
+
+         SYMBOL_NAME (sym) =
+           obsavestring (name, strlen (name),
+                         &current_objfile->symbol_obstack);
+         SYMBOL_CLASS (sym) = LOC_CONST;
+         SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
+         SYMBOL_VALUE (sym) = ms->c_value;
+         add_symbol_to_list (sym, symlist);
+         nsyms++;
+         break;
 
-         case C_EOS:
-           /* Sometimes the linker (on 386/ix 2.0.2 at least) screws
-              up the count of how many symbols to read.  So stop
-              on .eos.  */
-           done = 1;
-           break;
+       case C_EOS:
+         /* Sometimes the linker (on 386/ix 2.0.2 at least) screws
+            up the count of how many symbols to read.  So stop
+            on .eos.  */
+         done = 1;
+         break;
        }
     }
 
@@ -2194,7 +2162,7 @@ coff_read_enum_type (index, length, lastsym)
   if (length > 0)
     TYPE_LENGTH (type) = length;
   else
-    TYPE_LENGTH (type) = TARGET_INT_BIT / TARGET_CHAR_BIT; /* Assume ints */
+    TYPE_LENGTH (type) = TARGET_INT_BIT / TARGET_CHAR_BIT;     /* Assume ints */
   TYPE_CODE (type) = TYPE_CODE_ENUM;
   TYPE_NFIELDS (type) = nsyms;
   TYPE_FIELDS (type) = (struct field *)
@@ -2214,7 +2182,7 @@ coff_read_enum_type (index, length, lastsym)
 
       if (syms == osyms)
        j = o_nsyms;
-      for (; j < syms->nsyms; j++,n++)
+      for (; j < syms->nsyms; j++, n++)
        {
          struct symbol *xsym = syms->symbol[j];
          SYMBOL_TYPE (xsym) = type;
@@ -2239,13 +2207,12 @@ coff_read_enum_type (index, length, lastsym)
 static struct sym_fns coff_sym_fns =
 {
   bfd_target_coff_flavour,
-  coff_new_init,       /* sym_new_init: init anything gbl to entire symtab */
-  coff_symfile_init,   /* sym_init: read initial info, setup for sym_read() */
-  coff_symfile_read,   /* sym_read: read a symbol file into symtab */
-  coff_symfile_finish, /* sym_finish: finished with file, cleanup */
-  default_symfile_offsets,
-                       /* sym_offsets:  xlate external to internal form */
-  NULL                 /* next: pointer to next struct sym_fns */
+  coff_new_init,               /* sym_new_init: init anything gbl to entire symtab */
+  coff_symfile_init,           /* sym_init: read initial info, setup for sym_read() */
+  coff_symfile_read,           /* sym_read: read a symbol file into symtab */
+  coff_symfile_finish,         /* sym_finish: finished with file, cleanup */
+  default_symfile_offsets,     /* sym_offsets:  xlate external to internal form */
+  NULL                         /* next: pointer to next struct sym_fns */
 };
 
 void
index 4ee66d5..53d92ec 100644 (file)
@@ -1,23 +1,24 @@
 /* Fortran language support routines for GDB, the GNU debugger.
-   Copyright 1993, 1994, 1996 Free Software Foundation, Inc.
+   Copyright 1993, 1994, 1996, 2000 Free Software Foundation, Inc.
    Contributed by Motorola.  Adapted from the C parser by Farooq Butt
    (fmbutt@engage.sps.mot.com).
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "gdb_string.h"
@@ -27,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "parser-defs.h"
 #include "language.h"
 #include "f-lang.h"
+#include "valprint.h"
 
 /* The built-in types of F77.  FIXME: integer*4 is missing, plain
    logical is missing (builtin_type_logical is logical*4).  */
@@ -35,7 +37,7 @@ struct type *builtin_type_f_character;
 struct type *builtin_type_f_logical;
 struct type *builtin_type_f_logical_s1;
 struct type *builtin_type_f_logical_s2;
-struct type *builtin_type_f_integer; 
+struct type *builtin_type_f_integer;
 struct type *builtin_type_f_integer_s2;
 struct type *builtin_type_f_real;
 struct type *builtin_type_f_real_s8;
@@ -48,24 +50,25 @@ struct type *builtin_type_f_void;
 /* Following is dubious stuff that had been in the xcoff reader. */
 
 struct saved_fcn
-{
-  long                         line_offset;  /* Line offset for function */ 
-  struct saved_fcn             *next;      
-}; 
+  {
+    long line_offset;          /* Line offset for function */
+    struct saved_fcn *next;
+  };
 
 
-struct saved_bf_symnum 
-{
-  long       symnum_fcn;  /* Symnum of function (i.e. .function directive) */
-  long       symnum_bf;   /* Symnum of .bf for this function */ 
-  struct saved_bf_symnum *next;  
-}; 
+struct saved_bf_symnum
+  {
+    long symnum_fcn;           /* Symnum of function (i.e. .function directive) */
+    long symnum_bf;            /* Symnum of .bf for this function */
+    struct saved_bf_symnum *next;
+  };
 
-typedef struct saved_fcn           SAVED_FUNCTION, *SAVED_FUNCTION_PTR; 
-typedef struct saved_bf_symnum     SAVED_BF, *SAVED_BF_PTR; 
+typedef struct saved_fcn SAVED_FUNCTION, *SAVED_FUNCTION_PTR;
+typedef struct saved_bf_symnum SAVED_BF, *SAVED_BF_PTR;
 
 /* Local functions */
 
+extern void _initialize_f_language PARAMS ((void));
 #if 0
 static void clear_function_list PARAMS ((void));
 static long get_bf_for_fcn PARAMS ((long));
@@ -82,9 +85,11 @@ static void patch_common_entries PARAMS ((SAVED_F77_COMMON_PTR, CORE_ADDR, int))
 #endif
 
 static struct type *f_create_fundamental_type PARAMS ((struct objfile *, int));
-static void f_printstr PARAMS ((GDB_FILE *stream, char *string, unsigned int length, int width, int force_ellipses));
-static void f_printchar PARAMS ((int c, GDB_FILE *stream));
-static void f_emit_char PARAMS ((int c, GDB_FILE *stream, int quoter));
+static void f_printstr (struct ui_file * stream, char *string,
+                       unsigned int length, int width,
+                       int force_ellipses);
+static void f_printchar (int c, struct ui_file * stream);
+static void f_emit_char (int c, struct ui_file * stream, int quoter);
 
 /* Print the character C on STREAM as part of the contents of a literal
    string whose delimiter is QUOTER.  Note that that format for printing
@@ -95,11 +100,11 @@ static void f_emit_char PARAMS ((int c, GDB_FILE *stream, int quoter));
 static void
 f_emit_char (c, stream, quoter)
      register int c;
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int quoter;
 {
   c &= 0xFF;                   /* Avoid sign bit follies */
-  
+
   if (PRINT_LITERAL_FORM (c))
     {
       if (c == '\\' || c == quoter)
@@ -144,7 +149,7 @@ f_emit_char (c, stream, quoter)
 static void
 f_printchar (c, stream)
      int c;
-     GDB_FILE *stream;
+     struct ui_file *stream;
 {
   fputs_filtered ("'", stream);
   LA_EMIT_CHAR (c, stream, '\'');
@@ -160,7 +165,7 @@ f_printchar (c, stream)
 
 static void
 f_printstr (stream, string, length, width, force_ellipses)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      char *string;
      unsigned int length;
      int width;
@@ -171,31 +176,29 @@ f_printstr (stream, string, length, width, force_ellipses)
   int in_quotes = 0;
   int need_comma = 0;
   extern int inspect_it;
-  extern int repeat_count_threshold;
-  extern int print_max;
-  
+
   if (length == 0)
     {
       fputs_filtered ("''", gdb_stdout);
       return;
     }
-  
+
   for (i = 0; i < length && things_printed < print_max; ++i)
     {
       /* Position of the character we are examining
-        to see whether it is repeated.  */
+         to see whether it is repeated.  */
       unsigned int rep1;
       /* Number of repetitions we have detected so far.  */
       unsigned int reps;
-      
+
       QUIT;
-      
+
       if (need_comma)
        {
          fputs_filtered (", ", stream);
          need_comma = 0;
        }
-      
+
       rep1 = i + 1;
       reps = 1;
       while (rep1 < length && string[rep1] == string[i])
@@ -203,7 +206,7 @@ f_printstr (stream, string, length, width, force_ellipses)
          ++rep1;
          ++reps;
        }
-      
+
       if (reps > repeat_count_threshold)
        {
          if (in_quotes)
@@ -234,7 +237,7 @@ f_printstr (stream, string, length, width, force_ellipses)
          ++things_printed;
        }
     }
-  
+
   /* Terminate the quotes if necessary.  */
   if (in_quotes)
     {
@@ -243,7 +246,7 @@ f_printstr (stream, string, length, width, force_ellipses)
       else
        fputs_filtered ("'", stream);
     }
-  
+
   if (force_ellipses || i < length)
     fputs_filtered ("...", stream);
 }
@@ -258,7 +261,7 @@ f_create_fundamental_type (objfile, typeid)
      int typeid;
 {
   register struct type *type = NULL;
-  
+
   switch (typeid)
     {
     case FT_VOID:
@@ -314,10 +317,10 @@ f_create_fundamental_type (objfile, typeid)
     case FT_SIGNED_INTEGER:
       type = init_type (TYPE_CODE_INT,
                        TARGET_INT_BIT / TARGET_CHAR_BIT,
-                       0, "integer", objfile); /* FIXME -fnf */
+                       0, "integer", objfile);         /* FIXME -fnf */
       break;
     case FT_UNSIGNED_INTEGER:
-      type = init_type (TYPE_CODE_BOOL, 
+      type = init_type (TYPE_CODE_BOOL,
                        TARGET_INT_BIT / TARGET_CHAR_BIT,
                        TYPE_FLAG_UNSIGNED, "logical*4", objfile);
       break;
@@ -334,7 +337,7 @@ f_create_fundamental_type (objfile, typeid)
     case FT_SIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
                        TARGET_LONG_BIT / TARGET_CHAR_BIT,
-                       0, "long", objfile); /* FIXME -fnf */
+                       0, "long", objfile);    /* FIXME -fnf */
       break;
     case FT_UNSIGNED_LONG:
       type = init_type (TYPE_CODE_INT,
@@ -396,9 +399,9 @@ f_create_fundamental_type (objfile, typeid)
       break;
     default:
       /* FIXME:  For now, if we are asked to produce a type not in this
-        language, create the equivalent of a C integer type with the
-        name "<?type?>".  When all the dust settles from the type
-        reconstruction work, this should probably become an error. */
+         language, create the equivalent of a C integer type with the
+         name "<?type?>".  When all the dust settles from the type
+         reconstruction work, this should probably become an error. */
       type = init_type (TYPE_CODE_INT,
                        TARGET_INT_BIT / TARGET_CHAR_BIT,
                        0, "<?type?>", objfile);
@@ -407,60 +410,62 @@ f_create_fundamental_type (objfile, typeid)
     }
   return (type);
 }
-
 \f
+
 /* Table of operators and their precedences for printing expressions.  */
 
-static const struct op_print f_op_print_tab[] = {
-  { "+",     BINOP_ADD, PREC_ADD, 0 },
-  { "+",     UNOP_PLUS, PREC_PREFIX, 0 },
-  { "-",     BINOP_SUB, PREC_ADD, 0 },
-  { "-",     UNOP_NEG, PREC_PREFIX, 0 },
-  { "*",     BINOP_MUL, PREC_MUL, 0 },
-  { "/",     BINOP_DIV, PREC_MUL, 0 },
-  { "DIV",   BINOP_INTDIV, PREC_MUL, 0 },
-  { "MOD",   BINOP_REM, PREC_MUL, 0 },
-  { "=",     BINOP_ASSIGN, PREC_ASSIGN, 1 },
-  { ".OR.",  BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0 },
-  { ".AND.", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0 },
-  { ".NOT.", UNOP_LOGICAL_NOT, PREC_PREFIX, 0 },
-  { ".EQ.",  BINOP_EQUAL, PREC_EQUAL, 0 },
-  { ".NE.",  BINOP_NOTEQUAL, PREC_EQUAL, 0 },
-  { ".LE.",  BINOP_LEQ, PREC_ORDER, 0 },
-  { ".GE.",  BINOP_GEQ, PREC_ORDER, 0 },
-  { ".GT.",  BINOP_GTR, PREC_ORDER, 0 },
-  { ".LT.",  BINOP_LESS, PREC_ORDER, 0 },
-  { "**",    UNOP_IND, PREC_PREFIX, 0 },
-  { "@",     BINOP_REPEAT, PREC_REPEAT, 0 },
-  { NULL,    0, 0, 0 }
+static const struct op_print f_op_print_tab[] =
+{
+  {"+", BINOP_ADD, PREC_ADD, 0},
+  {"+", UNOP_PLUS, PREC_PREFIX, 0},
+  {"-", BINOP_SUB, PREC_ADD, 0},
+  {"-", UNOP_NEG, PREC_PREFIX, 0},
+  {"*", BINOP_MUL, PREC_MUL, 0},
+  {"/", BINOP_DIV, PREC_MUL, 0},
+  {"DIV", BINOP_INTDIV, PREC_MUL, 0},
+  {"MOD", BINOP_REM, PREC_MUL, 0},
+  {"=", BINOP_ASSIGN, PREC_ASSIGN, 1},
+  {".OR.", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
+  {".AND.", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
+  {".NOT.", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
+  {".EQ.", BINOP_EQUAL, PREC_EQUAL, 0},
+  {".NE.", BINOP_NOTEQUAL, PREC_EQUAL, 0},
+  {".LE.", BINOP_LEQ, PREC_ORDER, 0},
+  {".GE.", BINOP_GEQ, PREC_ORDER, 0},
+  {".GT.", BINOP_GTR, PREC_ORDER, 0},
+  {".LT.", BINOP_LESS, PREC_ORDER, 0},
+  {"**", UNOP_IND, PREC_PREFIX, 0},
+  {"@", BINOP_REPEAT, PREC_REPEAT, 0},
+  {NULL, 0, 0, 0}
 };
 \f
-struct type ** CONST_PTR (f_builtin_types[]) = 
+struct type **CONST_PTR (f_builtin_types[]) =
 {
   &builtin_type_f_character,
-  &builtin_type_f_logical,
-  &builtin_type_f_logical_s1,
-  &builtin_type_f_logical_s2,
-  &builtin_type_f_integer,
-  &builtin_type_f_integer_s2,
-  &builtin_type_f_real,
-  &builtin_type_f_real_s8,
-  &builtin_type_f_real_s16,
-  &builtin_type_f_complex_s8,
-  &builtin_type_f_complex_s16,
+    &builtin_type_f_logical,
+    &builtin_type_f_logical_s1,
+    &builtin_type_f_logical_s2,
+    &builtin_type_f_integer,
+    &builtin_type_f_integer_s2,
+    &builtin_type_f_real,
+    &builtin_type_f_real_s8,
+    &builtin_type_f_real_s16,
+    &builtin_type_f_complex_s8,
+    &builtin_type_f_complex_s16,
 #if 0
-  &builtin_type_f_complex_s32,
+    &builtin_type_f_complex_s32,
 #endif
-  &builtin_type_f_void,
-  0
+    &builtin_type_f_void,
+    0
 };
 
 /* This is declared in c-lang.h but it is silly to import that file for what
    is already just a hack. */
-extern int
-c_value_print PARAMS ((struct value *, GDB_FILE *, int, enum val_prettyprint));
+extern int c_value_print (struct value *, struct ui_file *, int,
+                         enum val_prettyprint);
 
-const struct language_defn f_language_defn = {
+const struct language_defn f_language_defn =
+{
   "fortran",
   language_fortran,
   f_builtin_types,
@@ -473,19 +478,19 @@ const struct language_defn f_language_defn = {
   f_printstr,                  /* function to print string constant */
   f_emit_char,                 /* Function to print a single character */
   f_create_fundamental_type,   /* Create fundamental type in this language */
-  f_print_type,                        /* Print a type using appropriate syntax */
+  f_print_type,                        /* Print a type using appropriate syntax */
   f_val_print,                 /* Print a value using appropriate syntax */
-  c_value_print,  /* FIXME */
-  {"",      "",   "",   ""},   /* Binary format info */
-  {"0%o",  "0",   "o", ""},    /* Octal format info */
-  {"%d",   "",    "d", ""},    /* Decimal format info */
-  {"0x%x", "0x",  "x", ""},    /* Hex format info */
+  c_value_print,               /* FIXME */
+  {"", "", "", ""},            /* Binary format info */
+  {"0%o", "0", "o", ""},       /* Octal format info */
+  {"%d", "", "d", ""},         /* Decimal format info */
+  {"0x%x", "0x", "x", ""},     /* Hex format info */
   f_op_print_tab,              /* expression operators for printing */
   0,                           /* arrays are first-class (not c-style) */
   1,                           /* String lower bound */
-  &builtin_type_f_character,   /* Type of string elements */ 
+  &builtin_type_f_character,   /* Type of string elements */
   LANG_MAGIC
-  };
+};
 
 void
 _initialize_f_language ()
@@ -494,68 +499,68 @@ _initialize_f_language ()
     init_type (TYPE_CODE_VOID, 1,
               0,
               "VOID", (struct objfile *) NULL);
-  
+
   builtin_type_f_character =
     init_type (TYPE_CODE_INT, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
               0,
               "character", (struct objfile *) NULL);
-  
+
   builtin_type_f_logical_s1 =
     init_type (TYPE_CODE_BOOL, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
               TYPE_FLAG_UNSIGNED,
               "logical*1", (struct objfile *) NULL);
-  
+
   builtin_type_f_integer_s2 =
     init_type (TYPE_CODE_INT, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
               0,
               "integer*2", (struct objfile *) NULL);
-  
+
   builtin_type_f_logical_s2 =
     init_type (TYPE_CODE_BOOL, TARGET_SHORT_BIT / TARGET_CHAR_BIT,
               TYPE_FLAG_UNSIGNED,
               "logical*2", (struct objfile *) NULL);
-  
+
   builtin_type_f_integer =
     init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
               0,
               "integer", (struct objfile *) NULL);
-  
+
   builtin_type_f_logical =
     init_type (TYPE_CODE_BOOL, TARGET_INT_BIT / TARGET_CHAR_BIT,
               TYPE_FLAG_UNSIGNED,
               "logical*4", (struct objfile *) NULL);
-  
+
   builtin_type_f_real =
     init_type (TYPE_CODE_FLT, TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
               0,
               "real", (struct objfile *) NULL);
-  
+
   builtin_type_f_real_s8 =
     init_type (TYPE_CODE_FLT, TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
               0,
               "real*8", (struct objfile *) NULL);
-  
+
   builtin_type_f_real_s16 =
     init_type (TYPE_CODE_FLT, TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
               0,
               "real*16", (struct objfile *) NULL);
-  
+
   builtin_type_f_complex_s8 =
     init_type (TYPE_CODE_COMPLEX, 2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
               0,
               "complex*8", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_f_complex_s8) = builtin_type_f_real;
-  
+
   builtin_type_f_complex_s16 =
     init_type (TYPE_CODE_COMPLEX, 2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
               0,
               "complex*16", (struct objfile *) NULL);
   TYPE_TARGET_TYPE (builtin_type_f_complex_s16) = builtin_type_f_real_s8;
-  
+
   /* We have a new size == 4 double floats for the
      complex*32 data type */
-  
-  builtin_type_f_complex_s32 = 
+
+  builtin_type_f_complex_s32 =
     init_type (TYPE_CODE_COMPLEX, 2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
               0,
               "complex*32", (struct objfile *) NULL);
@@ -564,215 +569,218 @@ _initialize_f_language ()
   builtin_type_string =
     init_type (TYPE_CODE_STRING, TARGET_CHAR_BIT / TARGET_CHAR_BIT,
               0,
-              "character string", (struct objfile *) NULL); 
-  
+              "character string", (struct objfile *) NULL);
+
   add_language (&f_language_defn);
 }
 
 #if 0
 static SAVED_BF_PTR
-allocate_saved_bf_node()
+allocate_saved_bf_node ()
 {
   SAVED_BF_PTR new;
-  
+
   new = (SAVED_BF_PTR) xmalloc (sizeof (SAVED_BF));
-  return(new);
+  return (new);
 }
 
 static SAVED_FUNCTION *
-allocate_saved_function_node()
+allocate_saved_function_node ()
 {
   SAVED_FUNCTION *new;
-  
+
   new = (SAVED_FUNCTION *) xmalloc (sizeof (SAVED_FUNCTION));
-  return(new);
+  return (new);
 }
 
-static SAVED_F77_COMMON_PTR allocate_saved_f77_common_node()
+static SAVED_F77_COMMON_PTR
+allocate_saved_f77_common_node ()
 {
   SAVED_F77_COMMON_PTR new;
-  
+
   new = (SAVED_F77_COMMON_PTR) xmalloc (sizeof (SAVED_F77_COMMON));
-  return(new);
+  return (new);
 }
 
-static COMMON_ENTRY_PTR allocate_common_entry_node()
+static COMMON_ENTRY_PTR
+allocate_common_entry_node ()
 {
   COMMON_ENTRY_PTR new;
-  
+
   new = (COMMON_ENTRY_PTR) xmalloc (sizeof (COMMON_ENTRY));
-  return(new);
+  return (new);
 }
 #endif
 
-SAVED_F77_COMMON_PTR head_common_list=NULL;     /* Ptr to 1st saved COMMON  */
-SAVED_F77_COMMON_PTR tail_common_list=NULL;     /* Ptr to last saved COMMON  */
-SAVED_F77_COMMON_PTR current_common=NULL;       /* Ptr to current COMMON */
+SAVED_F77_COMMON_PTR head_common_list = NULL;  /* Ptr to 1st saved COMMON  */
+SAVED_F77_COMMON_PTR tail_common_list = NULL;  /* Ptr to last saved COMMON  */
+SAVED_F77_COMMON_PTR current_common = NULL;    /* Ptr to current COMMON */
 
 #if 0
-static SAVED_BF_PTR saved_bf_list=NULL;          /* Ptr to (.bf,function) 
-                                                    list*/
-static SAVED_BF_PTR saved_bf_list_end=NULL;      /* Ptr to above list's end */
-static SAVED_BF_PTR current_head_bf_list=NULL;   /* Current head of above list
-                                                 */
+static SAVED_BF_PTR saved_bf_list = NULL;      /* Ptr to (.bf,function) 
+                                                  list */
+static SAVED_BF_PTR saved_bf_list_end = NULL;  /* Ptr to above list's end */
+static SAVED_BF_PTR current_head_bf_list = NULL;       /* Current head of above list
+                                                        */
 
-static SAVED_BF_PTR tmp_bf_ptr;                  /* Generic temporary for use 
-                                                    in macros */ 
+static SAVED_BF_PTR tmp_bf_ptr;        /* Generic temporary for use 
+                                  in macros */
 
 /* The following function simply enters a given common block onto 
    the global common block chain */
 
 static void
-add_common_block(name,offset,secnum,func_stab)
+add_common_block (name, offset, secnum, func_stab)
      char *name;
      CORE_ADDR offset;
      int secnum;
      char *func_stab;
 {
   SAVED_F77_COMMON_PTR tmp;
-  char *c,*local_copy_func_stab; 
-  
+  char *c, *local_copy_func_stab;
+
   /* If the COMMON block we are trying to add has a blank 
      name (i.e. "#BLNK_COM") then we set it to __BLANK
      because the darn "#" character makes GDB's input 
-     parser have fits. */ 
-  
-  
-  if (STREQ(name,BLANK_COMMON_NAME_ORIGINAL) ||
-      STREQ(name,BLANK_COMMON_NAME_MF77))
+     parser have fits. */
+
+
+  if (STREQ (name, BLANK_COMMON_NAME_ORIGINAL) ||
+      STREQ (name, BLANK_COMMON_NAME_MF77))
     {
-      
-      free(name);
-      name = alloca(strlen(BLANK_COMMON_NAME_LOCAL) + 1); 
-      strcpy(name,BLANK_COMMON_NAME_LOCAL); 
+
+      free (name);
+      name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
+      strcpy (name, BLANK_COMMON_NAME_LOCAL);
     }
-  
-  tmp = allocate_saved_f77_common_node();
-  
-  local_copy_func_stab = xmalloc (strlen(func_stab) + 1);
-  strcpy(local_copy_func_stab,func_stab); 
-  
-  tmp->name = xmalloc(strlen(name) + 1);
-  
+
+  tmp = allocate_saved_f77_common_node ();
+
+  local_copy_func_stab = xmalloc (strlen (func_stab) + 1);
+  strcpy (local_copy_func_stab, func_stab);
+
+  tmp->name = xmalloc (strlen (name) + 1);
+
   /* local_copy_func_stab is a stabstring, let us first extract the 
-     function name from the stab by NULLing out the ':' character. */ 
-  
-  
-  c = NULL; 
-  c = strchr(local_copy_func_stab,':');
-  
+     function name from the stab by NULLing out the ':' character. */
+
+
+  c = NULL;
+  c = strchr (local_copy_func_stab, ':');
+
   if (c)
     *c = '\0';
   else
-    error("Malformed function STAB found in add_common_block()");
-  
-  
-  tmp->owning_function = xmalloc (strlen(local_copy_func_stab) + 1); 
-  
-  strcpy(tmp->owning_function,local_copy_func_stab); 
-  
-  strcpy(tmp->name,name);
-  tmp->offset = offset; 
+    error ("Malformed function STAB found in add_common_block()");
+
+
+  tmp->owning_function = xmalloc (strlen (local_copy_func_stab) + 1);
+
+  strcpy (tmp->owning_function, local_copy_func_stab);
+
+  strcpy (tmp->name, name);
+  tmp->offset = offset;
   tmp->next = NULL;
   tmp->entries = NULL;
-  tmp->secnum = secnum; 
-  
+  tmp->secnum = secnum;
+
   current_common = tmp;
-  
+
   if (head_common_list == NULL)
     {
       head_common_list = tail_common_list = tmp;
     }
   else
     {
-      tail_common_list->next = tmp; 
+      tail_common_list->next = tmp;
       tail_common_list = tmp;
     }
 }
 #endif
 
 /* The following function simply enters a given common entry onto 
-   the "current_common" block that has been saved away. */ 
+   the "current_common" block that has been saved away. */
 
 #if 0
 static void
-add_common_entry(entry_sym_ptr)
-     struct symbol *entry_sym_ptr; 
+add_common_entry (entry_sym_ptr)
+     struct symbol *entry_sym_ptr;
 {
   COMMON_ENTRY_PTR tmp;
-  
-  
-  
+
+
+
   /* The order of this list is important, since 
      we expect the entries to appear in decl.
-     order when we later issue "info common" calls */ 
-  
-  tmp = allocate_common_entry_node();
-  
+     order when we later issue "info common" calls */
+
+  tmp = allocate_common_entry_node ();
+
   tmp->next = NULL;
   tmp->symbol = entry_sym_ptr;
-  
+
   if (current_common == NULL)
-    error("Attempt to add COMMON entry with no block open!");
-  else         
+    error ("Attempt to add COMMON entry with no block open!");
+  else
     {
       if (current_common->entries == NULL)
        {
          current_common->entries = tmp;
-         current_common->end_of_entries = tmp; 
+         current_common->end_of_entries = tmp;
        }
       else
        {
-         current_common->end_of_entries->next = tmp; 
-         current_common->end_of_entries = tmp; 
+         current_common->end_of_entries->next = tmp;
+         current_common->end_of_entries = tmp;
        }
     }
 }
 #endif
 
-/* This routine finds the first encountred COMMON block named "name" */ 
+/* This routine finds the first encountred COMMON block named "name" */
 
 #if 0
 static SAVED_F77_COMMON_PTR
-find_first_common_named(name)
-     char *name; 
+find_first_common_named (name)
+     char *name;
 {
-  
+
   SAVED_F77_COMMON_PTR tmp;
-  
+
   tmp = head_common_list;
-  
+
   while (tmp != NULL)
     {
-      if (STREQ(tmp->name,name))
-       return(tmp);
+      if (STREQ (tmp->name, name))
+       return (tmp);
       else
        tmp = tmp->next;
     }
-  return(NULL); 
+  return (NULL);
 }
 #endif
 
 /* This routine finds the first encountred COMMON block named "name" 
-   that belongs to function funcname */ 
+   that belongs to function funcname */
 
-SAVED_F77_COMMON_PTR find_common_for_function(name, funcname)
+SAVED_F77_COMMON_PTR
+find_common_for_function (name, funcname)
      char *name;
-     char *funcname; 
+     char *funcname;
 {
-  
+
   SAVED_F77_COMMON_PTR tmp;
-  
+
   tmp = head_common_list;
-  
+
   while (tmp != NULL)
     {
-      if (STREQ(tmp->name,name) && STREQ(tmp->owning_function,funcname))
-       return(tmp);
+      if (STREQ (tmp->name, name) && STREQ (tmp->owning_function, funcname))
+       return (tmp);
       else
        tmp = tmp->next;
     }
-  return(NULL); 
+  return (NULL);
 }
 
 
@@ -780,7 +788,7 @@ SAVED_F77_COMMON_PTR find_common_for_function(name, funcname)
 
 /* The following function is called to patch up the offsets 
    for the statics contained in the COMMON block named
-   "name."  */ 
+   "name."  */
 
 static void
 patch_common_entries (blk, offset, secnum)
@@ -789,19 +797,19 @@ patch_common_entries (blk, offset, secnum)
      int secnum;
 {
   COMMON_ENTRY_PTR entry;
-  
-  blk->offset = offset;  /* Keep this around for future use. */ 
-  
+
+  blk->offset = offset;                /* Keep this around for future use. */
+
   entry = blk->entries;
-  
+
   while (entry != NULL)
     {
-      SYMBOL_VALUE (entry->symbol) += offset; 
+      SYMBOL_VALUE (entry->symbol) += offset;
       SYMBOL_SECTION (entry->symbol) = secnum;
-      
+
       entry = entry->next;
     }
-  blk->secnum = secnum; 
+  blk->secnum = secnum;
 }
 
 /* Patch all commons named "name" that need patching.Since COMMON
@@ -816,30 +824,30 @@ patch_all_commons_by_name (name, offset, secnum)
      CORE_ADDR offset;
      int secnum;
 {
-  
+
   SAVED_F77_COMMON_PTR tmp;
-  
+
   /* For blank common blocks, change the canonical reprsentation 
      of a blank name */
-  
-  if ((STREQ(name,BLANK_COMMON_NAME_ORIGINAL)) ||
-      (STREQ(name,BLANK_COMMON_NAME_MF77)))
+
+  if ((STREQ (name, BLANK_COMMON_NAME_ORIGINAL)) ||
+      (STREQ (name, BLANK_COMMON_NAME_MF77)))
     {
-      free(name);
-      name = alloca(strlen(BLANK_COMMON_NAME_LOCAL) + 1); 
-      strcpy(name,BLANK_COMMON_NAME_LOCAL); 
+      free (name);
+      name = alloca (strlen (BLANK_COMMON_NAME_LOCAL) + 1);
+      strcpy (name, BLANK_COMMON_NAME_LOCAL);
     }
-  
+
   tmp = head_common_list;
-  
+
   while (tmp != NULL)
     {
-      if (COMMON_NEEDS_PATCHING(tmp))
-       if (STREQ(tmp->name,name))
-         patch_common_entries(tmp,offset,secnum); 
-      
+      if (COMMON_NEEDS_PATCHING (tmp))
+       if (STREQ (tmp->name, name))
+         patch_common_entries (tmp, offset, secnum);
+
       tmp = tmp->next;
-    }   
+    }
 }
 #endif
 
@@ -849,7 +857,7 @@ patch_all_commons_by_name (name, offset, secnum)
    #line pragmas sometimes cause line ranges to get messed up 
    we simply create a linear list.  This list can then be searched 
    first by a queueing algorithm and upon failure fall back to 
-   a linear scan. */ 
+   a linear scan. */
 
 #if 0
 #define ADD_BF_SYMNUM(bf_sym,fcn_sym) \
@@ -875,24 +883,24 @@ else \
               \
                 saved_bf_list_end->next = tmp_bf_ptr;  \
                   saved_bf_list_end = tmp_bf_ptr; \
-                  } 
+                  }
 #endif
 
-/* This function frees the entire (.bf,function) list */ 
+/* This function frees the entire (.bf,function) list */
 
 #if 0
-static void 
-  clear_bf_list()
+static void
+clear_bf_list ()
 {
-  
+
   SAVED_BF_PTR tmp = saved_bf_list;
-  SAVED_BF_PTR next = NULL; 
-  
+  SAVED_BF_PTR next = NULL;
+
   while (tmp != NULL)
     {
       next = tmp->next;
-      free(tmp);
-      tmp=next;
+      free (tmp);
+      tmp = next;
     }
   saved_bf_list = NULL;
 }
@@ -908,66 +916,65 @@ get_bf_for_fcn (the_function)
 {
   SAVED_BF_PTR tmp;
   int nprobes = 0;
-  
+
   /* First use a simple queuing algorithm (i.e. look and see if the 
      item at the head of the queue is the one you want)  */
-  
+
   if (saved_bf_list == NULL)
-    fatal ("cannot get .bf node off empty list"); 
-  
-  if (current_head_bf_list != NULL) 
+    internal_error ("cannot get .bf node off empty list");
+
+  if (current_head_bf_list != NULL)
     if (current_head_bf_list->symnum_fcn == the_function)
       {
-       if (global_remote_debug) 
-         fprintf(stderr,"*"); 
+       if (global_remote_debug)
+         fprintf (stderr, "*");
 
-       tmp = current_head_bf_list; 
+       tmp = current_head_bf_list;
        current_head_bf_list = current_head_bf_list->next;
-       return(tmp->symnum_bf); 
+       return (tmp->symnum_bf);
       }
-  
+
   /* If the above did not work (probably because #line directives were 
      used in the sourcefile and they messed up our internal tables) we now do
      the ugly linear scan */
-  
-  if (global_remote_debug) 
-    fprintf(stderr,"\ndefaulting to linear scan\n"); 
-  
-  nprobes = 0; 
+
+  if (global_remote_debug)
+    fprintf (stderr, "\ndefaulting to linear scan\n");
+
+  nprobes = 0;
   tmp = saved_bf_list;
   while (tmp != NULL)
     {
-      nprobes++; 
+      nprobes++;
       if (tmp->symnum_fcn == the_function)
-       { 
+       {
          if (global_remote_debug)
-           fprintf(stderr,"Found in %d probes\n",nprobes);
+           fprintf (stderr, "Found in %d probes\n", nprobes);
          current_head_bf_list = tmp->next;
-         return(tmp->symnum_bf);
-       } 
-      tmp= tmp->next; 
+         return (tmp->symnum_bf);
+       }
+      tmp = tmp->next;
     }
-  
-  return(-1); 
+
+  return (-1);
 }
 
-static SAVED_FUNCTION_PTR saved_function_list=NULL; 
-static SAVED_FUNCTION_PTR saved_function_list_end=NULL; 
+static SAVED_FUNCTION_PTR saved_function_list = NULL;
+static SAVED_FUNCTION_PTR saved_function_list_end = NULL;
 
 static void
-clear_function_list()
+clear_function_list ()
 {
   SAVED_FUNCTION_PTR tmp = saved_function_list;
-  SAVED_FUNCTION_PTR next = NULL; 
-  
+  SAVED_FUNCTION_PTR next = NULL;
+
   while (tmp != NULL)
     {
       next = tmp->next;
-      free(tmp);
+      free (tmp);
       tmp = next;
     }
-  
+
   saved_function_list = NULL;
 }
 #endif
-
index 5bfecc2..9c8e313 100644 (file)
@@ -2,21 +2,22 @@
    Copyright 1986, 87, 89, 91, 94, 95, 96, 1998
    Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -28,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "target.h"
 #include "gdb_string.h"
 #include "floatformat.h"
-#include "symfile.h"   /* for overlay functions */
+#include "symfile.h"           /* for overlay functions */
 
 /* This is used to indicate that we don't know the format of the floating point
    number.  Typically, this is useful for native ports, where the actual format
@@ -43,6 +44,8 @@ const struct floatformat floatformat_unknown;
 
 static void write_register_gen PARAMS ((int, char *));
 
+static int read_relative_register_raw_bytes_for_frame PARAMS ((int regnum, char *myaddr, struct frame_info * frame));
+
 /* Basic byte-swapping routines.  GDB has needed these for a long time...
    All extract a target-format integer at ADDR which is LEN bytes long.  */
 
@@ -51,17 +54,17 @@ static void write_register_gen PARAMS ((int, char *));
      assume it throughout all these swapping routines.  If we had to deal with
      9 bit characters, we would need to make len be in bits and would have
      to re-write these routines...  */
-  you lose
+you lose
 #endif
 
-LONGEST
+  LONGEST
 extract_signed_integer (addr, len)
      PTR addr;
      int len;
 {
   LONGEST retval;
   unsigned char *p;
-  unsigned char *startaddr = (unsigned char *)addr;
+  unsigned char *startaddr = (unsigned char *) addr;
   unsigned char *endaddr = startaddr + len;
 
   if (len > (int) sizeof (LONGEST))
@@ -75,7 +78,7 @@ That operation is not available on integers of more than %d bytes.",
     {
       p = startaddr;
       /* Do the sign extension once at the start.  */
-      retval = ((LONGEST)*p ^ 0x80) - 0x80;
+      retval = ((LONGEST) * p ^ 0x80) - 0x80;
       for (++p; p < endaddr; ++p)
        retval = (retval << 8) | *p;
     }
@@ -83,7 +86,7 @@ That operation is not available on integers of more than %d bytes.",
     {
       p = endaddr - 1;
       /* Do the sign extension once at the start.  */
-      retval = ((LONGEST)*p ^ 0x80) - 0x80;
+      retval = ((LONGEST) * p ^ 0x80) - 0x80;
       for (--p; p >= startaddr; --p)
        retval = (retval << 8) | *p;
     }
@@ -97,7 +100,7 @@ extract_unsigned_integer (addr, len)
 {
   ULONGEST retval;
   unsigned char *p;
-  unsigned char *startaddr = (unsigned char *)addr;
+  unsigned char *startaddr = (unsigned char *) addr;
   unsigned char *endaddr = startaddr + len;
 
   if (len > (int) sizeof (ULONGEST))
@@ -180,7 +183,7 @@ extract_address (addr, len)
 {
   /* Assume a CORE_ADDR can fit in a LONGEST (for now).  Not sure
      whether we want this to be true eventually.  */
-  return (CORE_ADDR)extract_unsigned_integer (addr, len);
+  return (CORE_ADDR) extract_unsigned_integer (addr, len);
 }
 
 void
@@ -190,7 +193,7 @@ store_signed_integer (addr, len, val)
      LONGEST val;
 {
   unsigned char *p;
-  unsigned char *startaddr = (unsigned char *)addr;
+  unsigned char *startaddr = (unsigned char *) addr;
   unsigned char *endaddr = startaddr + len;
 
   /* Start at the least significant end of the integer, and work towards
@@ -220,7 +223,7 @@ store_unsigned_integer (addr, len, val)
      ULONGEST val;
 {
   unsigned char *p;
-  unsigned char *startaddr = (unsigned char *)addr;
+  unsigned char *startaddr = (unsigned char *) addr;
   unsigned char *endaddr = startaddr + len;
 
   /* Start at the least significant end of the integer, and work towards
@@ -252,47 +255,9 @@ store_address (addr, len, val)
      int len;
      LONGEST val;
 {
-  if( TARGET_BYTE_ORDER == BIG_ENDIAN
-      &&  len != sizeof( LONGEST )) {
-    /* On big-endian machines (e.g., HPPA 2.0, narrow mode)
-     * just letting this fall through to the call below will
-     * lead to the wrong bits being stored.
-     *
-     * Only the simplest case is fixed here, the others just
-     * get the old behavior.
-     */
-    if( (len == sizeof( CORE_ADDR ))
-       &&  (sizeof( LONGEST ) == 2 * sizeof( CORE_ADDR ))) {
-      /* Watch out!  The high bits are garbage! */
-      CORE_ADDR coerce[2];
-      *(LONGEST*)&coerce = val;
-
-      store_unsigned_integer (addr, len, coerce[1] ); /* BIG_ENDIAN code! */
-      return;
-    }
-  }
   store_unsigned_integer (addr, len, val);
 }
 \f
-/* Swap LEN bytes at BUFFER between target and host byte-order.  */
-#define SWAP_FLOATING(buffer,len) \
-  do                                                                    \
-    {                                                                   \
-      if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER)                         \
-        {                                                               \
-          char tmp;                                                     \
-          char *p = (char *)(buffer);                                   \
-          char *q = ((char *)(buffer)) + len - 1;                       \
-          for (; p < q; p++, q--)                                       \
-            {                                                           \
-              tmp = *q;                                                 \
-              *q = *p;                                                  \
-              *p = tmp;                                                 \
-            }                                                           \
-        }                                                               \
-    }                                                                   \
-  while (0)
-
 /* Extract a floating-point number from a target-order byte-stream at ADDR.
    Returns the value as type DOUBLEST.
 
@@ -344,6 +309,10 @@ extract_floating (addr, len)
       else
        floatformat_to_doublest (TARGET_LONG_DOUBLE_FORMAT, addr, &dretval);
     }
+#ifdef TARGET_EXTRACT_FLOATING
+  else if (TARGET_EXTRACT_FLOATING (addr, len, &dretval))
+    return dretval;
+#endif
   else
     {
       error ("Can't deal with a floating point number of %d bytes.", len);
@@ -387,13 +356,16 @@ store_floating (addr, len, val)
       else
        floatformat_from_doublest (TARGET_LONG_DOUBLE_FORMAT, &val, addr);
     }
+#ifdef TARGET_STORE_FLOATING
+  else if (TARGET_STORE_FLOATING (addr, len, val))
+    return;
+#endif 
   else
     {
       error ("Can't deal with a floating point number of %d bytes.", len);
     }
 }
 \f
-#if !defined (GET_SAVED_REGISTER)
 
 /* Return the address in which frame FRAME's value of register REGNUM
    has been saved in memory.  Or return zero if it has not been saved.
@@ -427,17 +399,18 @@ find_saved_register (frame, regnum)
      callers to this routine asking for the stack pointer want the
      stack pointer saved for *this* frame; this is returned from the
      next frame.  */
-     
-  if (REGISTER_IN_WINDOW_P(regnum))
+
+  if (REGISTER_IN_WINDOW_P (regnum))
     {
       frame1 = get_next_frame (frame);
-      if (!frame1) return 0;   /* Registers of this frame are active.  */
-      
+      if (!frame1)
+       return 0;               /* Registers of this frame are active.  */
+
       /* Get the SP from the next frame in; it will be this
-        current frame.  */
+         current frame.  */
       if (regnum != SP_REGNUM)
-       frame1 = frame; 
-         
+       frame1 = frame;
+
       FRAME_INIT_SAVED_REGS (frame1);
       return frame1->saved_regs[regnum];       /* ... which might be zero */
     }
@@ -477,7 +450,7 @@ find_saved_register (frame, regnum)
    The argument RAW_BUFFER must point to aligned memory.  */
 
 void
-get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
+default_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
      char *raw_buffer;
      int *optimized;
      CORE_ADDR *addrp;
@@ -503,7 +476,7 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
          if (raw_buffer != NULL)
            {
              /* Put it back in target format.  */
-             store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), (LONGEST)addr);
+             store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), (LONGEST) addr);
            }
          if (addrp != NULL)
            *addrp = 0;
@@ -523,7 +496,22 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
   if (addrp != NULL)
     *addrp = addr;
 }
-#endif /* GET_SAVED_REGISTER.  */
+
+#if !defined (GET_SAVED_REGISTER)
+#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \
+  default_get_saved_register(raw_buffer, optimized, addrp, frame, regnum, lval)
+#endif
+void
+get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
+     char *raw_buffer;
+     int *optimized;
+     CORE_ADDR *addrp;
+     struct frame_info *frame;
+     int regnum;
+     enum lval_type *lval;
+{
+  GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval);
+}
 
 /* Copy the bytes of register REGNUM, relative to the input stack frame,
    into our memory at MYADDR, in target byte order.
@@ -531,7 +519,7 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
 
    Returns 1 if could not be read, 0 if could.  */
 
-int
+static int
 read_relative_register_raw_bytes_for_frame (regnum, myaddr, frame)
      int regnum;
      char *myaddr;
@@ -541,17 +529,17 @@ read_relative_register_raw_bytes_for_frame (regnum, myaddr, frame)
   if (regnum == FP_REGNUM && frame)
     {
       /* Put it back in target format. */
-      store_address (myaddr, REGISTER_RAW_SIZE(FP_REGNUM),
-                    (LONGEST)FRAME_FP(frame));
+      store_address (myaddr, REGISTER_RAW_SIZE (FP_REGNUM),
+                    (LONGEST) FRAME_FP (frame));
 
       return 0;
     }
 
   get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame,
-                      regnum, (enum lval_type *)NULL);
+                     regnum, (enum lval_type *) NULL);
 
-  if (register_valid [regnum] < 0)
-    return 1;  /* register value not available */
+  if (register_valid[regnum] < 0)
+    return 1;                  /* register value not available */
 
   return optim;
 }
@@ -567,7 +555,7 @@ read_relative_register_raw_bytes (regnum, myaddr)
      int regnum;
      char *myaddr;
 {
-  return read_relative_register_raw_bytes_for_frame (regnum, myaddr, 
+  return read_relative_register_raw_bytes_for_frame (regnum, myaddr,
                                                     selected_frame);
 }
 
@@ -592,27 +580,26 @@ value_of_register (regnum)
                      selected_frame, regnum, &lval);
 
   if (register_valid[regnum] < 0)
-    return NULL;       /* register value not available */
+    return NULL;               /* register value not available */
 
   reg_val = allocate_value (REGISTER_VIRTUAL_TYPE (regnum));
 
   /* Convert raw data to virtual format if necessary.  */
 
-#ifdef REGISTER_CONVERTIBLE
   if (REGISTER_CONVERTIBLE (regnum))
     {
       REGISTER_CONVERT_TO_VIRTUAL (regnum, REGISTER_VIRTUAL_TYPE (regnum),
                                   raw_buffer, VALUE_CONTENTS_RAW (reg_val));
     }
+  else if (REGISTER_RAW_SIZE (regnum) == REGISTER_VIRTUAL_SIZE (regnum))
+    memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer,
+           REGISTER_RAW_SIZE (regnum));
   else
-#endif
-    if (REGISTER_RAW_SIZE (regnum) == REGISTER_VIRTUAL_SIZE (regnum))
-      memcpy (VALUE_CONTENTS_RAW (reg_val), raw_buffer,
-             REGISTER_RAW_SIZE (regnum));
-    else
-      fatal ("Register \"%s\" (%d) has conflicting raw (%d) and virtual (%d) size",
-            REGISTER_NAME (regnum), regnum,
-            REGISTER_RAW_SIZE (regnum), REGISTER_VIRTUAL_SIZE (regnum));
+    internal_error ("Register \"%s\" (%d) has conflicting raw (%d) and virtual (%d) size",
+                   REGISTER_NAME (regnum),
+                   regnum,
+                   REGISTER_RAW_SIZE (regnum),
+                   REGISTER_VIRTUAL_SIZE (regnum));
   VALUE_LVAL (reg_val) = lval;
   VALUE_ADDRESS (reg_val) = addr;
   VALUE_REGNO (reg_val) = regnum;
@@ -627,15 +614,14 @@ value_of_register (regnum)
    or it will get garbage.  (a change from GDB version 3, in which
    the caller got the value from the last stop).  */
 
-/* Contents of the registers in target byte order.
-   We allocate some extra slop since we do a lot of memcpy's around 
-   `registers', and failing-soft is better than failing hard.  */
+/* Contents and state of the registers (in target byte order). */
+
+char *registers;
 
-char registers[REGISTER_BYTES + /* SLOP */ 256];
+/* VALID_REGISTER is non-zero if it has been fetched, -1 if the
+   register value was not available. */
 
-/* Nonzero if that register has been fetched,
-   -1 if register value not available. */
-SIGNED char register_valid[NUM_REGS];
+signed char *register_valid;
 
 /* The thread/process associated with the current set of registers.  For now,
    -1 is special, and means `no current process'.  */
@@ -675,20 +661,22 @@ registers_fetched ()
     register_valid[i] = 1;
 }
 
-/* read_register_bytes and write_register_bytes are generally a *BAD* idea.
-   They are inefficient because they need to check for partial updates, which
-   can only be done by scanning through all of the registers and seeing if the
-   bytes that are being read/written fall inside of an invalid register.  [The
-    main reason this is necessary is that register sizes can vary, so a simple
-    index won't suffice.]  It is far better to call read_register_gen if you
-   want to get at the raw register contents, as it only takes a regno as an
-   argument, and therefore can't do a partial register update.  It would also
-   be good to have a write_register_gen for similar reasons.
-
-   Prior to the recent fixes to check for partial updates, both read and
-   write_register_bytes always checked to see if any registers were stale, and
-   then called target_fetch_registers (-1) to update the whole set.  This
-   caused really slowed things down for remote targets.  */
+/* read_register_bytes and write_register_bytes are generally a *BAD*
+   idea.  They are inefficient because they need to check for partial
+   updates, which can only be done by scanning through all of the
+   registers and seeing if the bytes that are being read/written fall
+   inside of an invalid register.  [The main reason this is necessary
+   is that register sizes can vary, so a simple index won't suffice.]
+   It is far better to call read_register_gen and write_register_gen
+   if you want to get at the raw register contents, as it only takes a
+   regno as an argument, and therefore can't do a partial register
+   update.
+
+   Prior to the recent fixes to check for partial updates, both read
+   and write_register_bytes always checked to see if any registers
+   were stale, and then called target_fetch_registers (-1) to update
+   the whole set.  This caused really slowed things down for remote
+   targets.  */
 
 /* Copy INLEN bytes of consecutive data from registers
    starting with the INREGBYTE'th byte of register data
@@ -715,7 +703,6 @@ read_register_bytes (inregbyte, myaddr, inlen)
   for (regno = 0; regno < NUM_REGS; regno++)
     {
       int regstart, regend;
-      int startin, endin;
 
       if (register_valid[regno])
        continue;
@@ -726,15 +713,12 @@ read_register_bytes (inregbyte, myaddr, inlen)
       regstart = REGISTER_BYTE (regno);
       regend = regstart + REGISTER_RAW_SIZE (regno);
 
-      startin = regstart >= inregbyte && regstart < inregend;
-      endin = regend > inregbyte && regend <= inregend;
-
-      if (!startin && !endin)
+      if (regend <= inregbyte || inregend <= regstart)
+       /* The range the user wants to read doesn't overlap with regno.  */
        continue;
 
       /* We've found an invalid register where at least one byte will be read.
-        Update it from the target.  */
-
+         Update it from the target.  */
       target_fetch_registers (regno);
 
       if (!register_valid[regno])
@@ -787,20 +771,20 @@ write_register_gen (regno, myaddr)
       registers_pid = inferior_pid;
     }
 
-  size = REGISTER_RAW_SIZE(regno);
+  size = REGISTER_RAW_SIZE (regno);
 
   /* If we have a valid copy of the register, and new value == old value,
      then don't bother doing the actual store. */
 
-  if (register_valid [regno]
+  if (register_valid[regno]
       && memcmp (&registers[REGISTER_BYTE (regno)], myaddr, size) == 0)
     return;
-  
+
   target_prepare_to_store ();
 
   memcpy (&registers[REGISTER_BYTE (regno)], myaddr, size);
 
-  register_valid [regno] = 1;
+  register_valid[regno] = 1;
 
   target_store_registers (regno);
 }
@@ -827,40 +811,41 @@ write_register_bytes (myregstart, myaddr, inlen)
   for (regno = 0; regno < NUM_REGS; regno++)
     {
       int regstart, regend;
-      int startin, endin;
-      char regbuf[MAX_REGISTER_RAW_SIZE];
 
       regstart = REGISTER_BYTE (regno);
       regend = regstart + REGISTER_RAW_SIZE (regno);
 
-      startin = regstart >= myregstart && regstart < myregend;
-      endin = regend > myregstart && regend <= myregend;
+      /* Is this register completely outside the range the user is writing?  */
+      if (myregend <= regstart || regend <= myregstart)
+       /* do nothing */ ;              
 
-      if (!startin && !endin)
-       continue;               /* Register is completely out of range */
+      /* Is this register completely within the range the user is writing?  */
+      else if (myregstart <= regstart && regend <= myregend)
+       write_register_gen (regno, myaddr + (regstart - myregstart));
 
-      if (startin && endin)    /* register is completely in range */
+      /* The register partially overlaps the range being written.  */
+      else
        {
-         write_register_gen (regno, myaddr + (regstart - myregstart));
-         continue;
-       }
+         char regbuf[MAX_REGISTER_RAW_SIZE];
+         /* What's the overlap between this register's bytes and
+             those the caller wants to write?  */
+         int overlapstart = max (regstart, myregstart);
+         int overlapend   = min (regend,   myregend);
+
+         /* We may be doing a partial update of an invalid register.
+            Update it from the target before scribbling on it.  */
+         read_register_gen (regno, regbuf);
 
-      /* We may be doing a partial update of an invalid register.  Update it
-        from the target before scribbling on it.  */
-      read_register_gen (regno, regbuf);
-
-      if (startin)
-       memcpy (registers + regstart,
-               myaddr + regstart - myregstart,
-               myregend - regstart);
-      else                     /* endin */
-       memcpy (registers + myregstart,
-               myaddr,
-               regend - myregstart);
-      target_store_registers (regno);
+         memcpy (registers + overlapstart,
+                 myaddr + (overlapstart - myregstart),
+                 overlapend - overlapstart);
+
+         target_store_registers (regno);
+       }
     }
 }
 
+
 /* Return the raw contents of register REGNO, regarding it as an integer.  */
 /* This probably should be returning LONGEST rather than CORE_ADDR.  */
 
@@ -877,8 +862,8 @@ read_register (regno)
   if (!register_valid[regno])
     target_fetch_registers (regno);
 
-  return (CORE_ADDR)extract_address (&registers[REGISTER_BYTE (regno)],
-                                    REGISTER_RAW_SIZE(regno));
+  return (CORE_ADDR) extract_address (&registers[REGISTER_BYTE (regno)],
+                                     REGISTER_RAW_SIZE (regno));
 }
 
 CORE_ADDR
@@ -924,22 +909,22 @@ write_register (regno, val)
       registers_pid = inferior_pid;
     }
 
-  size = REGISTER_RAW_SIZE(regno);
+  size = REGISTER_RAW_SIZE (regno);
   buf = alloca (size);
-  store_signed_integer (buf, size, (LONGEST)val);
+  store_signed_integer (buf, size, (LONGEST) val);
 
   /* If we have a valid copy of the register, and new value == old value,
      then don't bother doing the actual store. */
 
-  if (register_valid [regno]
+  if (register_valid[regno]
       && memcmp (&registers[REGISTER_BYTE (regno)], buf, size) == 0)
     return;
-  
+
   target_prepare_to_store ();
 
   memcpy (&registers[REGISTER_BYTE (regno)], buf, size);
 
-  register_valid [regno] = 1;
+  register_valid[regno] = 1;
 
   target_store_registers (regno);
 }
@@ -974,7 +959,7 @@ write_register_pid (regno, val, pid)
    If VAL is a NULL pointer, then it's probably an unsupported register.  We
    just set it's value to all zeros.  We might want to record this fact, and
    report it to the users of read_register and friends.
-*/
+ */
 
 void
 supply_register (regno, val)
@@ -998,31 +983,54 @@ supply_register (regno, val)
   /* On some architectures, e.g. HPPA, there are a few stray bits in some
      registers, that the rest of the code would like to ignore.  */
 #ifdef CLEAN_UP_REGISTER_VALUE
-  CLEAN_UP_REGISTER_VALUE(regno, &registers[REGISTER_BYTE(regno)]);
+  CLEAN_UP_REGISTER_VALUE (regno, &registers[REGISTER_BYTE (regno)]);
 #endif
 }
 
 
 /* This routine is getting awfully cluttered with #if's.  It's probably
    time to turn this into READ_PC and define it in the tm.h file.
-   Ditto for write_pc.  */
+   Ditto for write_pc.
+
+   1999-06-08: The following were re-written so that it assumes the
+   existance of a TARGET_READ_PC et.al. macro.  A default generic
+   version of that macro is made available where needed.
+
+   Since the ``TARGET_READ_PC'' et.al. macro is going to be controlled
+   by the multi-arch framework, it will eventually be possible to
+   eliminate the intermediate read_pc_pid().  The client would call
+   TARGET_READ_PC directly. (cagney). */
+
+#ifndef TARGET_READ_PC
+#define TARGET_READ_PC generic_target_read_pc
+#endif
+
+CORE_ADDR
+generic_target_read_pc (int pid)
+{
+#ifdef PC_REGNUM
+  if (PC_REGNUM >= 0)
+    {
+      CORE_ADDR pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, pid));
+      return pc_val;
+    }
+#endif
+  internal_error ("generic_target_read_pc");
+  return 0;
+}
 
 CORE_ADDR
 read_pc_pid (pid)
      int pid;
 {
-  int  saved_inferior_pid;
-  CORE_ADDR  pc_val;
+  int saved_inferior_pid;
+  CORE_ADDR pc_val;
 
   /* In case pid != inferior_pid. */
   saved_inferior_pid = inferior_pid;
   inferior_pid = pid;
-  
-#ifdef TARGET_READ_PC
+
   pc_val = TARGET_READ_PC (pid);
-#else
-  pc_val = ADDR_BITS_REMOVE ((CORE_ADDR) read_register_pid (PC_REGNUM, pid));
-#endif
 
   inferior_pid = saved_inferior_pid;
   return pc_val;
@@ -1034,28 +1042,43 @@ read_pc ()
   return read_pc_pid (inferior_pid);
 }
 
+#ifndef TARGET_WRITE_PC
+#define TARGET_WRITE_PC generic_target_write_pc
+#endif
+
+void
+generic_target_write_pc (pc, pid)
+     CORE_ADDR pc;
+     int pid;
+{
+#ifdef PC_REGNUM
+  if (PC_REGNUM >= 0)
+    write_register_pid (PC_REGNUM, pc, pid);
+#ifdef NPC_REGNUM
+  if (NPC_REGNUM >= 0)
+    write_register_pid (NPC_REGNUM, pc + 4, pid);
+#ifdef NNPC_REGNUM
+  if (NNPC_REGNUM >= 0)
+    write_register_pid (NNPC_REGNUM, pc + 8, pid);
+#endif
+#endif
+#else
+  internal_error ("generic_target_write_pc");
+#endif
+}
+
 void
 write_pc_pid (pc, pid)
      CORE_ADDR pc;
      int pid;
 {
-  int  saved_inferior_pid;
+  int saved_inferior_pid;
 
   /* In case pid != inferior_pid. */
   saved_inferior_pid = inferior_pid;
   inferior_pid = pid;
-  
-#ifdef TARGET_WRITE_PC
+
   TARGET_WRITE_PC (pc, pid);
-#else
-  write_register_pid (PC_REGNUM, pc, pid);
-#ifdef NPC_REGNUM
-  write_register_pid (NPC_REGNUM, pc + 4, pid);
-#ifdef NNPC_REGNUM
-  write_register_pid (NNPC_REGNUM, pc + 8, pid);
-#endif
-#endif
-#endif
 
   inferior_pid = saved_inferior_pid;
 }
@@ -1069,46 +1092,94 @@ write_pc (pc)
 
 /* Cope with strage ways of getting to the stack and frame pointers */
 
+#ifndef TARGET_READ_SP
+#define TARGET_READ_SP generic_target_read_sp
+#endif
+
+CORE_ADDR
+generic_target_read_sp ()
+{
+#ifdef SP_REGNUM
+  if (SP_REGNUM >= 0)
+    return read_register (SP_REGNUM);
+#endif
+  internal_error ("generic_target_read_sp");
+}
+
 CORE_ADDR
 read_sp ()
 {
-#ifdef TARGET_READ_SP
   return TARGET_READ_SP ();
-#else
-  return read_register (SP_REGNUM);
+}
+
+#ifndef TARGET_WRITE_SP
+#define TARGET_WRITE_SP generic_target_write_sp
 #endif
+
+void
+generic_target_write_sp (val)
+     CORE_ADDR val;
+{
+#ifdef SP_REGNUM
+  if (SP_REGNUM >= 0)
+    {
+      write_register (SP_REGNUM, val);
+      return;
+    }
+#endif
+  internal_error ("generic_target_write_sp");
 }
 
 void
 write_sp (val)
      CORE_ADDR val;
 {
-#ifdef TARGET_WRITE_SP
   TARGET_WRITE_SP (val);
-#else
-  write_register (SP_REGNUM, val);
+}
+
+#ifndef TARGET_READ_FP
+#define TARGET_READ_FP generic_target_read_fp
 #endif
+
+CORE_ADDR
+generic_target_read_fp ()
+{
+#ifdef FP_REGNUM
+  if (FP_REGNUM >= 0)
+    return read_register (FP_REGNUM);
+#endif
+  internal_error ("generic_target_read_fp");
 }
 
 CORE_ADDR
 read_fp ()
 {
-#ifdef TARGET_READ_FP
   return TARGET_READ_FP ();
-#else
-  return read_register (FP_REGNUM);
+}
+
+#ifndef TARGET_WRITE_FP
+#define TARGET_WRITE_FP generic_target_write_fp
 #endif
+
+void
+generic_target_write_fp (val)
+     CORE_ADDR val;
+{
+#ifdef FP_REGNUM
+  if (FP_REGNUM >= 0)
+    {
+      write_register (FP_REGNUM, val);
+      return;
+    }
+#endif
+  internal_error ("generic_target_write_fp");
 }
 
 void
 write_fp (val)
      CORE_ADDR val;
 {
-#ifdef TARGET_WRITE_FP
   TARGET_WRITE_FP (val);
-#else
-  write_register (FP_REGNUM, val);
-#endif
 }
 \f
 /* Will calling read_var_value or locate_var_value on SYM end
@@ -1121,7 +1192,7 @@ symbol_read_needs_frame (sym)
   switch (SYMBOL_CLASS (sym))
     {
       /* All cases listed explicitly so that gcc -Wall will detect it if
-        we failed to consider one.  */
+         we failed to consider one.  */
     case LOC_REGISTER:
     case LOC_ARG:
     case LOC_REF_ARG:
@@ -1142,8 +1213,8 @@ symbol_read_needs_frame (sym)
 
     case LOC_LABEL:
       /* Getting the address of a label can be done independently of the block,
-        even if some *uses* of that address wouldn't work so well without
-        the right frame.  */
+         even if some *uses* of that address wouldn't work so well without
+         the right frame.  */
 
     case LOC_BLOCK:
     case LOC_CONST_BYTES:
@@ -1176,7 +1247,8 @@ read_var_value (var, frame)
 
   len = TYPE_LENGTH (type);
 
-  if (frame == NULL) frame = selected_frame;
+  if (frame == NULL)
+    frame = selected_frame;
 
   switch (SYMBOL_CLASS (var))
     {
@@ -1190,12 +1262,12 @@ read_var_value (var, frame)
     case LOC_LABEL:
       /* Put the constant back in target format.  */
       if (overlay_debugging)
-       store_address (VALUE_CONTENTS_RAW (v), len, 
-                      (LONGEST)symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
-                                                          SYMBOL_BFD_SECTION (var)));
+       store_address (VALUE_CONTENTS_RAW (v), len,
+            (LONGEST) symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
+                                                SYMBOL_BFD_SECTION (var)));
       else
        store_address (VALUE_CONTENTS_RAW (v), len,
-                      (LONGEST)SYMBOL_VALUE_ADDRESS (var));
+                      (LONGEST) SYMBOL_VALUE_ADDRESS (var));
       VALUE_LVAL (v) = not_lval;
       return v;
 
@@ -1219,12 +1291,12 @@ read_var_value (var, frame)
     case LOC_INDIRECT:
       /* The import slot does not have a real address in it from the
          dynamic loader (dld.sl on HP-UX), if the target hasn't begun
-         execution yet, so check for that. */ 
+         execution yet, so check for that. */
       if (!target_has_execution)
-        error ("\
+       error ("\
 Attempt to access variable defined in different shared object or load module when\n\
 addresses have not been bound by the dynamic loader. Try again when executable is running.");
-      
+
       addr = SYMBOL_VALUE_ADDRESS (var);
       addr = read_memory_unsigned_integer
        (addr, TARGET_PTR_BIT / TARGET_CHAR_BIT);
@@ -1268,25 +1340,25 @@ addresses have not been bound by the dynamic loader. Try again when executable i
        addr += SYMBOL_VALUE (var);
        break;
       }
-                           
+
     case LOC_THREAD_LOCAL_STATIC:
       {
-        char buf[MAX_REGISTER_RAW_SIZE];
-        
-        get_saved_register(buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
+       char buf[MAX_REGISTER_RAW_SIZE];
+
+       get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
                            NULL);
-        addr = extract_address (buf, REGISTER_RAW_SIZE (SYMBOL_BASEREG (var)));
-        addr += SYMBOL_VALUE (var );
-        break;
+       addr = extract_address (buf, REGISTER_RAW_SIZE (SYMBOL_BASEREG (var)));
+       addr += SYMBOL_VALUE (var);
+       break;
       }
-      
+
     case LOC_TYPEDEF:
       error ("Cannot look up value of a typedef");
       break;
 
     case LOC_BLOCK:
       if (overlay_debugging)
-       VALUE_ADDRESS (v) = symbol_overlayed_address 
+       VALUE_ADDRESS (v) = symbol_overlayed_address
          (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_BFD_SECTION (var));
       else
        VALUE_ADDRESS (v) = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
@@ -1307,13 +1379,13 @@ addresses have not been bound by the dynamic loader. Try again when executable i
        if (SYMBOL_CLASS (var) == LOC_REGPARM_ADDR)
          {
            regval = value_from_register (lookup_pointer_type (type),
-                                         regno, 
+                                         regno,
                                          frame);
 
            if (regval == NULL)
              error ("Value of register variable not available.");
 
-           addr   = value_as_pointer (regval);
+           addr = value_as_pointer (regval);
            VALUE_LVAL (v) = lval_memory;
          }
        else
@@ -1369,7 +1441,7 @@ value_from_register (type, regnum, frame)
      int regnum;
      struct frame_info *frame;
 {
-  char raw_buffer [MAX_REGISTER_RAW_SIZE];
+  char raw_buffer[MAX_REGISTER_RAW_SIZE];
   CORE_ADDR addr;
   int optim;
   value_ptr v = allocate_value (type);
@@ -1382,6 +1454,10 @@ value_from_register (type, regnum, frame)
   CHECK_TYPEDEF (type);
   len = TYPE_LENGTH (type);
 
+  /* Pointers on D10V are really only 16 bits, but we lie to gdb elsewhere... */
+  if (GDB_TARGET_IS_D10V && TYPE_CODE (type) == TYPE_CODE_PTR)
+    len = 2;
+
   VALUE_REGNO (v) = regnum;
 
   num_storage_locs = (len > REGISTER_VIRTUAL_SIZE (regnum) ?
@@ -1392,10 +1468,10 @@ value_from_register (type, regnum, frame)
 #ifdef GDB_TARGET_IS_H8500
       || TYPE_CODE (type) == TYPE_CODE_PTR
 #endif
-      )
+    )
     {
       /* Value spread across multiple storage locations.  */
-      
+
       int local_regnum;
       int mem_stor = 0, reg_stor = 0;
       int mem_tracking = 1;
@@ -1421,13 +1497,18 @@ value_from_register (type, regnum, frame)
 
          switch (regnum)
            {
-           case R0_REGNUM: case R1_REGNUM: case R2_REGNUM: case R3_REGNUM:
+           case R0_REGNUM:
+           case R1_REGNUM:
+           case R2_REGNUM:
+           case R3_REGNUM:
              page_regnum = SEG_D_REGNUM;
              break;
-           case R4_REGNUM: case R5_REGNUM:
+           case R4_REGNUM:
+           case R5_REGNUM:
              page_regnum = SEG_E_REGNUM;
              break;
-           case R6_REGNUM: case R7_REGNUM:
+           case R6_REGNUM:
+           case R7_REGNUM:
              page_regnum = SEG_T_REGNUM;
              break;
            }
@@ -1470,7 +1551,7 @@ value_from_register (type, regnum, frame)
          last_addr = addr;
        }
       else
-#endif                         /* GDB_TARGET_IS_H8500 */
+#endif /* GDB_TARGET_IS_H8500 */
        for (local_regnum = regnum;
             value_bytes_copied < len;
             (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
@@ -1483,8 +1564,8 @@ value_from_register (type, regnum, frame)
                                local_regnum,
                                &lval);
 
-         if (register_valid[local_regnum] == -1)
-           return NULL;        /* register value not available */
+           if (register_valid[local_regnum] == -1)
+             return NULL;      /* register value not available */
 
            if (regnum == local_regnum)
              first_addr = addr;
@@ -1493,7 +1574,7 @@ value_from_register (type, regnum, frame)
            else
              {
                mem_stor++;
-             
+
                mem_tracking =
                  (mem_tracking
                   && (regnum == local_regnum
@@ -1522,14 +1603,14 @@ value_from_register (type, regnum, frame)
          VALUE_ADDRESS (v) = first_addr;
        }
       else
-       fatal ("value_from_register: Value not stored anywhere!");
+       internal_error ("value_from_register: Value not stored anywhere!");
 
       VALUE_OPTIMIZED_OUT (v) = optim;
 
       /* Any structure stored in more than one register will always be
-        an integral number of registers.  Otherwise, you'd need to do
-        some fiddling with the last register copied here for little
-        endian machines.  */
+         an integral number of registers.  Otherwise, you'd need to do
+         some fiddling with the last register copied here for little
+         endian machines.  */
 
       /* Copy into the contents section of the value.  */
       memcpy (VALUE_CONTENTS_RAW (v), value_bytes, len);
@@ -1537,7 +1618,7 @@ value_from_register (type, regnum, frame)
       /* Finally do any conversion necessary when extracting this
          type from more than one register.  */
 #ifdef REGISTER_CONVERT_TO_TYPE
-      REGISTER_CONVERT_TO_TYPE(regnum, type, VALUE_CONTENTS_RAW(v));
+      REGISTER_CONVERT_TO_TYPE (regnum, type, VALUE_CONTENTS_RAW (v));
 #endif
       return v;
     }
@@ -1549,34 +1630,55 @@ value_from_register (type, regnum, frame)
   get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval);
 
   if (register_valid[regnum] == -1)
-    return NULL;       /* register value not available */
+    return NULL;               /* register value not available */
 
   VALUE_OPTIMIZED_OUT (v) = optim;
   VALUE_LVAL (v) = lval;
   VALUE_ADDRESS (v) = addr;
 
   /* Convert raw data to virtual format if necessary.  */
-  
-#ifdef REGISTER_CONVERTIBLE
+
   if (REGISTER_CONVERTIBLE (regnum))
     {
       REGISTER_CONVERT_TO_VIRTUAL (regnum, type,
                                   raw_buffer, VALUE_CONTENTS_RAW (v));
     }
   else
-#endif
     {
       /* Raw and virtual formats are the same for this register.  */
 
       if (TARGET_BYTE_ORDER == BIG_ENDIAN && len < REGISTER_RAW_SIZE (regnum))
        {
-         /* Big-endian, and we want less than full size.  */
+         /* Big-endian, and we want less than full size.  */
          VALUE_OFFSET (v) = REGISTER_RAW_SIZE (regnum) - len;
        }
 
       memcpy (VALUE_CONTENTS_RAW (v), raw_buffer + VALUE_OFFSET (v), len);
     }
-  
+
+  if (GDB_TARGET_IS_D10V
+      && TYPE_CODE (type) == TYPE_CODE_PTR
+      && TYPE_TARGET_TYPE (type)
+      && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC))
+    {
+      /* pointer to function */
+      unsigned long num;
+      unsigned short snum;
+      snum = (unsigned short) extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2);
+      num = D10V_MAKE_IADDR (snum);
+      store_address (VALUE_CONTENTS_RAW (v), 4, num);
+    }
+  else if (GDB_TARGET_IS_D10V
+          && TYPE_CODE (type) == TYPE_CODE_PTR)
+    {
+      /* pointer to data */
+      unsigned long num;
+      unsigned short snum;
+      snum = (unsigned short) extract_unsigned_integer (VALUE_CONTENTS_RAW (v), 2);
+      num = D10V_MAKE_DADDR (snum);
+      store_address (VALUE_CONTENTS_RAW (v), 4, num);
+    }
+
   return v;
 }
 \f
@@ -1607,13 +1709,13 @@ locate_var_value (var, frame)
       value_ptr val;
 
       addr = VALUE_ADDRESS (lazy_value);
-      val =  value_from_longest (lookup_pointer_type (type), (LONGEST) addr);
+      val = value_from_longest (lookup_pointer_type (type), (LONGEST) addr);
       VALUE_BFD_SECTION (val) = VALUE_BFD_SECTION (lazy_value);
       return val;
     }
 
   /* Not a memory address; check what the problem was.  */
-  switch (VALUE_LVAL (lazy_value)) 
+  switch (VALUE_LVAL (lazy_value))
     {
     case lval_register:
     case lval_reg_frame_relative:
@@ -1626,5 +1728,31 @@ locate_var_value (var, frame)
             SYMBOL_SOURCE_NAME (var));
       break;
     }
-  return 0;  /* For lint -- never reached */
+  return 0;                    /* For lint -- never reached */
+}
+\f
+
+static void build_findvar PARAMS ((void));
+static void
+build_findvar ()
+{
+  /* We allocate some extra slop since we do a lot of memcpy's around
+     `registers', and failing-soft is better than failing hard.  */
+  int sizeof_registers = REGISTER_BYTES + /* SLOP */ 256;
+  int sizeof_register_valid = NUM_REGS * sizeof (*register_valid);
+  registers = xmalloc (sizeof_registers);
+  memset (registers, 0, sizeof_registers);
+  register_valid = xmalloc (sizeof_register_valid);
+  memset (register_valid, 0, sizeof_register_valid);
+}
+
+void _initialize_findvar PARAMS ((void));
+void
+_initialize_findvar ()
+{
+  build_findvar ();
+
+  register_gdbarch_swap (&registers, sizeof (registers), NULL);
+  register_gdbarch_swap (&register_valid, sizeof (register_valid), NULL);
+  register_gdbarch_swap (NULL, 0, build_findvar);
 }
index f5f38a9..64e07cc 100644 (file)
@@ -1,21 +1,22 @@
 /* Modula 2 language support routines for GDB, the GNU debugger.
-   Copyright 1992 Free Software Foundation, Inc.
+   Copyright 1992, 2000 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -25,11 +26,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "language.h"
 #include "m2-lang.h"
 #include "c-lang.h"
+#include "valprint.h"
 
+extern void _initialize_m2_language PARAMS ((void));
 static struct type *m2_create_fundamental_type PARAMS ((struct objfile *, int));
-static void m2_printstr PARAMS ((GDB_FILE *stream, char *string, unsigned int length, int width, int force_ellipses));
-static void m2_printchar PARAMS ((int, GDB_FILE *));
-static void m2_emit_char PARAMS ((int, GDB_FILE *, int));
+static void m2_printstr (struct ui_file * stream, char *string,
+                        unsigned int length, int width,
+                        int force_ellipses);
+static void m2_printchar (int, struct ui_file *);
+static void m2_emit_char (int, struct ui_file *, int);
 
 /* Print the character C on STREAM as part of the contents of a literal
    string whose delimiter is QUOTER.  Note that that format for printing
@@ -41,7 +46,7 @@ static void m2_emit_char PARAMS ((int, GDB_FILE *, int));
 static void
 m2_emit_char (c, stream, quoter)
      register int c;
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int quoter;
 {
 
@@ -93,7 +98,7 @@ m2_emit_char (c, stream, quoter)
 static void
 m2_printchar (c, stream)
      int c;
-     GDB_FILE *stream;
+     struct ui_file *stream;
 {
   fputs_filtered ("'", stream);
   LA_EMIT_CHAR (c, stream, '\'');
@@ -109,7 +114,7 @@ m2_printchar (c, stream)
 
 static void
 m2_printstr (stream, string, length, width, force_ellipses)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      char *string;
      unsigned int length;
      int width;
@@ -120,8 +125,6 @@ m2_printstr (stream, string, length, width, force_ellipses)
   int in_quotes = 0;
   int need_comma = 0;
   extern int inspect_it;
-  extern int repeat_count_threshold;
-  extern int print_max;
 
   if (length == 0)
     {
@@ -132,7 +135,7 @@ m2_printstr (stream, string, length, width, force_ellipses)
   for (i = 0; i < length && things_printed < print_max; ++i)
     {
       /* Position of the character we are examining
-        to see whether it is repeated.  */
+         to see whether it is repeated.  */
       unsigned int rep1;
       /* Number of repetitions we have detected so far.  */
       unsigned int reps;
@@ -210,190 +213,191 @@ m2_create_fundamental_type (objfile, typeid)
 
   switch (typeid)
     {
-      default:
-       /* FIXME:  For now, if we are asked to produce a type not in this
-          language, create the equivalent of a C integer type with the
-          name "<?type?>".  When all the dust settles from the type
-          reconstruction work, this should probably become an error. */
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         0, "<?type?>", objfile);
-        warning ("internal error: no Modula fundamental type %d", typeid);
-       break;
-      case FT_VOID:
-       type = init_type (TYPE_CODE_VOID,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         0, "void", objfile);
-       break;
-      case FT_BOOLEAN:
-       type = init_type (TYPE_CODE_BOOL,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "boolean", objfile);
-       break;
-      case FT_STRING:
-       type = init_type (TYPE_CODE_STRING,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         0, "string", objfile);
-       break;
-      case FT_CHAR:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         0, "char", objfile);
-       break;
-      case FT_SIGNED_CHAR:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         0, "signed char", objfile);
-       break;
-      case FT_UNSIGNED_CHAR:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_CHAR_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
-       break;
-      case FT_SHORT:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
-                         0, "short", objfile);
-       break;
-      case FT_SIGNED_SHORT:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
-                         0, "short", objfile); /* FIXME-fnf */
-       break;
-      case FT_UNSIGNED_SHORT:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_SHORT_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
-       break;
-      case FT_INTEGER:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         0, "int", objfile);
-       break;
-      case FT_SIGNED_INTEGER:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         0, "int", objfile); /* FIXME -fnf */
-       break;
-      case FT_UNSIGNED_INTEGER:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
-       break;
-      case FT_FIXED_DECIMAL:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_INT_BIT / TARGET_CHAR_BIT,
-                         0, "fixed decimal", objfile);
-       break;
-      case FT_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
-                         0, "long", objfile);
-       break;
-      case FT_SIGNED_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
-                         0, "long", objfile); /* FIXME -fnf */
-       break;
-      case FT_UNSIGNED_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
-       break;
-      case FT_LONG_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
-                         0, "long long", objfile);
-       break;
-      case FT_SIGNED_LONG_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
-                         0, "signed long long", objfile);
-       break;
-      case FT_UNSIGNED_LONG_LONG:
-       type = init_type (TYPE_CODE_INT,
-                         TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
-                         TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
-       break;
-      case FT_FLOAT:
-       type = init_type (TYPE_CODE_FLT,
-                         TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
-                         0, "float", objfile);
-       break;
-      case FT_DBL_PREC_FLOAT:
-       type = init_type (TYPE_CODE_FLT,
-                         TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
-                         0, "double", objfile);
-       break;
-      case FT_FLOAT_DECIMAL:
-       type = init_type (TYPE_CODE_FLT,
-                         TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
-                         0, "floating decimal", objfile);
-       break;
-      case FT_EXT_PREC_FLOAT:
-       type = init_type (TYPE_CODE_FLT,
-                         TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
-                         0, "long double", objfile);
-       break;
-      case FT_COMPLEX:
-       type = init_type (TYPE_CODE_COMPLEX,
-                         2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
-                         0, "complex", objfile);
-       TYPE_TARGET_TYPE (type)
-         = m2_create_fundamental_type (objfile, FT_FLOAT);
-       break;
-      case FT_DBL_PREC_COMPLEX:
-       type = init_type (TYPE_CODE_COMPLEX,
-                         2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
-                         0, "double complex", objfile);
-       TYPE_TARGET_TYPE (type)
-         = m2_create_fundamental_type (objfile, FT_DBL_PREC_FLOAT);
-       break;
-      case FT_EXT_PREC_COMPLEX:
-       type = init_type (TYPE_CODE_COMPLEX,
-                         2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
-                         0, "long double complex", objfile);
-       TYPE_TARGET_TYPE (type)
-         = m2_create_fundamental_type (objfile, FT_EXT_PREC_FLOAT);
-       break;
-      }
+    default:
+      /* FIXME:  For now, if we are asked to produce a type not in this
+         language, create the equivalent of a C integer type with the
+         name "<?type?>".  When all the dust settles from the type
+         reconstruction work, this should probably become an error. */
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       0, "<?type?>", objfile);
+      warning ("internal error: no Modula fundamental type %d", typeid);
+      break;
+    case FT_VOID:
+      type = init_type (TYPE_CODE_VOID,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       0, "void", objfile);
+      break;
+    case FT_BOOLEAN:
+      type = init_type (TYPE_CODE_BOOL,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "boolean", objfile);
+      break;
+    case FT_STRING:
+      type = init_type (TYPE_CODE_STRING,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       0, "string", objfile);
+      break;
+    case FT_CHAR:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       0, "char", objfile);
+      break;
+    case FT_SIGNED_CHAR:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       0, "signed char", objfile);
+      break;
+    case FT_UNSIGNED_CHAR:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_CHAR_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned char", objfile);
+      break;
+    case FT_SHORT:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                       0, "short", objfile);
+      break;
+    case FT_SIGNED_SHORT:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                       0, "short", objfile);   /* FIXME-fnf */
+      break;
+    case FT_UNSIGNED_SHORT:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_SHORT_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned short", objfile);
+      break;
+    case FT_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       0, "int", objfile);
+      break;
+    case FT_SIGNED_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       0, "int", objfile);     /* FIXME -fnf */
+      break;
+    case FT_UNSIGNED_INTEGER:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned int", objfile);
+      break;
+    case FT_FIXED_DECIMAL:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_INT_BIT / TARGET_CHAR_BIT,
+                       0, "fixed decimal", objfile);
+      break;
+    case FT_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                       0, "long", objfile);
+      break;
+    case FT_SIGNED_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                       0, "long", objfile);    /* FIXME -fnf */
+      break;
+    case FT_UNSIGNED_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned long", objfile);
+      break;
+    case FT_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                       0, "long long", objfile);
+      break;
+    case FT_SIGNED_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                       0, "signed long long", objfile);
+      break;
+    case FT_UNSIGNED_LONG_LONG:
+      type = init_type (TYPE_CODE_INT,
+                       TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT,
+                       TYPE_FLAG_UNSIGNED, "unsigned long long", objfile);
+      break;
+    case FT_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+                       TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+                       0, "float", objfile);
+      break;
+    case FT_DBL_PREC_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+                       TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+                       0, "double", objfile);
+      break;
+    case FT_FLOAT_DECIMAL:
+      type = init_type (TYPE_CODE_FLT,
+                       TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+                       0, "floating decimal", objfile);
+      break;
+    case FT_EXT_PREC_FLOAT:
+      type = init_type (TYPE_CODE_FLT,
+                       TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+                       0, "long double", objfile);
+      break;
+    case FT_COMPLEX:
+      type = init_type (TYPE_CODE_COMPLEX,
+                       2 * TARGET_FLOAT_BIT / TARGET_CHAR_BIT,
+                       0, "complex", objfile);
+      TYPE_TARGET_TYPE (type)
+       = m2_create_fundamental_type (objfile, FT_FLOAT);
+      break;
+    case FT_DBL_PREC_COMPLEX:
+      type = init_type (TYPE_CODE_COMPLEX,
+                       2 * TARGET_DOUBLE_BIT / TARGET_CHAR_BIT,
+                       0, "double complex", objfile);
+      TYPE_TARGET_TYPE (type)
+       = m2_create_fundamental_type (objfile, FT_DBL_PREC_FLOAT);
+      break;
+    case FT_EXT_PREC_COMPLEX:
+      type = init_type (TYPE_CODE_COMPLEX,
+                       2 * TARGET_LONG_DOUBLE_BIT / TARGET_CHAR_BIT,
+                       0, "long double complex", objfile);
+      TYPE_TARGET_TYPE (type)
+       = m2_create_fundamental_type (objfile, FT_EXT_PREC_FLOAT);
+      break;
+    }
   return (type);
 }
-
 \f
+
 /* Table of operators and their precedences for printing expressions.  */
 
-static const struct op_print m2_op_print_tab[] = {
-    {"+",   BINOP_ADD, PREC_ADD, 0},
-    {"+",   UNOP_PLUS, PREC_PREFIX, 0},
-    {"-",   BINOP_SUB, PREC_ADD, 0},
-    {"-",   UNOP_NEG, PREC_PREFIX, 0},
-    {"*",   BINOP_MUL, PREC_MUL, 0},
-    {"/",   BINOP_DIV, PREC_MUL, 0},
-    {"DIV", BINOP_INTDIV, PREC_MUL, 0},
-    {"MOD", BINOP_REM, PREC_MUL, 0},
-    {":=",  BINOP_ASSIGN, PREC_ASSIGN, 1},
-    {"OR",  BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
-    {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
-    {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
-    {"=",   BINOP_EQUAL, PREC_EQUAL, 0},
-    {"<>",  BINOP_NOTEQUAL, PREC_EQUAL, 0},
-    {"<=",  BINOP_LEQ, PREC_ORDER, 0},
-    {">=",  BINOP_GEQ, PREC_ORDER, 0},
-    {">",   BINOP_GTR, PREC_ORDER, 0},
-    {"<",   BINOP_LESS, PREC_ORDER, 0},
-    {"^",   UNOP_IND, PREC_PREFIX, 0},
-    {"@",   BINOP_REPEAT, PREC_REPEAT, 0},
-    {"CAP", UNOP_CAP, PREC_BUILTIN_FUNCTION, 0},
-    {"CHR", UNOP_CHR, PREC_BUILTIN_FUNCTION, 0},
-    {"ORD", UNOP_ORD, PREC_BUILTIN_FUNCTION, 0},
-    {"FLOAT",UNOP_FLOAT, PREC_BUILTIN_FUNCTION, 0},
-    {"HIGH", UNOP_HIGH, PREC_BUILTIN_FUNCTION, 0},
-    {"MAX", UNOP_MAX, PREC_BUILTIN_FUNCTION, 0},
-    {"MIN", UNOP_MIN, PREC_BUILTIN_FUNCTION, 0},
-    {"ODD", UNOP_ODD, PREC_BUILTIN_FUNCTION, 0},
-    {"TRUNC", UNOP_TRUNC, PREC_BUILTIN_FUNCTION, 0},
-    {NULL,  0, 0, 0}
+static const struct op_print m2_op_print_tab[] =
+{
+  {"+", BINOP_ADD, PREC_ADD, 0},
+  {"+", UNOP_PLUS, PREC_PREFIX, 0},
+  {"-", BINOP_SUB, PREC_ADD, 0},
+  {"-", UNOP_NEG, PREC_PREFIX, 0},
+  {"*", BINOP_MUL, PREC_MUL, 0},
+  {"/", BINOP_DIV, PREC_MUL, 0},
+  {"DIV", BINOP_INTDIV, PREC_MUL, 0},
+  {"MOD", BINOP_REM, PREC_MUL, 0},
+  {":=", BINOP_ASSIGN, PREC_ASSIGN, 1},
+  {"OR", BINOP_LOGICAL_OR, PREC_LOGICAL_OR, 0},
+  {"AND", BINOP_LOGICAL_AND, PREC_LOGICAL_AND, 0},
+  {"NOT", UNOP_LOGICAL_NOT, PREC_PREFIX, 0},
+  {"=", BINOP_EQUAL, PREC_EQUAL, 0},
+  {"<>", BINOP_NOTEQUAL, PREC_EQUAL, 0},
+  {"<=", BINOP_LEQ, PREC_ORDER, 0},
+  {">=", BINOP_GEQ, PREC_ORDER, 0},
+  {">", BINOP_GTR, PREC_ORDER, 0},
+  {"<", BINOP_LESS, PREC_ORDER, 0},
+  {"^", UNOP_IND, PREC_PREFIX, 0},
+  {"@", BINOP_REPEAT, PREC_REPEAT, 0},
+  {"CAP", UNOP_CAP, PREC_BUILTIN_FUNCTION, 0},
+  {"CHR", UNOP_CHR, PREC_BUILTIN_FUNCTION, 0},
+  {"ORD", UNOP_ORD, PREC_BUILTIN_FUNCTION, 0},
+  {"FLOAT", UNOP_FLOAT, PREC_BUILTIN_FUNCTION, 0},
+  {"HIGH", UNOP_HIGH, PREC_BUILTIN_FUNCTION, 0},
+  {"MAX", UNOP_MAX, PREC_BUILTIN_FUNCTION, 0},
+  {"MIN", UNOP_MIN, PREC_BUILTIN_FUNCTION, 0},
+  {"ODD", UNOP_ODD, PREC_BUILTIN_FUNCTION, 0},
+  {"TRUNC", UNOP_TRUNC, PREC_BUILTIN_FUNCTION, 0},
+  {NULL, 0, 0, 0}
 };
 \f
 /* The built-in types of Modula-2.  */
@@ -404,17 +408,18 @@ struct type *builtin_type_m2_card;
 struct type *builtin_type_m2_real;
 struct type *builtin_type_m2_bool;
 
-struct type ** CONST_PTR (m2_builtin_types[]) = 
+struct type **CONST_PTR (m2_builtin_types[]) =
 {
   &builtin_type_m2_char,
-  &builtin_type_m2_int,
-  &builtin_type_m2_card,
-  &builtin_type_m2_real,
-  &builtin_type_m2_bool,
-  0
+    &builtin_type_m2_int,
+    &builtin_type_m2_card,
+    &builtin_type_m2_real,
+    &builtin_type_m2_bool,
+    0
 };
 
-const struct language_defn m2_language_defn = {
+const struct language_defn m2_language_defn =
+{
   "modula-2",
   language_m2,
   m2_builtin_types,
@@ -430,14 +435,14 @@ const struct language_defn m2_language_defn = {
   m2_print_type,               /* Print a type using appropriate syntax */
   m2_val_print,                        /* Print a value using appropriate syntax */
   c_value_print,               /* Print a top-level value */
-  {"",      "",   "",   ""},   /* Binary format info */
-  {"%loB",   "",   "o",  "B"}, /* Octal format info */
-  {"%ld",    "",   "d",  ""},  /* Decimal format info */
-  {"0%lXH",  "0",  "X",  "H"}, /* Hex format info */
+  {"", "", "", ""},            /* Binary format info */
+  {"%loB", "", "o", "B"},      /* Octal format info */
+  {"%ld", "", "d", ""},                /* Decimal format info */
+  {"0%lXH", "0", "X", "H"},    /* Hex format info */
   m2_op_print_tab,             /* expression operators for printing */
   0,                           /* arrays are first-class (not c-style) */
   0,                           /* String lower bound */
-  &builtin_type_m2_char,       /* Type of string elements */ 
+  &builtin_type_m2_char,       /* Type of string elements */
   LANG_MAGIC
 };
 
index c5d31e1..48eef62 100644 (file)
@@ -1,22 +1,23 @@
 /* Support routines for decoding "stabs" debugging information format.
    Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998
-             Free Software Foundation, Inc.
+   Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /* Support routines for reading and decoding debugging information in
    the "stabs" format.  This format is used with many systems that use
@@ -45,10 +46,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include <ctype.h>
 
 /* Ask stabsread.h to define the vars it normally declares `extern'.  */
-#define        EXTERN  /**/
+#define        EXTERN
+/**/
 #include "stabsread.h"         /* Our own declarations */
 #undef EXTERN
 
+extern void _initialize_stabsread PARAMS ((void));
+
 /* The routines that read and process a complete stabs for a C struct or 
    C++ class pass lists of data member fields and lists of member function
    fields in an instance of a field_info structure, as defined below.
@@ -56,34 +60,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    expected to eventually go away... (FIXME) */
 
 struct field_info
-{
-  struct nextfield
-    {
-      struct nextfield *next;
+  {
+    struct nextfield
+      {
+       struct nextfield *next;
 
-      /* This is the raw visibility from the stab.  It is not checked
-        for being one of the visibilities we recognize, so code which
-        examines this field better be able to deal.  */
-      int visibility;
+       /* This is the raw visibility from the stab.  It is not checked
+          for being one of the visibilities we recognize, so code which
+          examines this field better be able to deal.  */
+       int visibility;
 
-      struct field field;
-    } *list;
-  struct next_fnfieldlist
-    {
-      struct next_fnfieldlist *next;
-      struct fn_fieldlist fn_fieldlist;
-    } *fnlist;
-};
+       struct field field;
+      }
+     *list;
+    struct next_fnfieldlist
+      {
+       struct next_fnfieldlist *next;
+       struct fn_fieldlist fn_fieldlist;
+      }
+     *fnlist;
+  };
 
 static void
 read_one_struct_field PARAMS ((struct field_info *, char **, char *,
                               struct type *, struct objfile *));
 
-static char * 
-get_substring PARAMS ((char **, int));
+static char *
+  get_substring PARAMS ((char **, int));
 
 static struct type *
-dbx_alloc_type PARAMS ((int [2], struct objfile *));
+  dbx_alloc_type PARAMS ((int[2], struct objfile *));
 
 static long read_huge_number PARAMS ((char **, int, int *));
 
@@ -100,19 +106,19 @@ static int
 read_type_number PARAMS ((char **, int *));
 
 static struct type *
-read_range_type PARAMS ((char **, int [2], struct objfile *));
+  read_range_type PARAMS ((char **, int[2], struct objfile *));
 
 static struct type *
-read_sun_builtin_type PARAMS ((char **, int [2], struct objfile *));
+  read_sun_builtin_type PARAMS ((char **, int[2], struct objfile *));
 
 static struct type *
-read_sun_floating_type PARAMS ((char **, int [2], struct objfile *));
+  read_sun_floating_type PARAMS ((char **, int[2], struct objfile *));
 
 static struct type *
-read_enum_type PARAMS ((char **, struct type *, struct objfile *));
+  read_enum_type PARAMS ((char **, struct type *, struct objfile *));
 
 static struct type *
-rs6000_builtin_type PARAMS ((int));
+  rs6000_builtin_type PARAMS ((int));
 
 static int
 read_member_functions PARAMS ((struct field_info *, char **, struct type *,
@@ -138,13 +144,13 @@ attach_fields_to_type PARAMS ((struct field_info *, struct type *,
                               struct objfile *));
 
 static struct type *
-read_struct_type PARAMS ((char **, struct type *, struct objfile *));
+  read_struct_type PARAMS ((char **, struct type *, struct objfile *));
 
 static struct type *
-read_array_type PARAMS ((char **, struct type *, struct objfile *));
+  read_array_type PARAMS ((char **, struct type *, struct objfile *));
 
 static struct type **
-read_args PARAMS ((char **, int, struct objfile *));
+  read_args PARAMS ((char **, int, struct objfile *));
 
 static int
 read_cpp_abbrev PARAMS ((struct field_info *, char **, struct type *,
@@ -154,26 +160,26 @@ read_cpp_abbrev PARAMS ((struct field_info *, char **, struct type *,
 
 static int
 copy_cfront_struct_fields PARAMS ((struct field_info *, struct type *,
-                                   struct objfile *));
+                                  struct objfile *));
 
 static char *
-get_cfront_method_physname PARAMS ((char *));
+  get_cfront_method_physname PARAMS ((char *));
 
 static int
-read_cfront_baseclasses PARAMS ((struct field_info *, char **, 
+read_cfront_baseclasses PARAMS ((struct field_info *, char **,
                                 struct type *, struct objfile *));
 
 static int
-read_cfront_static_fields PARAMS ((struct field_info *, char**,
+read_cfront_static_fields PARAMS ((struct field_info *, char **,
                                   struct type *, struct objfile *));
 static int
-read_cfront_member_functions PARAMS ((struct field_info *, char **, 
+read_cfront_member_functions PARAMS ((struct field_info *, char **,
                                      struct type *, struct objfile *));
 
 /* end new functions added for cfront support */
 
 static void
-add_live_range PARAMS ((struct objfile *, struct symbol *, 
+add_live_range PARAMS ((struct objfile *, struct symbol *,
                        CORE_ADDR, CORE_ADDR));
 
 static int
@@ -183,64 +189,71 @@ static int
 process_reference PARAMS ((char **string));
 
 static CORE_ADDR
-ref_search_value PARAMS ((int refnum));
+  ref_search_value PARAMS ((int refnum));
 
 static int
 resolve_symbol_reference PARAMS ((struct objfile *, struct symbol *, char *));
 
-static const char vptr_name[] = { '_','v','p','t','r',CPLUS_MARKER,'\0' };
-static const char vb_name[] =   { '_','v','b',CPLUS_MARKER,'\0' };
+void stabsread_clear_cache PARAMS ((void));
+
+static const char vptr_name[] =
+{'_', 'v', 'p', 't', 'r', CPLUS_MARKER, '\0'};
+static const char vb_name[] =
+{'_', 'v', 'b', CPLUS_MARKER, '\0'};
 
 /* Define this as 1 if a pcc declaration of a char or short argument
    gives the correct address.  Otherwise assume pcc gives the
    address of the corresponding int, which is not the same on a
    big-endian machine.  */
 
-#ifndef BELIEVE_PCC_PROMOTION
+#if !defined (BELIEVE_PCC_PROMOTION)
 #define BELIEVE_PCC_PROMOTION 0
 #endif
+#if !defined (BELIEVE_PCC_PROMOTION_TYPE)
+#define BELIEVE_PCC_PROMOTION_TYPE 0
+#endif
 
 static struct complaint invalid_cpp_abbrev_complaint =
-  {"invalid C++ abbreviation `%s'", 0, 0};
+{"invalid C++ abbreviation `%s'", 0, 0};
 
 static struct complaint invalid_cpp_type_complaint =
-  {"C++ abbreviated type name unknown at symtab pos %d", 0, 0};
+{"C++ abbreviated type name unknown at symtab pos %d", 0, 0};
 
 static struct complaint member_fn_complaint =
-  {"member function type missing, got '%c'", 0, 0};
+{"member function type missing, got '%c'", 0, 0};
 
 static struct complaint const_vol_complaint =
-  {"const/volatile indicator missing, got '%c'", 0, 0};
+{"const/volatile indicator missing, got '%c'", 0, 0};
 
 static struct complaint error_type_complaint =
-  {"debug info mismatch between compiler and debugger", 0, 0};
+{"debug info mismatch between compiler and debugger", 0, 0};
 
 static struct complaint invalid_member_complaint =
-  {"invalid (minimal) member type data format at symtab pos %d.", 0, 0};
+{"invalid (minimal) member type data format at symtab pos %d.", 0, 0};
 
 static struct complaint range_type_base_complaint =
-  {"base type %d of range type is not defined", 0, 0};
+{"base type %d of range type is not defined", 0, 0};
 
 static struct complaint reg_value_complaint =
-  {"register number %d too large (max %d) in symbol %s", 0, 0};
+{"register number %d too large (max %d) in symbol %s", 0, 0};
 
 static struct complaint vtbl_notfound_complaint =
-  {"virtual function table pointer not found when defining class `%s'", 0, 0};
+{"virtual function table pointer not found when defining class `%s'", 0, 0};
 
 static struct complaint unrecognized_cplus_name_complaint =
-  {"Unknown C++ symbol name `%s'", 0, 0};
+{"Unknown C++ symbol name `%s'", 0, 0};
 
 static struct complaint rs6000_builtin_complaint =
-  {"Unknown builtin type %d", 0, 0};
+{"Unknown builtin type %d", 0, 0};
 
 static struct complaint unresolved_sym_chain_complaint =
-  {"%s: common block `%s' from global_sym_chain unresolved", 0, 0};
+{"%s: common block `%s' from global_sym_chain unresolved", 0, 0};
 
 static struct complaint stabs_general_complaint =
-  {"%s", 0, 0};
+{"%s", 0, 0};
 
 static struct complaint lrs_general_complaint =
-  {"%s", 0, 0};
+{"%s", 0, 0};
 
 /* Make a list of forward references which haven't been defined.  */
 
@@ -258,30 +271,31 @@ static struct symbol *current_symbol = NULL;
 \f
 /* FIXME: These probably should be our own types (like rs6000_builtin_type
    has its own types) rather than builtin_type_*.  */
-static struct type **os9k_type_vector[] = {
-       0,
-       &builtin_type_int,
-       &builtin_type_char,
-       &builtin_type_long,
-       &builtin_type_short,
-       &builtin_type_unsigned_char,
-       &builtin_type_unsigned_short,
-       &builtin_type_unsigned_long,
-       &builtin_type_unsigned_int,
-       &builtin_type_float,
-       &builtin_type_double,
-       &builtin_type_void,
-       &builtin_type_long_double
+static struct type **os9k_type_vector[] =
+{
+  0,
+  &builtin_type_int,
+  &builtin_type_char,
+  &builtin_type_long,
+  &builtin_type_short,
+  &builtin_type_unsigned_char,
+  &builtin_type_unsigned_short,
+  &builtin_type_unsigned_long,
+  &builtin_type_unsigned_int,
+  &builtin_type_float,
+  &builtin_type_double,
+  &builtin_type_void,
+  &builtin_type_long_double
 };
 
 static void os9k_init_type_vector PARAMS ((struct type **));
 
 static void
-os9k_init_type_vector(tv)
-    struct type **tv;
+os9k_init_type_vector (tv)
+     struct type **tv;
 {
-  int i;
-  for (i=0; i<sizeof(os9k_type_vector)/sizeof(struct type **); i++)
+  unsigned int i;
+  for (i = 0; i < sizeof (os9k_type_vector) / sizeof (struct type **); i++)
     tv[i] = (os9k_type_vector[i] == 0 ? 0 : *(os9k_type_vector[i]));
 }
 
@@ -308,9 +322,10 @@ dbx_lookup_type (typenums)
 
   if (filenum < 0 || filenum >= n_this_object_header_files)
     {
-      static struct complaint msg = {"\
+      static struct complaint msg =
+      {"\
 Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.",
-                               0, 0};
+       0, 0};
       complain (&msg, filenum, index, symnum);
       goto error_return;
     }
@@ -326,12 +341,12 @@ Invalid symbol data: type number (%d,%d) out of range at symtab pos %d.",
             this will do the right thing.  */
          static struct type *temp_type;
 
-         temp_type = rs6000_builtin_type(index);
+         temp_type = rs6000_builtin_type (index);
          return &temp_type;
        }
 
       /* Type is defined outside of header files.
-        Find it in this object file's type vector.  */
+         Find it in this object file's type vector.  */
       if (index >= type_vector_length)
        {
          old_len = type_vector_length;
@@ -440,33 +455,33 @@ patch_block_stabs (symbols, stabs, objfile)
 
   if (stabs)
     {
-      
+
       /* for all the stab entries, find their corresponding symbols and 
-        patch their types! */
-      
+         patch their types! */
+
       for (ii = 0; ii < stabs->count; ++ii)
        {
          name = stabs->stab[ii];
-         pp = (char*) strchr (name, ':');
+         pp = (char *) strchr (name, ':');
          while (pp[1] == ':')
            {
-              pp += 2;
-              pp = (char *)strchr(pp, ':');
+             pp += 2;
+             pp = (char *) strchr (pp, ':');
            }
-         sym = find_symbol_in_list (symbols, name, pp-name);
+         sym = find_symbol_in_list (symbols, name, pp - name);
          if (!sym)
            {
              /* FIXME-maybe: it would be nice if we noticed whether
-                the variable was defined *anywhere*, not just whether
-                it is defined in this compilation unit.  But neither
-                xlc or GCC seem to need such a definition, and until
-                we do psymtabs (so that the minimal symbols from all
-                compilation units are available now), I'm not sure
-                how to get the information.  */
+                the variable was defined *anywhere*, not just whether
+                it is defined in this compilation unit.  But neither
+                xlc or GCC seem to need such a definition, and until
+                we do psymtabs (so that the minimal symbols from all
+                compilation units are available now), I'm not sure
+                how to get the information.  */
 
              /* On xcoff, if a global is defined and never referenced,
-                ld will remove it from the executable.  There is then
-                a N_GSYM stab for it, but no regular (C_EXT) symbol.  */
+                ld will remove it from the executable.  There is then
+                a N_GSYM stab for it, but no regular (C_EXT) symbol.  */
              sym = (struct symbol *)
                obstack_alloc (&objfile->symbol_obstack,
                               sizeof (struct symbol));
@@ -477,7 +492,7 @@ patch_block_stabs (symbols, stabs, objfile)
              SYMBOL_NAME (sym) =
                obsavestring (name, pp - name, &objfile->symbol_obstack);
              pp += 2;
-             if (*(pp-1) == 'F' || *(pp-1) == 'f')
+             if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
                {
                  /* I don't think the linker does this with functions,
                     so as far as I know this is never executed.
@@ -494,7 +509,7 @@ patch_block_stabs (symbols, stabs, objfile)
          else
            {
              pp += 2;
-             if (*(pp-1) == 'F' || *(pp-1) == 'f')
+             if (*(pp - 1) == 'F' || *(pp - 1) == 'f')
                {
                  SYMBOL_TYPE (sym) =
                    lookup_function_type (read_type (&pp, objfile));
@@ -507,8 +522,8 @@ patch_block_stabs (symbols, stabs, objfile)
        }
     }
 }
-
 \f
+
 /* Read a number by which a type is referred to in dbx data,
    or perhaps read a pair (FILENUM, TYPENUM) in parentheses.
    Just a single number N is equivalent to (0,N).
@@ -527,20 +542,23 @@ read_type_number (pp, typenums)
     {
       (*pp)++;
       typenums[0] = read_huge_number (pp, ',', &nbits);
-      if (nbits != 0) return -1;
+      if (nbits != 0)
+       return -1;
       typenums[1] = read_huge_number (pp, ')', &nbits);
-      if (nbits != 0) return -1;
+      if (nbits != 0)
+       return -1;
     }
   else
     {
       typenums[0] = 0;
       typenums[1] = read_huge_number (pp, 0, &nbits);
-      if (nbits != 0) return -1;
+      if (nbits != 0)
+       return -1;
     }
   return 0;
 }
-
 \f
+
 #if !defined (REG_STRUCT_HAS_ADDR)
 #define REG_STRUCT_HAS_ADDR(gcc_p,type) 0
 #endif
@@ -558,20 +576,20 @@ read_type_number (pp, typenums)
 /* Get substring from string up to char c, advance string pointer past
    suibstring. */
 
-static char * 
+static char *
 get_substring (p, c)
-  char ** p;
-  int c;
+     char **p;
+     int c;
 {
   char *str;
   str = *p;
   *p = strchr (*p, c);
-  if (*p) 
+  if (*p)
     {
       **p = 0;
       (*p)++;
     }
-  else 
+  else
     str = 0;
   return str;
 }
@@ -581,23 +599,23 @@ get_substring (p, c)
    the physname look like that of g++ - take out the initial mangling
    eg: for sname="a" and fname="foo__1aFPFs_i" return "FPFs_i" */
 
-static char * 
+static char *
 get_cfront_method_physname (fname)
-  char *fname;
+     char *fname;
 {
   int len = 0;
   /* FIXME would like to make this generic for g++ too, but 
      that is already handled in read_member_funcctions */
-  char * p = fname;
+  char *p = fname;
 
   /* search ahead to find the start of the mangled suffix */
-  if (*p == '_' && *(p+1)=='_') /* compiler generated; probably a ctor/dtor */
-    p += 2;            
-  while (p && (unsigned) ((p+1) - fname) < strlen (fname) && *(p+1) != '_')
+  if (*p == '_' && *(p + 1) == '_')    /* compiler generated; probably a ctor/dtor */
+    p += 2;
+  while (p && (unsigned) ((p + 1) - fname) < strlen (fname) && *(p + 1) != '_')
     p = strchr (p, '_');
-  if (!(p && *p == '_' && *(p+1) == '_')) 
-    error ("Invalid mangled function name %s",fname);
-  p += 2; /* advance past '__' */
+  if (!(p && *p == '_' && *(p + 1) == '_'))
+    error ("Invalid mangled function name %s", fname);
+  p += 2;                      /* advance past '__' */
 
   /* struct name length and name of type should come next; advance past it */
   while (isdigit (*p))
@@ -612,27 +630,29 @@ get_cfront_method_physname (fname)
 
 /* Read base classes within cfront class definition.
    eg: A:ZcA;1@Bpub v2@Bvirpri;__ct__1AFv func__1AFv *sfunc__1AFv ;as__1A ;;
-             ^^^^^^^^^^^^^^^^^^
+   ^^^^^^^^^^^^^^^^^^
 
-       A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;;
-             ^
  */
+   A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;;
+   ^
+ */
 
 static int
-read_cfront_baseclasses (fip, pp, type, objfile) 
-  struct field_info *fip;
-  struct objfile *objfile;
-  char ** pp;
-  struct type *type;
+read_cfront_baseclasses (fip, pp, type, objfile)
+     struct field_info *fip;
+     struct objfile *objfile;
+     char **pp;
+     struct type *type;
 {
-  static struct complaint msg_unknown = {"\
+  static struct complaint msg_unknown =
+  {"\
         Unsupported token in stabs string %s.\n",
-                 0, 0};
-  static struct complaint msg_notfound = {"\
+   0, 0};
+  static struct complaint msg_notfound =
+  {"\
                   Unable to find base type for %s.\n",
-                                0, 0};
+   0, 0};
   int bnum = 0;
-  char * p;
+  char *p;
   int i;
   struct nextfield *new;
 
@@ -648,12 +668,12 @@ read_cfront_baseclasses (fip, pp, type, objfile)
       if (*p == ' ')
        bnum++;
     }
-  bnum++;      /* add one more for last one */
+  bnum++;                      /* add one more for last one */
 
   /* now parse the base classes until we get to the start of the methods 
      (code extracted and munged from read_baseclasses) */
   ALLOCATE_CPLUS_STRUCT_TYPE (type);
-  TYPE_N_BASECLASSES(type) = bnum;
+  TYPE_N_BASECLASSES (type) = bnum;
 
   /* allocate space */
   {
@@ -670,87 +690,88 @@ read_cfront_baseclasses (fip, pp, type, objfile)
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
       make_cleanup (free, new);
       memset (new, 0, sizeof (struct nextfield));
-      new -> next = fip -> list;
-      fip -> list = new;
-      FIELD_BITSIZE (new->field) = 0; /* this should be an unpacked field! */
+      new->next = fip->list;
+      fip->list = new;
+      FIELD_BITSIZE (new->field) = 0;  /* this should be an unpacked field! */
 
       STABS_CONTINUE (pp, objfile);
 
       /* virtual?  eg: v2@Bvir */
-      if (**pp=='v')
-        {
-          SET_TYPE_FIELD_VIRTUAL (type, i);
-          ++(*pp);
+      if (**pp == 'v')
+       {
+         SET_TYPE_FIELD_VIRTUAL (type, i);
+         ++(*pp);
        }
 
       /* access?  eg: 2@Bvir */
-       /* Note: protected inheritance not supported in cfront */
+      /* Note: protected inheritance not supported in cfront */
       switch (*(*pp)++)
-        {
-          case CFRONT_VISIBILITY_PRIVATE:
-            new -> visibility = VISIBILITY_PRIVATE;
-            break;
-          case CFRONT_VISIBILITY_PUBLIC:
-            new -> visibility = VISIBILITY_PUBLIC;
-            break;
-          default:
-            /* Bad visibility format.  Complain and treat it as
-               public.  */
-            {
-              static struct complaint msg = {
-                "Unknown visibility `%c' for baseclass", 0, 0};
-              complain (&msg, new -> visibility);
-              new -> visibility = VISIBILITY_PUBLIC;
-            }
-        }
+       {
+       case CFRONT_VISIBILITY_PRIVATE:
+         new->visibility = VISIBILITY_PRIVATE;
+         break;
+       case CFRONT_VISIBILITY_PUBLIC:
+         new->visibility = VISIBILITY_PUBLIC;
+         break;
+       default:
+         /* Bad visibility format.  Complain and treat it as
+            public.  */
+         {
+           static struct complaint msg =
+           {
+             "Unknown visibility `%c' for baseclass", 0, 0};
+           complain (&msg, new->visibility);
+           new->visibility = VISIBILITY_PUBLIC;
+         }
+       }
 
       /* "@" comes next - eg: @Bvir */
-      if (**pp!='@')
-        {
-          complain (&msg_unknown, *pp);
-          return 1;
+      if (**pp != '@')
+       {
+         complain (&msg_unknown, *pp);
+         return 1;
        }
       ++(*pp);
 
 
-        /* Set the bit offset of the portion of the object corresponding 
-          to this baseclass.  Always zero in the absence of
-           multiple inheritance.  */
-       /* Unable to read bit position from stabs;
-          Assuming no multiple inheritance for now FIXME! */
-       /* We may have read this in the structure definition;
-          now we should fixup the members to be the actual base classes */
-        FIELD_BITPOS (new->field) = 0;
+      /* Set the bit offset of the portion of the object corresponding 
+         to this baseclass.  Always zero in the absence of
+         multiple inheritance.  */
+      /* Unable to read bit position from stabs;
+         Assuming no multiple inheritance for now FIXME! */
+      /* We may have read this in the structure definition;
+         now we should fixup the members to be the actual base classes */
+      FIELD_BITPOS (new->field) = 0;
 
-       /* Get the base class name and type */
+      /* Get the base class name and type */
+      {
+       char *bname;            /* base class name */
+       struct symbol *bsym;    /* base class */
+       char *p1, *p2;
+       p1 = strchr (*pp, ' ');
+       p2 = strchr (*pp, ';');
+       if (p1 < p2)
+         bname = get_substring (pp, ' ');
+       else
+         bname = get_substring (pp, ';');
+       if (!bname || !*bname)
          {
-           char * bname;               /* base class name */
-           struct symbol * bsym;       /* base class */
-           char * p1, * p2;
-           p1 = strchr (*pp,' ');
-           p2 = strchr (*pp,';');
-           if (p1<p2)
-              bname = get_substring (pp,' ');
-           else
-              bname = get_substring (pp,';');
-            if (!bname || !*bname)
-             {
-               complain (&msg_unknown, *pp);
-               return 1;
-             }
-           /* FIXME! attach base info to type */
-           bsym = lookup_symbol (bname, 0, STRUCT_NAMESPACE, 0, 0); /*demangled_name*/
-           if (bsym) 
-             {
-               new -> field.type = SYMBOL_TYPE(bsym);
-               new -> field.name = type_name_no_tag (new -> field.type);
-             }
-           else
-             {
-               complain (&msg_notfound, *pp);
-               return 1;
-             }
+           complain (&msg_unknown, *pp);
+           return 1;
+         }
+       /* FIXME! attach base info to type */
+       bsym = lookup_symbol (bname, 0, STRUCT_NAMESPACE, 0, 0);        /*demangled_name */
+       if (bsym)
+         {
+           new->field.type = SYMBOL_TYPE (bsym);
+           new->field.name = type_name_no_tag (new->field.type);
+         }
+       else
+         {
+           complain (&msg_notfound, *pp);
+           return 1;
          }
+      }
 
       /* If more base classes to parse, loop again.
          We ate the last ' ' or ';' in get_substring,
@@ -763,10 +784,10 @@ read_cfront_baseclasses (fip, pp, type, objfile)
 /* read cfront member functions.
    pp points to string starting with list of functions
    eg: A:ZcA;1@Bpub v2@Bvirpri;__ct__1AFv func__1AFv *sfunc__1AFv ;as__1A ;;
-                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
-       A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;;
-              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
-*/
+   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
+   A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;;
+   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
+ */
 
 static int
 read_cfront_member_functions (fip, pp, type, objfile)
@@ -789,171 +810,173 @@ read_cfront_member_functions (fip, pp, type, objfile)
     {
       struct next_fnfield *next;
       struct fn_field fn_field;
-    } *sublist;
+    }
+   *sublist;
   struct type *look_ahead_type;
   struct next_fnfieldlist *new_fnlist;
   struct next_fnfield *new_sublist;
   char *main_fn_name;
-  char * fname;
-  struct symbol * ref_func = 0;
-      
+  char *fname;
+  struct symbol *ref_func = 0;
+
   /* Process each list until we find the end of the member functions.
      eg: p = "__ct__1AFv foo__1AFv ;;;" */
 
-  STABS_CONTINUE (pp, objfile);                /* handle \\ */
+  STABS_CONTINUE (pp, objfile);        /* handle \\ */
 
-  while (**pp != ';' && (fname = get_substring (pp, ' '), fname)) 
+  while (**pp != ';' && (fname = get_substring (pp, ' '), fname))
     {
       int is_static = 0;
       int sublist_count = 0;
-      char * pname;
-      if (fname[0] == '*')      /* static member */
-        {
-          is_static=1;
-          sublist_count++;
-          fname++;
-        }
-      ref_func = lookup_symbol (fname, 0, VAR_NAMESPACE, 0, 0); /* demangled name */
-      if (!ref_func) 
-        {
-          static struct complaint msg = {"\
+      char *pname;
+      if (fname[0] == '*')     /* static member */
+       {
+         is_static = 1;
+         sublist_count++;
+         fname++;
+       }
+      ref_func = lookup_symbol (fname, 0, VAR_NAMESPACE, 0, 0);                /* demangled name */
+      if (!ref_func)
+       {
+         static struct complaint msg =
+         {"\
                Unable to find function symbol for %s\n",
-                                0, 0};
+          0, 0};
          complain (&msg, fname);
          continue;
        }
       sublist = NULL;
       look_ahead_type = NULL;
       length = 0;
-          
+
       new_fnlist = (struct next_fnfieldlist *)
-      xmalloc (sizeof (struct next_fnfieldlist));
+       xmalloc (sizeof (struct next_fnfieldlist));
       make_cleanup (free, new_fnlist);
       memset (new_fnlist, 0, sizeof (struct next_fnfieldlist));
-          
+
       /* The following is code to work around cfront generated stabs.
          The stabs contains full mangled name for each field.
          We try to demangle the name and extract the field name out of it.  */
       {
-        char *dem, *dem_p, *dem_args;
-        int dem_len;
-        dem = cplus_demangle (fname, DMGL_ANSI | DMGL_PARAMS);
-        if (dem != NULL)
-          {
-            dem_p = strrchr (dem, ':');
-            if (dem_p != 0 && *(dem_p-1) == ':')
-              dem_p++;
+       char *dem, *dem_p, *dem_args;
+       int dem_len;
+       dem = cplus_demangle (fname, DMGL_ANSI | DMGL_PARAMS);
+       if (dem != NULL)
+         {
+           dem_p = strrchr (dem, ':');
+           if (dem_p != 0 && *(dem_p - 1) == ':')
+             dem_p++;
            /* get rid of args */
-            dem_args = strchr (dem_p, '(');
+           dem_args = strchr (dem_p, '(');
            if (dem_args == NULL)
              dem_len = strlen (dem_p);
            else
-             dem_len = dem_args - dem_p;
-            main_fn_name =
-                   obsavestring (dem_p, dem_len, &objfile -> type_obstack);
-          }
-        else
-          {
-            main_fn_name =
-                   obsavestring (fname, strlen (fname), &objfile -> type_obstack);
-          }
-      } /* end of code for cfront work around */
-
-    new_fnlist -> fn_fieldlist.name = main_fn_name;
-      
-    /*-------------------------------------------------*/
-    /* Set up the sublists
-       Sublists are stuff like args, static, visibility, etc.
-       so in ARM, we have to set that info some other way.
-       Multiple sublists happen if overloading
-       eg: foo::26=##1;:;2A.;
-       In g++, we'd loop here thru all the sublists...  */
-
-    new_sublist =
-       (struct next_fnfield *) xmalloc (sizeof (struct next_fnfield));
-    make_cleanup (free, new_sublist);
-    memset (new_sublist, 0, sizeof (struct next_fnfield));
-         
-    /* eat 1; from :;2A.; */
-    new_sublist -> fn_field.type = SYMBOL_TYPE(ref_func); /* normally takes a read_type */
-    /* Make this type look like a method stub for gdb */
-    TYPE_FLAGS (new_sublist -> fn_field.type) |= TYPE_FLAG_STUB;
-    TYPE_CODE (new_sublist -> fn_field.type) = TYPE_CODE_METHOD;
-
-    /* If this is just a stub, then we don't have the real name here. */
-    if (TYPE_FLAGS (new_sublist -> fn_field.type) & TYPE_FLAG_STUB)
-      {
-        if (!TYPE_DOMAIN_TYPE (new_sublist -> fn_field.type))
-        TYPE_DOMAIN_TYPE (new_sublist -> fn_field.type) = type;
-        new_sublist -> fn_field.is_stub = 1;
-      }
+             dem_len = dem_args - dem_p;
+           main_fn_name =
+             obsavestring (dem_p, dem_len, &objfile->type_obstack);
+         }
+       else
+         {
+           main_fn_name =
+             obsavestring (fname, strlen (fname), &objfile->type_obstack);
+         }
+      }                                /* end of code for cfront work around */
+
+      new_fnlist->fn_fieldlist.name = main_fn_name;
+
+/*-------------------------------------------------*/
+      /* Set up the sublists
+         Sublists are stuff like args, static, visibility, etc.
+         so in ARM, we have to set that info some other way.
+         Multiple sublists happen if overloading
+         eg: foo::26=##1;:;2A.;
+         In g++, we'd loop here thru all the sublists...  */
+
+      new_sublist =
+       (struct next_fnfield *) xmalloc (sizeof (struct next_fnfield));
+      make_cleanup (free, new_sublist);
+      memset (new_sublist, 0, sizeof (struct next_fnfield));
+
+      /* eat 1; from :;2A.; */
+      new_sublist->fn_field.type = SYMBOL_TYPE (ref_func);     /* normally takes a read_type */
+      /* Make this type look like a method stub for gdb */
+      TYPE_FLAGS (new_sublist->fn_field.type) |= TYPE_FLAG_STUB;
+      TYPE_CODE (new_sublist->fn_field.type) = TYPE_CODE_METHOD;
+
+      /* If this is just a stub, then we don't have the real name here. */
+      if (TYPE_FLAGS (new_sublist->fn_field.type) & TYPE_FLAG_STUB)
+       {
+         if (!TYPE_DOMAIN_TYPE (new_sublist->fn_field.type))
+           TYPE_DOMAIN_TYPE (new_sublist->fn_field.type) = type;
+         new_sublist->fn_field.is_stub = 1;
+       }
+
+      /* physname used later in mangling; eg PFs_i,5 for foo__1aFPFs_i 
+         physname gets strcat'd in order to recreate the onto mangled name */
+      pname = get_cfront_method_physname (fname);
+      new_sublist->fn_field.physname = savestring (pname, strlen (pname));
 
-    /* physname used later in mangling; eg PFs_i,5 for foo__1aFPFs_i 
-       physname gets strcat'd in order to recreate the onto mangled name */
-    pname = get_cfront_method_physname (fname);
-    new_sublist -> fn_field.physname = savestring (pname, strlen (pname));
-      
 
-    /* Set this member function's visibility fields. 
-       Unable to distinguish access from stabs definition!
+      /* Set this member function's visibility fields. 
+         Unable to distinguish access from stabs definition!
          Assuming public for now.  FIXME!
-        (for private, set new_sublist->fn_field.is_private = 1,
-        for public, set new_sublist->fn_field.is_protected = 1) */
-       
-    /* Unable to distinguish const/volatile from stabs definition!
-       Assuming normal for now.  FIXME! */
-
-    new_sublist -> fn_field.is_const = 0;
-    new_sublist -> fn_field.is_volatile = 0;   /* volatile not implemented in cfront */
-         
-    /* Set virtual/static function info
-       How to get vtable offsets ? 
-       Assuming normal for now FIXME!! 
-       For vtables, figure out from whence this virtual function came.
-       It may belong to virtual function table of
-       one of its baseclasses.
-        set:
-          new_sublist -> fn_field.voffset = vtable offset,
-          new_sublist -> fn_field.fcontext = look_ahead_type;
-          where look_ahead_type is type of baseclass */
-    if (is_static)
-      new_sublist -> fn_field.voffset = VOFFSET_STATIC;
-    else                               /* normal member function.  */
-      new_sublist -> fn_field.voffset = 0;
-    new_sublist -> fn_field.fcontext = 0;
-
-    /* Prepare new sublist */
-    new_sublist -> next = sublist;
-    sublist = new_sublist;
-    length++;
-
-    /* In g++, we loop thu sublists - now we set from functions. */
-    new_fnlist -> fn_fieldlist.fn_fields = (struct fn_field *)
-         obstack_alloc (&objfile -> type_obstack, 
-              sizeof (struct fn_field) * length);
-    memset (new_fnlist -> fn_fieldlist.fn_fields, 0,
-           sizeof (struct fn_field) * length);
-    for (i = length; (i--, sublist); sublist = sublist -> next)
-      {
-        new_fnlist -> fn_fieldlist.fn_fields[i] = sublist -> fn_field;
-      }
-      
-    new_fnlist -> fn_fieldlist.length = length;
-    new_fnlist -> next = fip -> fnlist;
-    fip -> fnlist = new_fnlist;
-    nfn_fields++;
-    total_length += length;
-    STABS_CONTINUE (pp, objfile); /* handle \\ */
-  } /* end of loop */
+         (for private, set new_sublist->fn_field.is_private = 1,
+         for public, set new_sublist->fn_field.is_protected = 1) */
+
+      /* Unable to distinguish const/volatile from stabs definition!
+         Assuming normal for now.  FIXME! */
+
+      new_sublist->fn_field.is_const = 0;
+      new_sublist->fn_field.is_volatile = 0;   /* volatile not implemented in cfront */
+
+      /* Set virtual/static function info
+         How to get vtable offsets ? 
+         Assuming normal for now FIXME!! 
+         For vtables, figure out from whence this virtual function came.
+         It may belong to virtual function table of
+         one of its baseclasses.
+         set:
+         new_sublist -> fn_field.voffset = vtable offset,
+         new_sublist -> fn_field.fcontext = look_ahead_type;
+         where look_ahead_type is type of baseclass */
+      if (is_static)
+       new_sublist->fn_field.voffset = VOFFSET_STATIC;
+      else                     /* normal member function.  */
+       new_sublist->fn_field.voffset = 0;
+      new_sublist->fn_field.fcontext = 0;
+
+
+      /* Prepare new sublist */
+      new_sublist->next = sublist;
+      sublist = new_sublist;
+      length++;
+
+      /* In g++, we loop thu sublists - now we set from functions. */
+      new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *)
+       obstack_alloc (&objfile->type_obstack,
+                      sizeof (struct fn_field) * length);
+      memset (new_fnlist->fn_fieldlist.fn_fields, 0,
+             sizeof (struct fn_field) * length);
+      for (i = length; (i--, sublist); sublist = sublist->next)
+       {
+         new_fnlist->fn_fieldlist.fn_fields[i] = sublist->fn_field;
+       }
+
+      new_fnlist->fn_fieldlist.length = length;
+      new_fnlist->next = fip->fnlist;
+      fip->fnlist = new_fnlist;
+      nfn_fields++;
+      total_length += length;
+      STABS_CONTINUE (pp, objfile);    /* handle \\ */
+    }                          /* end of loop */
 
   if (nfn_fields)
     {
       /* type should already have space */
       TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
-      TYPE_ALLOC (type, sizeof (struct fn_fieldlist) * nfn_fields);
+       TYPE_ALLOC (type, sizeof (struct fn_fieldlist) * nfn_fields);
       memset (TYPE_FN_FIELDLISTS (type), 0,
-               sizeof (struct fn_fieldlist) * nfn_fields);
+             sizeof (struct fn_fieldlist) * nfn_fields);
       TYPE_NFN_FIELDS (type) = nfn_fields;
       TYPE_NFN_FIELDS_TOTAL (type) = total_length;
     }
@@ -976,12 +999,12 @@ read_cfront_member_functions (fip, pp, type, objfile)
    Examples of "p": "sA;;__ct__1AFv foo__1AFv ;;;" */
 int
 resolve_cfront_continuation (objfile, sym, p)
-  struct objfile * objfile;
-  struct symbol * sym;
-  char * p;
+     struct objfile *objfile;
+     struct symbol *sym;
+     char *p;
 {
-  struct symbol * ref_sym=0;
-  char * sname;
+  struct symbol *ref_sym = 0;
+  char *sname;
   /* snarfed from read_struct_type */
   struct field_info fi;
   struct type *type;
@@ -990,7 +1013,7 @@ resolve_cfront_continuation (objfile, sym, p)
   /* Need to make sure that fi isn't gunna conflict with struct 
      in case struct already had some fnfs */
   fi.list = NULL;
-  fi.fnlist = NULL;       
+  fi.fnlist = NULL;
   back_to = make_cleanup (null_cleanup, 0);
 
   /* We only accept structs, classes and unions at the moment. 
@@ -998,23 +1021,23 @@ resolve_cfront_continuation (objfile, sym, p)
      We may want to add support for them as well; 
      right now they are handled by duplicating the symbol information 
      into the type information (see define_symbol) */
-  if (*p != 's'       /* structs */
-    && *p != 'c'      /* class */
-    && *p != 'u')     /* union */
-    return 0;  /* only handle C++ types */
-  p++;  
+  if (*p != 's'                        /* structs */
+      && *p != 'c'             /* class */
+      && *p != 'u')            /* union */
+    return 0;                  /* only handle C++ types */
+  p++;
 
   /* Get symbol typs name and validate 
      eg: p = "A;;__ct__1AFv foo__1AFv ;;;" */
   sname = get_substring (&p, ';');
-  if (!sname || strcmp (sname, SYMBOL_NAME(sym)))
+  if (!sname || strcmp (sname, SYMBOL_NAME (sym)))
     error ("Internal error: base symbol type name does not match\n");
 
   /* Find symbol's internal gdb reference using demangled_name.
      This is the real sym that we want; 
      sym was a temp hack to make debugger happy */
-  ref_sym = lookup_symbol (SYMBOL_NAME(sym), 0, STRUCT_NAMESPACE, 0, 0); 
-  type = SYMBOL_TYPE(ref_sym);
+  ref_sym = lookup_symbol (SYMBOL_NAME (sym), 0, STRUCT_NAMESPACE, 0, 0);
+  type = SYMBOL_TYPE (ref_sym);
 
 
   /* Now read the baseclasses, if any, read the regular C struct or C++
@@ -1023,22 +1046,22 @@ resolve_cfront_continuation (objfile, sym, p)
      field (baseclass specifier for the class holding the main vtable). */
 
   if (!read_cfront_baseclasses (&fi, &p, type, objfile)
-      /* g++ does this next, but cfront already did this: 
-           || !read_struct_fields (&fi, &p, type, objfile) */
+  /* g++ does this next, but cfront already did this: 
+     || !read_struct_fields (&fi, &p, type, objfile) */
       || !copy_cfront_struct_fields (&fi, type, objfile)
       || !read_cfront_member_functions (&fi, &p, type, objfile)
       || !read_cfront_static_fields (&fi, &p, type, objfile)
       || !attach_fields_to_type (&fi, type, objfile)
       || !attach_fn_fields_to_type (&fi, type)
-      /* g++ does this next, but cfront doesn't seem to have this: 
-               || !read_tilde_fields (&fi, &p, type, objfile) */
-      )
+  /* g++ does this next, but cfront doesn't seem to have this: 
+     || !read_tilde_fields (&fi, &p, type, objfile) */
+    )
     {
       type = error_type (&p, objfile);
     }
 
   do_cleanups (back_to);
-  return 0;  
+  return 0;
 }
 /* End of code added to support parsing of ARM/Cfront stabs strings */
 
@@ -1048,28 +1071,28 @@ resolve_cfront_continuation (objfile, sym, p)
 
 static int
 resolve_symbol_reference (objfile, sym, p)
-  struct objfile *objfile;
-  struct symbol *sym;
-  char *p;
+     struct objfile *objfile;
+     struct symbol *sym;
+     char *p;
 {
   int refnum;
-  struct symbol *ref_sym=0;
+  struct symbol *ref_sym = 0;
   struct alias_list *alias;
 
   /* If this is not a symbol reference return now.  */
   if (*p != '#')
-    return 0;  
+    return 0;
 
   /* Use "#<num>" as the name; we'll fix the name later.
      We stored the original symbol name as "#<id>=<name>"
      so we can now search for "#<id>" to resolving the reference.
      We'll fix the names later by removing the "#<id>" or "#<id>=" */
 
-  /*---------------------------------------------------------*/
+/*---------------------------------------------------------*/
   /* Get the reference id number, and 
      advance p past the names so we can parse the rest. 
-       eg: id=2 for p : "2=", "2=z:r(0,1)" "2:r(0,1);l(#5,#6),l(#7,#4)" */
-  /*---------------------------------------------------------*/
+     eg: id=2 for p : "2=", "2=z:r(0,1)" "2:r(0,1);l(#5,#6),l(#7,#4)" */
+/*---------------------------------------------------------*/
 
   /* This gets reference name from string.  sym may not have a name. */
 
@@ -1091,26 +1114,26 @@ resolve_symbol_reference (objfile, sym, p)
 
 
   /* If the stab symbol table and string contain:
-         RSYM   0      5      00000000 868    #15=z:r(0,1)
-         LBRAC  0      0      00000000 899    #5=
-         SLINE  0      16     00000003 923    #6=
+     RSYM   0      5      00000000 868    #15=z:r(0,1)
+     LBRAC  0      0      00000000 899    #5=
+     SLINE  0      16     00000003 923    #6=
      Then the same symbols can be later referenced by:
-         RSYM   0      5      00000000 927    #15:r(0,1);l(#5,#6)
+     RSYM   0      5      00000000 927    #15:r(0,1);l(#5,#6)
      This is used in live range splitting to:
      1) specify that a symbol (#15) is actually just a new storage 
-        class for a symbol (#15=z) which was previously defined.
+     class for a symbol (#15=z) which was previously defined.
      2) specify that the beginning and ending ranges for a symbol 
-        (#15) are the values of the beginning (#5) and ending (#6) 
-        symbols. */
-       
-   /* Read number as reference id.
-      eg: p : "=", "=z:r(0,1)" ":r(0,1);l(#5,#6),l(#7,#4)" */
-   /* FIXME! Might I want to use SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
-      in case of "l(0,0)"? */
-
-   /*--------------------------------------------------*/
-   /* Add this symbol to the reference list.           */
-   /*--------------------------------------------------*/
+     (#15) are the values of the beginning (#5) and ending (#6) 
+     symbols. */
+
+  /* Read number as reference id.
+     eg: p : "=", "=z:r(0,1)" ":r(0,1);l(#5,#6),l(#7,#4)" */
+  /* FIXME! Might I want to use SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
+     in case of "l(0,0)"? */
+
+/*--------------------------------------------------*/
+  /* Add this symbol to the reference list.           */
+/*--------------------------------------------------*/
 
   alias = (struct alias_list *) obstack_alloc (&objfile->type_obstack,
                                               sizeof (struct alias_list));
@@ -1139,11 +1162,11 @@ resolve_symbol_reference (objfile, sym, p)
       temp->next = alias;
     }
 
-   /* Want to fix up name so that other functions (eg. valops)
-      will correctly print the name.
-      Don't add_symbol_to_list so that lookup_symbol won't find it.
-      nope... needed for fixups. */
-   SYMBOL_NAME (sym) = SYMBOL_NAME (ref_sym);
+  /* Want to fix up name so that other functions (eg. valops)
+     will correctly print the name.
+     Don't add_symbol_to_list so that lookup_symbol won't find it.
+     nope... needed for fixups. */
+  SYMBOL_NAME (sym) = SYMBOL_NAME (ref_sym);
 
   /* Done!  */
   return 1;
@@ -1163,14 +1186,24 @@ struct ref_map
 #define REF_CHUNK_SIZE (MAX_CHUNK_REFS * sizeof (struct ref_map))
 #define REF_MAP_SIZE(ref_chunk) ((ref_chunk) * REF_CHUNK_SIZE)
 
-static struct ref_map *ref_map;        
+static struct ref_map *ref_map;
 
 /* Ptr to free cell in chunk's linked list. */
-static int ref_count = 0;      
+static int ref_count = 0;
 
 /* Number of chunks malloced. */
 static int ref_chunk = 0;
 
+/* This file maintains a cache of stabs aliases found in the symbol
+   table. If the symbol table changes, this cache must be cleared
+   or we are left holding onto data in invalid obstacks. */
+void
+stabsread_clear_cache ()
+{
+  ref_count = 0;
+  ref_chunk = 0;
+}
+
 /* Create array of pointers mapping refids to symbols and stab strings.
    Add pointers to reference definition symbols and/or their values as we 
    find them, using their reference numbers as our index. 
@@ -1188,7 +1221,7 @@ ref_add (refnum, sym, stabs, value)
     ref_count = refnum + 1;
   if (ref_count > ref_chunk * MAX_CHUNK_REFS)
     {
-      int new_slots = ref_count - ref_chunk * MAX_CHUNK_REFS; 
+      int new_slots = ref_count - ref_chunk * MAX_CHUNK_REFS;
       int new_chunks = new_slots / MAX_CHUNK_REFS + 1;
       ref_map = (struct ref_map *)
        xrealloc (ref_map, REF_MAP_SIZE (ref_chunk + new_chunks));
@@ -1220,20 +1253,20 @@ ref_search_value (refnum)
     return 0;
   return ref_map[refnum].value;
 }
-   
+
 /* Parse a reference id in STRING and return the resulting
    reference number.  Move STRING beyond the reference id.  */
 
-static int 
+static int
 process_reference (string)
-    char **string;
+     char **string;
 {
   char *p;
   int refnum = 0;
 
-  if (**string != '#') 
-    return 0;  
-     
+  if (**string != '#')
+    return 0;
+
   /* Advance beyond the initial '#'.  */
   p = *string + 1;
 
@@ -1260,9 +1293,9 @@ symbol_reference_defined (string)
   refnum = process_reference (&p);
 
   /* Defining symbols end in '=' */
-  if (*p == '=') 
+  if (*p == '=')
     {
-      /* Symbol is being defined here. */ 
+      /* Symbol is being defined here. */
       *string = p + 1;
       return refnum;
     }
@@ -1307,40 +1340,40 @@ define_symbol (valu, string, desc, type, objfile)
 
   while (p[1] == ':')
     {
-       p += 2;
-       p = strchr (p, ':');
+      p += 2;
+      p = strchr (p, ':');
     }
 
   /* If a nameless stab entry, all we need is the type, not the symbol.
      e.g. ":t10=*2" or a nameless enum like " :T16=ered:0,green:1,blue:2,;" */
   nameless = (p == string || ((string[0] == ' ') && (string[1] == ':')));
 
-  current_symbol = sym = (struct symbol *) 
-    obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
+  current_symbol = sym = (struct symbol *)
+    obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
 
   switch (type & N_TYPE)
     {
     case N_TEXT:
-      SYMBOL_SECTION(sym) = SECT_OFF_TEXT;
+      SYMBOL_SECTION (sym) = SECT_OFF_TEXT;
       break;
     case N_DATA:
-      SYMBOL_SECTION(sym) = SECT_OFF_DATA;
+      SYMBOL_SECTION (sym) = SECT_OFF_DATA;
       break;
     case N_BSS:
-      SYMBOL_SECTION(sym) = SECT_OFF_BSS;
+      SYMBOL_SECTION (sym) = SECT_OFF_BSS;
       break;
     }
 
   if (processing_gcc_compilation)
     {
       /* GCC 2.x puts the line number in desc.  SunOS apparently puts in the
-        number of bytes occupied by a type or object, which we ignore.  */
-      SYMBOL_LINE(sym) = desc;
+         number of bytes occupied by a type or object, which we ignore.  */
+      SYMBOL_LINE (sym) = desc;
     }
   else
     {
-      SYMBOL_LINE(sym) = 0;                    /* unknown */
+      SYMBOL_LINE (sym) = 0;   /* unknown */
     }
 
   if (is_cplus_marker (string[0]))
@@ -1348,33 +1381,33 @@ define_symbol (valu, string, desc, type, objfile)
       /* Special GNU C++ names.  */
       switch (string[1])
        {
-         case 't':
-           SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"),
-                                             &objfile -> symbol_obstack);
-           break;
+       case 't':
+         SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"),
+                                           &objfile->symbol_obstack);
+         break;
 
-         case 'v': /* $vtbl_ptr_type */
-           /* Was: SYMBOL_NAME (sym) = "vptr"; */
-           goto normal;
+       case 'v':               /* $vtbl_ptr_type */
+         /* Was: SYMBOL_NAME (sym) = "vptr"; */
+         goto normal;
 
-         case 'e':
-           SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"),
-                                             &objfile -> symbol_obstack);
-           break;
+       case 'e':
+         SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"),
+                                           &objfile->symbol_obstack);
+         break;
 
-         case '_':
-           /* This was an anonymous type that was never fixed up.  */
-           goto normal;
+       case '_':
+         /* This was an anonymous type that was never fixed up.  */
+         goto normal;
 
 #ifdef STATIC_TRANSFORM_NAME
-         case 'X':
-           /* SunPRO (3.0 at least) static variable encoding.  */
-           goto normal;
+       case 'X':
+         /* SunPRO (3.0 at least) static variable encoding.  */
+         goto normal;
 #endif
 
-         default:
-           complain (&unrecognized_cplus_name_complaint, string);
-           goto normal;                /* Do *something* with it */
+       default:
+         complain (&unrecognized_cplus_name_complaint, string);
+         goto normal;          /* Do *something* with it */
        }
     }
   else if (string[0] == '#')
@@ -1384,26 +1417,25 @@ define_symbol (valu, string, desc, type, objfile)
       int refnum, nlen;
 
       /* If STRING defines a new reference id, then add it to the
-        reference map.  Else it must be referring to a previously
-        defined symbol, so add it to the alias list of the previously
-        defined symbol.  */
+         reference map.  Else it must be referring to a previously
+         defined symbol, so add it to the alias list of the previously
+         defined symbol.  */
       s = string;
       refnum = symbol_reference_defined (&s);
       if (refnum >= 0)
-         ref_add (refnum, sym, string, SYMBOL_VALUE (sym));
-      else
-       if (!resolve_symbol_reference (objfile, sym, string))
-         return NULL;
+       ref_add (refnum, sym, string, SYMBOL_VALUE (sym));
+      else if (!resolve_symbol_reference (objfile, sym, string))
+       return NULL;
 
       /* S..P contains the name of the symbol.  We need to store
-        the correct name into SYMBOL_NAME.  */
+         the correct name into SYMBOL_NAME.  */
       nlen = p - s;
       if (refnum >= 0)
        {
          if (nlen > 0)
            {
              SYMBOL_NAME (sym) = (char *)
-               obstack_alloc (&objfile -> symbol_obstack, nlen);
+               obstack_alloc (&objfile->symbol_obstack, nlen);
              strncpy (SYMBOL_NAME (sym), s, nlen);
              SYMBOL_NAME (sym)[nlen] = '\0';
              SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
@@ -1413,8 +1445,8 @@ define_symbol (valu, string, desc, type, objfile)
               Get error if leave name 0.  So give it something. */
            {
              nlen = p - string;
-             SYMBOL_NAME (sym) = (char *)
-               obstack_alloc (&objfile -> symbol_obstack, nlen);
+             SYMBOL_NAME (sym) = (char *)
+               obstack_alloc (&objfile->symbol_obstack, nlen);
              strncpy (SYMBOL_NAME (sym), string, nlen);
              SYMBOL_NAME (sym)[nlen] = '\0';
              SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
@@ -1426,14 +1458,14 @@ define_symbol (valu, string, desc, type, objfile)
   else
     {
     normal:
-      SYMBOL_LANGUAGE (sym) = current_subfile -> language;
-      SYMBOL_NAME (sym)        = (char *)
-       obstack_alloc (&objfile -> symbol_obstack, ((p - string) + 1));
+      SYMBOL_LANGUAGE (sym) = current_subfile->language;
+      SYMBOL_NAME (sym) = (char *)
+       obstack_alloc (&objfile->symbol_obstack, ((p - string) + 1));
       /* Open-coded memcpy--saves function call time.  */
       /* FIXME:  Does it really?  Try replacing with simple strcpy and
-        try it on an executable with a large symbol table. */
+         try it on an executable with a large symbol table. */
       /* FIXME: considering that gcc can open code memcpy anyway, I
-        doubt it.  xoxorich. */
+         doubt it.  xoxorich. */
       {
        register char *p1 = string;
        register char *p2 = SYMBOL_NAME (sym);
@@ -1445,9 +1477,9 @@ define_symbol (valu, string, desc, type, objfile)
       }
 
       /* If this symbol is from a C++ compilation, then attempt to cache the
-        demangled form for future reference.  This is a typical time versus
-        space tradeoff, that was decided in favor of time because it sped up
-        C++ symbol lookups by a factor of about 20. */
+         demangled form for future reference.  This is a typical time versus
+         space tradeoff, that was decided in favor of time because it sped up
+         C++ symbol lookups by a factor of about 20. */
 
       SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack);
     }
@@ -1474,11 +1506,11 @@ define_symbol (valu, string, desc, type, objfile)
     {
     case 'c':
       /* c is a special case, not followed by a type-number.
-        SYMBOL:c=iVALUE for an integer constant symbol.
-        SYMBOL:c=rVALUE for a floating constant symbol.
-        SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
-        e.g. "b:c=e6,0" for "const b = blob1"
-        (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;").  */
+         SYMBOL:c=iVALUE for an integer constant symbol.
+         SYMBOL:c=rVALUE for a floating constant symbol.
+         SYMBOL:c=eTYPE,INTVALUE for an enum constant symbol.
+         e.g. "b:c=e6,0" for "const b = blob1"
+         (where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;").  */
       if (*p != '=')
        {
          SYMBOL_CLASS (sym) = LOC_CONST;
@@ -1509,7 +1541,7 @@ define_symbol (valu, string, desc, type, objfile)
            SYMBOL_TYPE (sym) = lookup_fundamental_type (objfile,
                                                         FT_DBL_PREC_FLOAT);
            dbl_valu = (char *)
-             obstack_alloc (&objfile -> symbol_obstack,
+             obstack_alloc (&objfile->symbol_obstack,
                             TYPE_LENGTH (SYMBOL_TYPE (sym)));
            store_floating (dbl_valu, TYPE_LENGTH (SYMBOL_TYPE (sym)), d);
            SYMBOL_VALUE_BYTES (sym) = dbl_valu;
@@ -1539,7 +1571,7 @@ define_symbol (valu, string, desc, type, objfile)
                init_type (TYPE_CODE_INT,
                           sizeof (int) * HOST_CHAR_BIT / TARGET_CHAR_BIT, 0,
                           "integer constant",
-                          (struct objfile *)NULL);
+                            (struct objfile *) NULL);
            SYMBOL_TYPE (sym) = int_const_type;
            SYMBOL_VALUE (sym) = atoi (p);
            SYMBOL_CLASS (sym) = LOC_CONST;
@@ -1599,8 +1631,8 @@ define_symbol (valu, string, desc, type, objfile)
 
     process_function_types:
       /* Function result types are described as the result type in stabs.
-        We need to convert this to the function-returning-type-X type
-        in GDB.  E.g. "int" is converted to "function returning int".  */
+         We need to convert this to the function-returning-type-X type
+         in GDB.  E.g. "int" is converted to "function returning int".  */
       if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_FUNC)
        SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym));
 
@@ -1635,17 +1667,17 @@ define_symbol (valu, string, desc, type, objfile)
              struct type *ptype;
 
              /* A type number of zero indicates the start of varargs.
-                FIXME: GDB currently ignores vararg functions.  */
+                FIXME: GDB currently ignores vararg functions.  */
              if (p[0] == '0' && p[1] == '\0')
                break;
              ptype = read_type (&p, objfile);
 
              /* The Sun compilers mark integer arguments, which should
-                be promoted to the width of the calling conventions, with
-                a type which references itself. This type is turned into
-                a TYPE_CODE_VOID type by read_type, and we have to turn
-                it back into builtin_type_int here.
-                FIXME: Do we need a new builtin_type_promoted_int_arg ?  */
+                be promoted to the width of the calling conventions, with
+                a type which references itself. This type is turned into
+                a TYPE_CODE_VOID type by read_type, and we have to turn
+                it back into builtin_type_int here.
+                FIXME: Do we need a new builtin_type_promoted_int_arg ?  */
              if (TYPE_CODE (ptype) == TYPE_CODE_VOID)
                ptype = builtin_type_int;
              TYPE_FIELD_TYPE (ftype, nparams++) = ptype;
@@ -1665,28 +1697,28 @@ define_symbol (valu, string, desc, type, objfile)
 
     case 'G':
       /* For a class G (global) symbol, it appears that the
-        value is not correct.  It is necessary to search for the
-        corresponding linker definition to find the value.
-        These definitions appear at the end of the namelist.  */
+         value is not correct.  It is necessary to search for the
+         corresponding linker definition to find the value.
+         These definitions appear at the end of the namelist.  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_STATIC;
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       /* Don't add symbol references to global_sym_chain.
-        Symbol references don't have valid names and wont't match up with
-        minimal symbols when the global_sym_chain is relocated.
-        We'll fixup symbol references when we fixup the defining symbol.  */
+         Symbol references don't have valid names and wont't match up with
+         minimal symbols when the global_sym_chain is relocated.
+         We'll fixup symbol references when we fixup the defining symbol.  */
       if (SYMBOL_NAME (sym) && SYMBOL_NAME (sym)[0] != '#')
        {
-          i = hashname (SYMBOL_NAME (sym));
-          SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i];
-          global_sym_chain[i] = sym;
+         i = hashname (SYMBOL_NAME (sym));
+         SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i];
+         global_sym_chain[i] = sym;
        }
       add_symbol_to_list (sym, &global_symbols);
       break;
 
       /* This case is faked by a conditional above,
-        when there is no code letter in the dbx data.
-        Dbx data never actually contains 'l'.  */
+         when there is no code letter in the dbx data.
+         Dbx data never actually contains 'l'.  */
     case 's':
     case 'l':
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
@@ -1705,13 +1737,13 @@ define_symbol (valu, string, desc, type, objfile)
          p++;
          SYMBOL_TYPE (sym)
            = lookup_pointer_type
-             (lookup_function_type (read_type (&p, objfile)));
+           (lookup_function_type (read_type (&p, objfile)));
        }
       else
        SYMBOL_TYPE (sym) = read_type (&p, objfile);
 
       /* Normally this is a parameter, a LOC_ARG.  On the i960, it
-        can also be a LOC_LOCAL_ARG depending on symbol type.  */
+         can also be a LOC_LOCAL_ARG depending on symbol type.  */
 #ifndef DBX_PARM_SYMBOL_CLASS
 #define        DBX_PARM_SYMBOL_CLASS(type)     LOC_ARG
 #endif
@@ -1732,80 +1764,80 @@ define_symbol (valu, string, desc, type, objfile)
       if (processing_gcc_compilation || BELIEVE_PCC_PROMOTION)
        break;
 
-#if !BELIEVE_PCC_PROMOTION
-      {
-       /* This is the signed type which arguments get promoted to.  */
-       static struct type *pcc_promotion_type;
-       /* This is the unsigned type which arguments get promoted to.  */
-       static struct type *pcc_unsigned_promotion_type;
-
-       /* Call it "int" because this is mainly C lossage.  */
-       if (pcc_promotion_type == NULL)
-         pcc_promotion_type =
-           init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
-                      0, "int", NULL);
-
-       if (pcc_unsigned_promotion_type == NULL)
-         pcc_unsigned_promotion_type =
-           init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
-                      TYPE_FLAG_UNSIGNED, "unsigned int", NULL);
-
-#if defined(BELIEVE_PCC_PROMOTION_TYPE)
-       /* This macro is defined on machines (e.g. sparc) where
-          we should believe the type of a PCC 'short' argument,
-          but shouldn't believe the address (the address is
-          the address of the corresponding int).
-          
-          My guess is that this correction, as opposed to changing
-          the parameter to an 'int' (as done below, for PCC
-          on most machines), is the right thing to do
-          on all machines, but I don't want to risk breaking
-          something that already works.  On most PCC machines,
-          the sparc problem doesn't come up because the calling
-          function has to zero the top bytes (not knowing whether
-          the called function wants an int or a short), so there
-          is little practical difference between an int and a short
-          (except perhaps what happens when the GDB user types
-          "print short_arg = 0x10000;"). 
-          
-          Hacked for SunOS 4.1 by gnu@cygnus.com.  In 4.1, the compiler
-          actually produces the correct address (we don't need to fix it
-          up).  I made this code adapt so that it will offset the symbol
-          if it was pointing at an int-aligned location and not
-          otherwise.  This way you can use the same gdb for 4.0.x and
-          4.1 systems.
-          
-          If the parameter is shorter than an int, and is integral
-          (e.g. char, short, or unsigned equivalent), and is claimed to
-          be passed on an integer boundary, don't believe it!  Offset the
-          parameter's address to the tail-end of that integer.  */
-       
-       if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type)
-           && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT
-           && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (pcc_promotion_type))
-         {
-           SYMBOL_VALUE (sym) += TYPE_LENGTH (pcc_promotion_type)
-             - TYPE_LENGTH (SYMBOL_TYPE (sym));
-         }
-       break;
-       
-#else /* no BELIEVE_PCC_PROMOTION_TYPE.  */
-
-       /* If PCC says a parameter is a short or a char,
-          it is really an int.  */
-       if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type)
-           && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT)
-         {
-           SYMBOL_TYPE (sym) =
-             TYPE_UNSIGNED (SYMBOL_TYPE (sym))
-               ? pcc_unsigned_promotion_type
-               : pcc_promotion_type;
-         }
-       break;
-
-#endif /* no BELIEVE_PCC_PROMOTION_TYPE.  */
-      }
-#endif /* !BELIEVE_PCC_PROMOTION.  */
+      if (!BELIEVE_PCC_PROMOTION)
+       {
+         /* This is the signed type which arguments get promoted to.  */
+         static struct type *pcc_promotion_type;
+         /* This is the unsigned type which arguments get promoted to.  */
+         static struct type *pcc_unsigned_promotion_type;
+
+         /* Call it "int" because this is mainly C lossage.  */
+         if (pcc_promotion_type == NULL)
+           pcc_promotion_type =
+             init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+                        0, "int", NULL);
+
+         if (pcc_unsigned_promotion_type == NULL)
+           pcc_unsigned_promotion_type =
+             init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
+                        TYPE_FLAG_UNSIGNED, "unsigned int", NULL);
+
+         if (BELIEVE_PCC_PROMOTION_TYPE)
+           {
+             /* This is defined on machines (e.g. sparc) where we
+                should believe the type of a PCC 'short' argument,
+                but shouldn't believe the address (the address is the
+                address of the corresponding int).
+
+                My guess is that this correction, as opposed to
+                changing the parameter to an 'int' (as done below,
+                for PCC on most machines), is the right thing to do
+                on all machines, but I don't want to risk breaking
+                something that already works.  On most PCC machines,
+                the sparc problem doesn't come up because the calling
+                function has to zero the top bytes (not knowing
+                whether the called function wants an int or a short),
+                so there is little practical difference between an
+                int and a short (except perhaps what happens when the
+                GDB user types "print short_arg = 0x10000;").
+
+                Hacked for SunOS 4.1 by gnu@cygnus.com.  In 4.1, the
+                compiler actually produces the correct address (we
+                don't need to fix it up).  I made this code adapt so
+                that it will offset the symbol if it was pointing at
+                an int-aligned location and not otherwise.  This way
+                you can use the same gdb for 4.0.x and 4.1 systems.
+
+                If the parameter is shorter than an int, and is
+                integral (e.g. char, short, or unsigned equivalent),
+                and is claimed to be passed on an integer boundary,
+                don't believe it!  Offset the parameter's address to
+                the tail-end of that integer.  */
+
+             if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type)
+                 && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT
+             && 0 == SYMBOL_VALUE (sym) % TYPE_LENGTH (pcc_promotion_type))
+               {
+                 SYMBOL_VALUE (sym) += TYPE_LENGTH (pcc_promotion_type)
+                   - TYPE_LENGTH (SYMBOL_TYPE (sym));
+               }
+             break;
+           }
+         else
+           {
+             /* If PCC says a parameter is a short or a char,
+                it is really an int.  */
+             if (TYPE_LENGTH (SYMBOL_TYPE (sym)) < TYPE_LENGTH (pcc_promotion_type)
+                 && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT)
+               {
+                 SYMBOL_TYPE (sym) =
+                   TYPE_UNSIGNED (SYMBOL_TYPE (sym))
+                   ? pcc_unsigned_promotion_type
+                   : pcc_promotion_type;
+               }
+             break;
+           }
+       }
 
     case 'P':
       /* acc seems to use P to declare the prototypes of functions that
@@ -1816,7 +1848,7 @@ define_symbol (valu, string, desc, type, objfile)
          SYMBOL_TYPE (sym) = read_type (&p, objfile);
          goto process_prototype_types;
        }
-      /*FALLTHROUGH*/
+      /*FALLTHROUGH */
 
     case 'R':
       /* Parameter which is in a register.  */
@@ -1827,7 +1859,7 @@ define_symbol (valu, string, desc, type, objfile)
        {
          complain (&reg_value_complaint, SYMBOL_VALUE (sym), NUM_REGS,
                    SYMBOL_SOURCE_NAME (sym));
-         SYMBOL_VALUE (sym) = SP_REGNUM;  /* Known safe, though useless */
+         SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       add_symbol_to_list (sym, &local_symbols);
@@ -1842,7 +1874,7 @@ define_symbol (valu, string, desc, type, objfile)
        {
          complain (&reg_value_complaint, SYMBOL_VALUE (sym), NUM_REGS,
                    SYMBOL_SOURCE_NAME (sym));
-         SYMBOL_VALUE (sym) = SP_REGNUM;  /* Known safe, though useless */
+         SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       if (within_function)
@@ -1860,7 +1892,7 @@ define_symbol (valu, string, desc, type, objfile)
             of saved registers in backtraces, etc.).
 
             Note that this code illegally combines
-              main(argc) struct foo argc; { register struct foo argc; }
+            main(argc) struct foo argc; { register struct foo argc; }
             but this case is considered pathological and causes a warning
             from a decent compiler.  */
 
@@ -1874,13 +1906,13 @@ define_symbol (valu, string, desc, type, objfile)
                  || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_SET
                  || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_BITSTRING)
 #endif
-             )
+           )
            {
              struct symbol *prev_sym;
              prev_sym = local_symbols->symbol[local_symbols->nsyms - 1];
              if ((SYMBOL_CLASS (prev_sym) == LOC_REF_ARG
                   || SYMBOL_CLASS (prev_sym) == LOC_ARG)
-                 && STREQ (SYMBOL_NAME (prev_sym), SYMBOL_NAME(sym)))
+                 && STREQ (SYMBOL_NAME (prev_sym), SYMBOL_NAME (sym)))
                {
                  SYMBOL_CLASS (prev_sym) = LOC_REGPARM;
                  /* Use the type from the LOC_REGISTER; that is the type
@@ -1891,10 +1923,10 @@ define_symbol (valu, string, desc, type, objfile)
                  break;
                }
            }
-          add_symbol_to_list (sym, &local_symbols);
+         add_symbol_to_list (sym, &local_symbols);
        }
       else
-        add_symbol_to_list (sym, &file_symbols);
+       add_symbol_to_list (sym, &file_symbols);
       break;
 
     case 'S':
@@ -1904,15 +1936,15 @@ define_symbol (valu, string, desc, type, objfile)
       SYMBOL_VALUE_ADDRESS (sym) = valu;
 #ifdef STATIC_TRANSFORM_NAME
       if (IS_STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym)))
-      {
-       struct minimal_symbol *msym;
-       msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, objfile);
-       if (msym != NULL)
-         {
-           SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym));
-           SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
-         }
-      }
+       {
+         struct minimal_symbol *msym;
+         msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, objfile);
+         if (msym != NULL)
+           {
+             SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym));
+             SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
+           }
+       }
 #endif
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       add_symbol_to_list (sym, &file_symbols);
@@ -1922,16 +1954,17 @@ define_symbol (valu, string, desc, type, objfile)
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
 
       /* For a nameless type, we don't want a create a symbol, thus we
-        did not use `sym'. Return without further processing. */
-      if (nameless) return NULL;
+         did not use `sym'. Return without further processing. */
+      if (nameless)
+       return NULL;
 
       SYMBOL_CLASS (sym) = LOC_TYPEDEF;
       SYMBOL_VALUE (sym) = valu;
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       /* C++ vagaries: we may have a type which is derived from
-        a base type which did not have its name defined when the
-        derived class was output.  We fill in the derived class's
-        base part member's name here in that case.  */
+         a base type which did not have its name defined when the
+         derived class was output.  We fill in the derived class's
+         base part member's name here in that case.  */
       if (TYPE_NAME (SYMBOL_TYPE (sym)) != NULL)
        if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
             || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)
@@ -1956,23 +1989,23 @@ define_symbol (valu, string, desc, type, objfile)
              || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
            {
              /* If we are giving a name to a type such as "pointer to
-                foo" or "function returning foo", we better not set
-                the TYPE_NAME.  If the program contains "typedef char
-                *caddr_t;", we don't want all variables of type char
-                * to print as caddr_t.  This is not just a
-                consequence of GDB's type management; PCC and GCC (at
-                least through version 2.4) both output variables of
-                either type char * or caddr_t with the type number
-                defined in the 't' symbol for caddr_t.  If a future
-                compiler cleans this up it GDB is not ready for it
-                yet, but if it becomes ready we somehow need to
-                disable this check (without breaking the PCC/GCC2.4
-                case).
-
-                Sigh.
-
-                Fortunately, this check seems not to be necessary
-                for anything except pointers or functions.  */
+                foo" or "function returning foo", we better not set
+                the TYPE_NAME.  If the program contains "typedef char
+                *caddr_t;", we don't want all variables of type char
+                * to print as caddr_t.  This is not just a
+                consequence of GDB's type management; PCC and GCC (at
+                least through version 2.4) both output variables of
+                either type char * or caddr_t with the type number
+                defined in the 't' symbol for caddr_t.  If a future
+                compiler cleans this up it GDB is not ready for it
+                yet, but if it becomes ready we somehow need to
+                disable this check (without breaking the PCC/GCC2.4
+                case).
+
+                Sigh.
+
+                Fortunately, this check seems not to be necessary
+                for anything except pointers or functions.  */
            }
          else
            TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NAME (sym);
@@ -1983,44 +2016,45 @@ define_symbol (valu, string, desc, type, objfile)
 
     case 'T':
       /* Struct, union, or enum tag.  For GNU C++, this can be be followed
-        by 't' which means we are typedef'ing it as well.  */
+         by 't' which means we are typedef'ing it as well.  */
       synonym = *p == 't';
 
       if (synonym)
        p++;
       /* The semantics of C++ state that "struct foo { ... }" also defines 
-        a typedef for "foo".  Unfortunately, cfront never makes the typedef
-        when translating C++ into C.  We make the typedef here so that
-        "ptype foo" works as expected for cfront translated code.  */
+         a typedef for "foo".  Unfortunately, cfront never makes the typedef
+         when translating C++ into C.  We make the typedef here so that
+         "ptype foo" works as expected for cfront translated code.  */
       else if (current_subfile->language == language_cplus)
        synonym = 1;
 
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
 
       /* For a nameless type, we don't want a create a symbol, thus we
-        did not use `sym'. Return without further processing. */
-      if (nameless) return NULL;
+         did not use `sym'. Return without further processing. */
+      if (nameless)
+       return NULL;
 
       SYMBOL_CLASS (sym) = LOC_TYPEDEF;
       SYMBOL_VALUE (sym) = valu;
       SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
       if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
        TYPE_TAG_NAME (SYMBOL_TYPE (sym))
-         = obconcat (&objfile -> type_obstack, "", "", SYMBOL_NAME (sym));
+         = obconcat (&objfile->type_obstack, "", "", SYMBOL_NAME (sym));
       add_symbol_to_list (sym, &file_symbols);
 
       if (synonym)
        {
          /* Clone the sym and then modify it. */
          register struct symbol *typedef_sym = (struct symbol *)
-           obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
+         obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
          *typedef_sym = *sym;
          SYMBOL_CLASS (typedef_sym) = LOC_TYPEDEF;
          SYMBOL_VALUE (typedef_sym) = valu;
          SYMBOL_NAMESPACE (typedef_sym) = VAR_NAMESPACE;
          if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
            TYPE_NAME (SYMBOL_TYPE (sym))
-             = obconcat (&objfile -> type_obstack, "", "", SYMBOL_NAME (sym));
+             = obconcat (&objfile->type_obstack, "", "", SYMBOL_NAME (sym));
          add_symbol_to_list (typedef_sym, &file_symbols);
        }
       break;
@@ -2032,15 +2066,15 @@ define_symbol (valu, string, desc, type, objfile)
       SYMBOL_VALUE_ADDRESS (sym) = valu;
 #ifdef STATIC_TRANSFORM_NAME
       if (IS_STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym)))
-      {
-       struct minimal_symbol *msym;
-       msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, objfile);
-       if (msym != NULL)
-         {
-           SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym));
-           SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
-         }
-      }
+       {
+         struct minimal_symbol *msym;
+         msym = lookup_minimal_symbol (SYMBOL_NAME (sym), NULL, objfile);
+         if (msym != NULL)
+           {
+             SYMBOL_NAME (sym) = STATIC_TRANSFORM_NAME (SYMBOL_NAME (sym));
+             SYMBOL_VALUE_ADDRESS (sym) = SYMBOL_VALUE_ADDRESS (msym);
+           }
+       }
 #endif
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       if (os9k_stabs)
@@ -2067,7 +2101,7 @@ define_symbol (valu, string, desc, type, objfile)
        {
          complain (&reg_value_complaint, SYMBOL_VALUE (sym), NUM_REGS,
                    SYMBOL_SOURCE_NAME (sym));
-         SYMBOL_VALUE (sym) = SP_REGNUM;  /* Known safe, though useless */
+         SYMBOL_VALUE (sym) = SP_REGNUM;       /* Known safe, though useless */
        }
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       add_symbol_to_list (sym, &local_symbols);
@@ -2075,9 +2109,9 @@ define_symbol (valu, string, desc, type, objfile)
 
     case 'X':
       /* This is used by Sun FORTRAN for "function result value".
-        Sun claims ("dbx and dbxtool interfaces", 2nd ed)
-        that Pascal uses it too, but when I tried it Pascal used
-        "x:3" (local symbol) instead.  */
+         Sun claims ("dbx and dbxtool interfaces", 2nd ed)
+         that Pascal uses it too, but when I tried it Pascal used
+         "x:3" (local symbol) instead.  */
       SYMBOL_TYPE (sym) = read_type (&p, objfile);
       SYMBOL_CLASS (sym) = LOC_LOCAL;
       SYMBOL_VALUE (sym) = valu;
@@ -2085,25 +2119,25 @@ define_symbol (valu, string, desc, type, objfile)
       add_symbol_to_list (sym, &local_symbols);
       break;
 
-    /* New code added to support cfront stabs strings.
-       Note: case 'P' already handled above */
+      /* New code added to support cfront stabs strings.
+         Note: case 'P' already handled above */
     case 'Z':
       /* Cfront type continuation coming up!
-        Find the original definition and add to it.
-        We'll have to do this for the typedef too,
-        since we cloned the symbol to define a type in read_type.
-        Stabs info examples:
-                __1C :Ztl 
-                foo__1CFv :ZtF (first def foo__1CFv:F(0,3);(0,24))
-                C:ZsC;;__ct__1CFv func1__1CFv func2__1CFv ... ;;;
-                where C is the name of the class.
-        Unfortunately, we can't lookup the original symbol yet 'cuz 
-        we haven't finished reading all the symbols.
-        Instead, we save it for processing later */
+         Find the original definition and add to it.
+         We'll have to do this for the typedef too,
+         since we cloned the symbol to define a type in read_type.
+         Stabs info examples:
+         __1C :Ztl 
+         foo__1CFv :ZtF (first def foo__1CFv:F(0,3);(0,24))
+         C:ZsC;;__ct__1CFv func1__1CFv func2__1CFv ... ;;;
+         where C is the name of the class.
+         Unfortunately, we can't lookup the original symbol yet 'cuz 
+         we haven't finished reading all the symbols.
+         Instead, we save it for processing later */
       process_later (sym, p, resolve_cfront_continuation);
-      SYMBOL_TYPE (sym) = error_type (&p, objfile); /* FIXME! change later */ 
-      SYMBOL_CLASS (sym) = LOC_CONST; 
-      SYMBOL_VALUE (sym) = 0; 
+      SYMBOL_TYPE (sym) = error_type (&p, objfile);    /* FIXME! change later */
+      SYMBOL_CLASS (sym) = LOC_CONST;
+      SYMBOL_VALUE (sym) = 0;
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       /* Don't add to list - we'll delete it later when 
          we add the continuation to the real sym */
@@ -2123,7 +2157,7 @@ define_symbol (valu, string, desc, type, objfile)
      the address in a register, not the structure itself. */
 
   if (REG_STRUCT_HAS_ADDR (processing_gcc_compilation, SYMBOL_TYPE (sym))
-      && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
+    && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG))
     {
       struct type *symbol_type = check_typedef (SYMBOL_TYPE (sym));
 
@@ -2147,10 +2181,10 @@ define_symbol (valu, string, desc, type, objfile)
   while (*p && *p == ';')
     {
       p++;
-      if (*p && *p == 'l')
-        {
-          /* GNU extensions for live range splitting may be appended to 
-             the end of the stab string.  eg. "l(#1,#2);l(#3,#5)" */
+      if (*p && p[0] == 'l' && p[1] == '(')
+       {
+         /* GNU extensions for live range splitting may be appended to 
+            the end of the stab string.  eg. "l(#1,#2);l(#3,#5)" */
 
          /* Resolve the live range and add it to SYM's live range list.  */
          if (!resolve_live_range (objfile, sym, p))
@@ -2158,13 +2192,13 @@ define_symbol (valu, string, desc, type, objfile)
 
          /* Find end of live range info. */
          p = strchr (p, ')');
-          if (!*p || *p != ')')
+         if (!*p || *p != ')')
            {
              complain (&lrs_general_complaint, "live range format not recognized");
              return NULL;
            }
-          p++;
-       }
+         p++;
+       }
     }
   return sym;
 }
@@ -2195,7 +2229,7 @@ resolve_live_range (objfile, sym, p)
       return 0;
     }
   p++;
-       
+
   /* Get starting value of range and advance P past the reference id.
 
      ?!? In theory, the process_reference should never fail, but we should
@@ -2259,7 +2293,7 @@ add_live_range (objfile, sym, start, end)
 
   /* Alloc new live range structure. */
   r = (struct range_list *)
-    obstack_alloc (&objfile->type_obstack, 
+    obstack_alloc (&objfile->type_obstack,
                   sizeof (struct range_list));
   r->start = start;
   r->end = end;
@@ -2276,8 +2310,8 @@ add_live_range (objfile, sym, start, end)
       rs->next = r;
     }
 }
-
 \f
+
 /* Skip rest of this symbol and return an error type.
 
    General notes on error recovery:  error_type always skips to the
@@ -2285,7 +2319,7 @@ add_live_range (objfile, sym, start, end)
    Thus code like this:
 
    if (*(*pp)++ != ';')
-     return error_type (pp, objfile);
+   return error_type (pp, objfile);
 
    is wrong because if *pp starts out pointing at '\0' (typically as the
    result of an earlier error), it will be incremented to point to the
@@ -2293,15 +2327,15 @@ add_live_range (objfile, sym, start, end)
    if you run off the end of the string table.  Instead use
 
    if (**pp != ';')
-     return error_type (pp, objfile);
+   return error_type (pp, objfile);
    ++*pp;
 
    or
 
    if (**pp != ';')
-     foo = error_type (pp, objfile);
+   foo = error_type (pp, objfile);
    else
-     ++*pp;
+   ++*pp;
 
    And in case it isn't obvious, the point of all this hair is so the compiler
    can define new types and new syntaxes, and old versions of the
@@ -2333,8 +2367,8 @@ error_type (pp, objfile)
     }
   return (builtin_type_error);
 }
-
 \f
+
 /* Read type information or a type definition; return the type.  Even
    though this routine accepts either type information or a type
    definition, the distinction is relevant--some parts of stabsread.c
@@ -2367,27 +2401,27 @@ read_type (pp, objfile)
     {
       if (read_type_number (pp, typenums) != 0)
        return error_type (pp, objfile);
-      
+
       /* Type is not being defined here.  Either it already exists,
-        or this is a forward reference to it.  dbx_alloc_type handles
-        both cases.  */
+         or this is a forward reference to it.  dbx_alloc_type handles
+         both cases.  */
       if (**pp != '=')
        return dbx_alloc_type (typenums, objfile);
 
       /* Type is being defined here.  */
       /* Skip the '='.
-        Also skip the type descriptor - we get it below with (*pp)[-1].  */
-      (*pp)+=2;
+         Also skip the type descriptor - we get it below with (*pp)[-1].  */
+      (*pp) += 2;
     }
   else
     {
       /* 'typenums=' not present, type is anonymous.  Read and return
-        the definition, but don't put it in the type vector.  */
+         the definition, but don't put it in the type vector.  */
       typenums[0] = typenums[1] = -1;
       (*pp)++;
     }
 
- again:
+again:
   type_descriptor = (*pp)[-1];
   switch (type_descriptor)
     {
@@ -2398,13 +2432,13 @@ read_type (pp, objfile)
        /* Used to index through file_symbols.  */
        struct pending *ppt;
        int i;
-       
+
        /* Name including "struct", etc.  */
        char *type_name;
-       
+
        {
          char *from, *to, *p, *q1, *q2;
-         
+
          /* Set the type code according to the following letter.  */
          switch ((*pp)[0])
            {
@@ -2422,13 +2456,13 @@ read_type (pp, objfile)
                /* Complain and keep going, so compilers can invent new
                   cross-reference types.  */
                static struct complaint msg =
-                 {"Unrecognized cross-reference type `%c'", 0, 0};
+               {"Unrecognized cross-reference type `%c'", 0, 0};
                complain (&msg, (*pp)[0]);
                code = TYPE_CODE_STRUCT;
                break;
              }
            }
-          
+
          q1 = strchr (*pp, '<');
          p = strchr (*pp, ':');
          if (p == NULL)
@@ -2449,15 +2483,15 @@ read_type (pp, objfile)
              if (*p != ':')
                return error_type (pp, objfile);
            }
-         to = type_name = 
-               (char *)obstack_alloc (&objfile->type_obstack, p - *pp + 1);
-       
+         to = type_name =
+           (char *) obstack_alloc (&objfile->type_obstack, p - *pp + 1);
+
          /* Copy the name.  */
          from = *pp + 1;
-         while (from < p) 
+         while (from < p)
            *to++ = *from++;
          *to = '\0';
-         
+
          /* Set the pointer ahead of the name which we just read, and
             the colon.  */
          *pp = from + 1;
@@ -2479,7 +2513,7 @@ read_type (pp, objfile)
                  && (TYPE_CODE (SYMBOL_TYPE (sym)) == code)
                  && STREQ (SYMBOL_NAME (sym), type_name))
                {
-                 obstack_free (&objfile -> type_obstack, type_name);
+                 obstack_free (&objfile->type_obstack, type_name);
                  type = SYMBOL_TYPE (sym);
                  return type;
                }
@@ -2493,14 +2527,14 @@ read_type (pp, objfile)
        type = dbx_alloc_type (typenums, objfile);
        TYPE_CODE (type) = code;
        TYPE_TAG_NAME (type) = type_name;
-       INIT_CPLUS_SPECIFIC(type);
+       INIT_CPLUS_SPECIFIC (type);
        TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
 
        add_undefined_type (type);
        return type;
       }
 
-    case '-':                          /* RS/6000 built-in type */
+    case '-':                  /* RS/6000 built-in type */
     case '0':
     case '1':
     case '2':
@@ -2515,13 +2549,14 @@ read_type (pp, objfile)
       (*pp)--;
 
       /* We deal with something like t(1,2)=(3,4)=... which
-        the Lucid compiler and recent gcc versions (post 2.7.3) use. */
+         the Lucid compiler and recent gcc versions (post 2.7.3) use. */
 
       /* Allocate and enter the typedef type first.
-        This handles recursive types. */
+         This handles recursive types. */
       type = dbx_alloc_type (typenums, objfile);
       TYPE_CODE (type) = TYPE_CODE_TYPEDEF;
-      { struct type *xtype = read_type (pp, objfile);
+      {
+       struct type *xtype = read_type (pp, objfile);
        if (type == xtype)
          {
            /* It's being defined as itself.  That means it is "void".  */
@@ -2542,24 +2577,24 @@ read_type (pp, objfile)
       }
       break;
 
-    /* In the following types, we must be sure to overwrite any existing
-       type that the typenums refer to, rather than allocating a new one
-       and making the typenums point to the new one.  This is because there
-       may already be pointers to the existing type (if it had been
-       forward-referenced), and we must change it to a pointer, function,
-       reference, or whatever, *in-place*.  */
+      /* In the following types, we must be sure to overwrite any existing
+         type that the typenums refer to, rather than allocating a new one
+         and making the typenums point to the new one.  This is because there
+         may already be pointers to the existing type (if it had been
+         forward-referenced), and we must change it to a pointer, function,
+         reference, or whatever, *in-place*.  */
 
     case '*':
       type1 = read_type (pp, objfile);
       type = make_pointer_type (type1, dbx_lookup_type (typenums));
       break;
 
-    case '&':                          /* Reference to another type */
+    case '&':                  /* Reference to another type */
       type1 = read_type (pp, objfile);
       type = make_reference_type (type1, dbx_lookup_type (typenums));
       break;
 
-    case 'f':                          /* Function returning another type */
+    case 'f':                  /* Function returning another type */
       if (os9k_stabs && **pp == '(')
        {
          /* Function prototype; parse it.
@@ -2569,29 +2604,30 @@ read_type (pp, objfile)
          struct type *t;
          ++*pp;
          while (**pp != ')')
-            {
-              t = read_type (pp, objfile);
-              if (**pp == ',') ++*pp;
-            }
+           {
+             t = read_type (pp, objfile);
+             if (**pp == ',')
+               ++ * pp;
+           }
        }
       type1 = read_type (pp, objfile);
       type = make_function_type (type1, dbx_lookup_type (typenums));
       break;
 
-    case 'k':                     /* Const qualifier on some type (Sun) */
-    case 'c':                     /* Const qualifier on some type (OS9000) */
+    case 'k':                  /* Const qualifier on some type (Sun) */
+    case 'c':                  /* Const qualifier on some type (OS9000) */
       /* Because 'c' means other things to AIX and 'k' is perfectly good,
-        only accept 'c' in the os9k_stabs case.  */
+         only accept 'c' in the os9k_stabs case.  */
       if (type_descriptor == 'c' && !os9k_stabs)
        return error_type (pp, objfile);
       type = read_type (pp, objfile);
       /* FIXME! For now, we ignore const and volatile qualifiers.  */
       break;
 
-    case 'B':                       /* Volatile qual on some type (Sun) */
-    case 'i':                       /* Volatile qual on some type (OS9000) */
+    case 'B':                  /* Volatile qual on some type (Sun) */
+    case 'i':                  /* Volatile qual on some type (OS9000) */
       /* Because 'i' means other things to AIX and 'B' is perfectly good,
-        only accept 'i' in the os9k_stabs case.  */
+         only accept 'i' in the os9k_stabs case.  */
       if (type_descriptor == 'i' && !os9k_stabs)
        return error_type (pp, objfile);
       type = read_type (pp, objfile);
@@ -2599,8 +2635,8 @@ read_type (pp, objfile)
       break;
 
     case '@':
-      if (isdigit (**pp) || **pp ==  '(' || **pp == '-')
-       { /* Member (class & variable) type */
+      if (isdigit (**pp) || **pp == '(' || **pp == '-')
+       {                       /* Member (class & variable) type */
          /* FIXME -- we should be doing smash_to_XXX types here.  */
 
          struct type *domain = read_type (pp, objfile);
@@ -2615,7 +2651,8 @@ read_type (pp, objfile)
          type = dbx_alloc_type (typenums, objfile);
          smash_to_member_type (type, domain, memtype);
        }
-      else /* type attribute */
+      else
+       /* type attribute */
        {
          char *attr = *pp;
          /* Skip to the semicolon.  */
@@ -2624,7 +2661,7 @@ read_type (pp, objfile)
          if (**pp == '\0')
            return error_type (pp, objfile);
          else
-           ++*pp;  /* Skip the semicolon.  */
+           ++ * pp;            /* Skip the semicolon.  */
 
          switch (*attr)
            {
@@ -2640,7 +2677,7 @@ read_type (pp, objfile)
 
            default:
              /* Ignore unrecognized type attributes, so future compilers
-                can invent new ones.  */
+                can invent new ones.  */
              break;
            }
          ++*pp;
@@ -2648,7 +2685,7 @@ read_type (pp, objfile)
        }
       break;
 
-    case '#':                          /* Method (class & fn) type */
+    case '#':                  /* Method (class & fn) type */
       if ((*pp)[0] == '#')
        {
          /* We'll get the parameter types from the name.  */
@@ -2681,7 +2718,7 @@ read_type (pp, objfile)
        }
       break;
 
-    case 'r':                          /* Range type */
+    case 'r':                  /* Range type */
       type = read_range_type (pp, typenums, objfile);
       if (typenums[0] != -1)
        *dbx_lookup_type (typenums) = type;
@@ -2700,39 +2737,39 @@ read_type (pp, objfile)
        }
       break;
 
-    case 'R':                          /* Sun ACC builtin float type */
+    case 'R':                  /* Sun ACC builtin float type */
       type = read_sun_floating_type (pp, typenums, objfile);
       if (typenums[0] != -1)
        *dbx_lookup_type (typenums) = type;
       break;
-    
-    case 'e':                          /* Enumeration type */
+
+    case 'e':                  /* Enumeration type */
       type = dbx_alloc_type (typenums, objfile);
       type = read_enum_type (pp, type, objfile);
       if (typenums[0] != -1)
        *dbx_lookup_type (typenums) = type;
       break;
 
-    case 's':                          /* Struct type */
-    case 'u':                          /* Union type */
+    case 's':                  /* Struct type */
+    case 'u':                  /* Union type */
       type = dbx_alloc_type (typenums, objfile);
       switch (type_descriptor)
        {
-         case 's':
-           TYPE_CODE (type) = TYPE_CODE_STRUCT;
-           break;
-         case 'u':
-           TYPE_CODE (type) = TYPE_CODE_UNION;
-           break;
+       case 's':
+         TYPE_CODE (type) = TYPE_CODE_STRUCT;
+         break;
+       case 'u':
+         TYPE_CODE (type) = TYPE_CODE_UNION;
+         break;
        }
       type = read_struct_type (pp, type, objfile);
       break;
 
-    case 'a':                          /* Array type */
+    case 'a':                  /* Array type */
       if (**pp != 'r')
        return error_type (pp, objfile);
       ++*pp;
-      
+
       type = dbx_alloc_type (typenums, objfile);
       type = read_array_type (pp, type, objfile);
       if (is_string)
@@ -2741,7 +2778,7 @@ read_type (pp, objfile)
 
     case 'S':
       type1 = read_type (pp, objfile);
-      type = create_set_type ((struct type*) NULL, type1);
+      type = create_set_type ((struct type *) NULL, type1);
       if (is_string)
        TYPE_CODE (type) = TYPE_CODE_BITSTRING;
       if (typenums[0] != -1)
@@ -2750,7 +2787,7 @@ read_type (pp, objfile)
 
     default:
       --*pp;                   /* Go back to the symbol in error */
-                               /* Particularly important if it was \0! */
+      /* Particularly important if it was \0! */
       return error_type (pp, objfile);
     }
 
@@ -2789,7 +2826,7 @@ rs6000_builtin_type (typenum)
     return negative_types[-typenum];
 
 #if TARGET_CHAR_BIT != 8
-  #error This code wrong for TARGET_CHAR_BIT not 8
+#error This code wrong for TARGET_CHAR_BIT not 8
   /* These definitions all assume that TARGET_CHAR_BIT is 8.  I think
      that if that ever becomes not true, the correct fix will be to
      make the size in the struct type to be in bits, not in units of
@@ -2800,10 +2837,10 @@ rs6000_builtin_type (typenum)
     {
     case 1:
       /* The size of this and all the other types are fixed, defined
-        by the debugging format.  If there is a type called "int" which
-        is other than 32 bits, then it should use a new negative type
-        number (or avoid negative type numbers for that case).
-        See stabs.texinfo.  */
+         by the debugging format.  If there is a type called "int" which
+         is other than 32 bits, then it should use a new negative type
+         number (or avoid negative type numbers for that case).
+         See stabs.texinfo.  */
       rettype = init_type (TYPE_CODE_INT, 4, 0, "int", NULL);
       break;
     case 2:
@@ -2850,8 +2887,8 @@ rs6000_builtin_type (typenum)
       break;
     case 14:
       /* This is an IEEE double on the RS/6000, and different machines with
-        different sizes for "long double" should use different negative
-        type numbers.  See stabs.texinfo.  */
+         different sizes for "long double" should use different negative
+         type numbers.  See stabs.texinfo.  */
       rettype = init_type (TYPE_CODE_FLT, 8, 0, "long double", NULL);
       break;
     case 15:
@@ -2934,11 +2971,11 @@ rs6000_builtin_type (typenum)
 /* Read member function stabs info for C++ classes.  The form of each member
    function data is:
 
-       NAME :: TYPENUM[=type definition] ARGS : PHYSNAME ;
+   NAME :: TYPENUM[=type definition] ARGS : PHYSNAME ;
 
    An example with two member functions is:
 
-       afunc1::20=##15;:i;2A.;afunc2::20:i;2A.;
+   afunc1::20=##15;:i;2A.;afunc2::20:i;2A.;
 
    For the case of overloaded operators, the format is op$::*.funcs, where
    $ is the CPLUS_MARKER (usually '$'), `*' holds the place for an operator
@@ -2964,21 +3001,22 @@ read_member_functions (fip, pp, type, objfile)
     {
       struct next_fnfield *next;
       struct fn_field fn_field;
-    } *sublist;
+    }
+   *sublist;
   struct type *look_ahead_type;
   struct next_fnfieldlist *new_fnlist;
   struct next_fnfield *new_sublist;
   char *main_fn_name;
   register char *p;
-      
+
   /* Process each list until we find something that is not a member function
      or find the end of the functions. */
 
   while (**pp != ';')
     {
       /* We should be positioned at the start of the function name.
-        Scan forward to find the first ':' and if it is not the
-        first of a "::" delimiter, then this is not a member function. */
+         Scan forward to find the first ':' and if it is not the
+         first of a "::" delimiter, then this is not a member function. */
       p = *pp;
       while (*p != ':')
        {
@@ -2992,12 +3030,12 @@ read_member_functions (fip, pp, type, objfile)
       sublist = NULL;
       look_ahead_type = NULL;
       length = 0;
-      
+
       new_fnlist = (struct next_fnfieldlist *)
        xmalloc (sizeof (struct next_fnfieldlist));
       make_cleanup (free, new_fnlist);
       memset (new_fnlist, 0, sizeof (struct next_fnfieldlist));
-      
+
       if ((*pp)[0] == 'o' && (*pp)[1] == 'p' && is_cplus_marker ((*pp)[2]))
        {
          /* This is a completely wierd case.  In order to stuff in the
@@ -3009,9 +3047,10 @@ read_member_functions (fip, pp, type, objfile)
          /* This lets the user type "break operator+".
             We could just put in "+" as the name, but that wouldn't
             work for "*".  */
-         static char opname[32] = {'o', 'p', CPLUS_MARKER};
+         static char opname[32] =
+         {'o', 'p', CPLUS_MARKER};
          char *o = opname + 3;
-         
+
          /* Skip past '::'.  */
          *pp = p + 2;
 
@@ -3031,22 +3070,22 @@ read_member_functions (fip, pp, type, objfile)
          /* Skip past '::'.  */
          *pp = p + 2;
        }
-      new_fnlist -> fn_fieldlist.name = main_fn_name;
-      
+      new_fnlist->fn_fieldlist.name = main_fn_name;
+
       do
        {
          new_sublist =
            (struct next_fnfield *) xmalloc (sizeof (struct next_fnfield));
          make_cleanup (free, new_sublist);
          memset (new_sublist, 0, sizeof (struct next_fnfield));
-         
+
          /* Check for and handle cretinous dbx symbol name continuation!  */
          if (look_ahead_type == NULL)
            {
              /* Normal case. */
              STABS_CONTINUE (pp, objfile);
-             
-             new_sublist -> fn_field.type = read_type (pp, objfile);
+
+             new_sublist->fn_field.type = read_type (pp, objfile);
              if (**pp != ':')
                {
                  /* Invalid symtab info for member function.  */
@@ -3056,93 +3095,93 @@ read_member_functions (fip, pp, type, objfile)
          else
            {
              /* g++ version 1 kludge */
-             new_sublist -> fn_field.type = look_ahead_type;
+             new_sublist->fn_field.type = look_ahead_type;
              look_ahead_type = NULL;
            }
-         
+
          (*pp)++;
          p = *pp;
          while (*p != ';')
            {
              p++;
            }
-         
+
          /* If this is just a stub, then we don't have the real name here. */
 
-         if (TYPE_FLAGS (new_sublist -> fn_field.type) & TYPE_FLAG_STUB)
+         if (TYPE_FLAGS (new_sublist->fn_field.type) & TYPE_FLAG_STUB)
            {
-             if (!TYPE_DOMAIN_TYPE (new_sublist -> fn_field.type))
-               TYPE_DOMAIN_TYPE (new_sublist -> fn_field.type) = type;
-             new_sublist -> fn_field.is_stub = 1;
+             if (!TYPE_DOMAIN_TYPE (new_sublist->fn_field.type))
+               TYPE_DOMAIN_TYPE (new_sublist->fn_field.type) = type;
+             new_sublist->fn_field.is_stub = 1;
            }
-         new_sublist -> fn_field.physname = savestring (*pp, p - *pp);
+         new_sublist->fn_field.physname = savestring (*pp, p - *pp);
          *pp = p + 1;
-         
+
          /* Set this member function's visibility fields.  */
          switch (*(*pp)++)
            {
-             case VISIBILITY_PRIVATE:
-               new_sublist -> fn_field.is_private = 1;
-               break;
-             case VISIBILITY_PROTECTED:
-               new_sublist -> fn_field.is_protected = 1;
-               break;
+           case VISIBILITY_PRIVATE:
+             new_sublist->fn_field.is_private = 1;
+             break;
+           case VISIBILITY_PROTECTED:
+             new_sublist->fn_field.is_protected = 1;
+             break;
            }
-         
+
          STABS_CONTINUE (pp, objfile);
          switch (**pp)
            {
-             case 'A': /* Normal functions. */
-               new_sublist -> fn_field.is_const = 0;
-               new_sublist -> fn_field.is_volatile = 0;
-               (*pp)++;
-               break;
-             case 'B': /* `const' member functions. */
-               new_sublist -> fn_field.is_const = 1;
-               new_sublist -> fn_field.is_volatile = 0;
-               (*pp)++;
-               break;
-             case 'C': /* `volatile' member function. */
-               new_sublist -> fn_field.is_const = 0;
-               new_sublist -> fn_field.is_volatile = 1;
-               (*pp)++;
-               break;
-             case 'D': /* `const volatile' member function. */
-               new_sublist -> fn_field.is_const = 1;
-               new_sublist -> fn_field.is_volatile = 1;
-               (*pp)++;
-               break;
-             case '*': /* File compiled with g++ version 1 -- no info */
-             case '?':
-             case '.':
-               break;
-             default:
-               complain (&const_vol_complaint, **pp);
-               break;
+           case 'A':           /* Normal functions. */
+             new_sublist->fn_field.is_const = 0;
+             new_sublist->fn_field.is_volatile = 0;
+             (*pp)++;
+             break;
+           case 'B':           /* `const' member functions. */
+             new_sublist->fn_field.is_const = 1;
+             new_sublist->fn_field.is_volatile = 0;
+             (*pp)++;
+             break;
+           case 'C':           /* `volatile' member function. */
+             new_sublist->fn_field.is_const = 0;
+             new_sublist->fn_field.is_volatile = 1;
+             (*pp)++;
+             break;
+           case 'D':           /* `const volatile' member function. */
+             new_sublist->fn_field.is_const = 1;
+             new_sublist->fn_field.is_volatile = 1;
+             (*pp)++;
+             break;
+           case '*':           /* File compiled with g++ version 1 -- no info */
+           case '?':
+           case '.':
+             break;
+           default:
+             complain (&const_vol_complaint, **pp);
+             break;
            }
-         
+
          switch (*(*pp)++)
            {
-             case '*':
+           case '*':
              {
                int nbits;
-               /* virtual member function, followed by index.
+               /* virtual member function, followed by index.
                   The sign bit is set to distinguish pointers-to-methods
                   from virtual function indicies.  Since the array is
                   in words, the quantity must be shifted left by 1
                   on 16 bit machine, and by 2 on 32 bit machine, forcing
                   the sign bit out, and usable as a valid index into
                   the array.  Remove the sign bit here.  */
-               new_sublist -> fn_field.voffset =
+               new_sublist->fn_field.voffset =
                  (0x7fffffff & read_huge_number (pp, ';', &nbits)) + 2;
                if (nbits != 0)
                  return 0;
-             
+
                STABS_CONTINUE (pp, objfile);
                if (**pp == ';' || **pp == '\0')
                  {
                    /* Must be g++ version 1.  */
-                   new_sublist -> fn_field.fcontext = 0;
+                   new_sublist->fn_field.fcontext = 0;
                  }
                else
                  {
@@ -3156,7 +3195,7 @@ read_member_functions (fip, pp, type, objfile)
                      }
                    else
                      {
-                       new_sublist -> fn_field.fcontext = look_ahead_type;
+                       new_sublist->fn_field.fcontext = look_ahead_type;
                        if (**pp != ';')
                          {
                            return 0;
@@ -3170,50 +3209,50 @@ read_member_functions (fip, pp, type, objfile)
                  }
                break;
              }
-             case '?':
-               /* static member function.  */
-               new_sublist -> fn_field.voffset = VOFFSET_STATIC;
-               if (strncmp (new_sublist -> fn_field.physname,
-                            main_fn_name, strlen (main_fn_name)))
-                 {
-                   new_sublist -> fn_field.is_stub = 1;
-                 }
-               break;
-             
-             default:
-               /* error */
-               complain (&member_fn_complaint, (*pp)[-1]);
-               /* Fall through into normal member function.  */
-             
-             case '.':
-               /* normal member function.  */
-               new_sublist -> fn_field.voffset = 0;
-               new_sublist -> fn_field.fcontext = 0;
-               break;
+           case '?':
+             /* static member function.  */
+             new_sublist->fn_field.voffset = VOFFSET_STATIC;
+             if (strncmp (new_sublist->fn_field.physname,
+                          main_fn_name, strlen (main_fn_name)))
+               {
+                 new_sublist->fn_field.is_stub = 1;
+               }
+             break;
+
+           default:
+             /* error */
+             complain (&member_fn_complaint, (*pp)[-1]);
+             /* Fall through into normal member function.  */
+
+           case '.':
+             /* normal member function.  */
+             new_sublist->fn_field.voffset = 0;
+             new_sublist->fn_field.fcontext = 0;
+             break;
            }
-         
-         new_sublist -> next = sublist;
+
+         new_sublist->next = sublist;
          sublist = new_sublist;
          length++;
          STABS_CONTINUE (pp, objfile);
        }
       while (**pp != ';' && **pp != '\0');
-      
+
       (*pp)++;
-      
-      new_fnlist -> fn_fieldlist.fn_fields = (struct fn_field *)
-       obstack_alloc (&objfile -> type_obstack, 
+
+      new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *)
+       obstack_alloc (&objfile->type_obstack,
                       sizeof (struct fn_field) * length);
-      memset (new_fnlist -> fn_fieldlist.fn_fields, 0,
+      memset (new_fnlist->fn_fieldlist.fn_fields, 0,
              sizeof (struct fn_field) * length);
-      for (i = length; (i--, sublist); sublist = sublist -> next)
+      for (i = length; (i--, sublist); sublist = sublist->next)
        {
-         new_fnlist -> fn_fieldlist.fn_fields[i] = sublist -> fn_field;
+         new_fnlist->fn_fieldlist.fn_fields[i] = sublist->fn_field;
        }
-      
-      new_fnlist -> fn_fieldlist.length = length;
-      new_fnlist -> next = fip -> fnlist;
-      fip -> fnlist = new_fnlist;
+
+      new_fnlist->fn_fieldlist.length = length;
+      new_fnlist->next = fip->fnlist;
+      fip->fnlist = new_fnlist;
       nfn_fields++;
       total_length += length;
       STABS_CONTINUE (pp, objfile);
@@ -3259,40 +3298,40 @@ read_cpp_abbrev (fip, pp, type, objfile)
       *pp = p + 1;
 
       /* At this point, *pp points to something like "22:23=*22...",
-        where the type number before the ':' is the "context" and
-        everything after is a regular type definition.  Lookup the
-        type, find it's name, and construct the field name. */
+         where the type number before the ':' is the "context" and
+         everything after is a regular type definition.  Lookup the
+         type, find it's name, and construct the field name. */
 
       context = read_type (pp, objfile);
 
       switch (cpp_abbrev)
        {
-         case 'f':             /* $vf -- a virtual function table pointer */
-           fip->list->field.name =
-             obconcat (&objfile->type_obstack, vptr_name, "", "");
-           break;
+       case 'f':               /* $vf -- a virtual function table pointer */
+         fip->list->field.name =
+           obconcat (&objfile->type_obstack, vptr_name, "", "");
+         break;
 
-         case 'b':             /* $vb -- a virtual bsomethingorother */
-           name = type_name_no_tag (context);
-           if (name == NULL)
-             {
-               complain (&invalid_cpp_type_complaint, symnum);
-               name = "FOO";
-             }
-           fip->list->field.name =
-             obconcat (&objfile->type_obstack, vb_name, name, "");
-           break;
+       case 'b':               /* $vb -- a virtual bsomethingorother */
+         name = type_name_no_tag (context);
+         if (name == NULL)
+           {
+             complain (&invalid_cpp_type_complaint, symnum);
+             name = "FOO";
+           }
+         fip->list->field.name =
+           obconcat (&objfile->type_obstack, vb_name, name, "");
+         break;
 
-         default:
-           complain (&invalid_cpp_abbrev_complaint, *pp);
-           fip->list->field.name =
-             obconcat (&objfile->type_obstack,
-                       "INVALID_CPLUSPLUS_ABBREV", "", "");
-           break;
+       default:
+         complain (&invalid_cpp_abbrev_complaint, *pp);
+         fip->list->field.name =
+           obconcat (&objfile->type_obstack,
+                     "INVALID_CPLUSPLUS_ABBREV", "", "");
+         break;
        }
 
       /* At this point, *pp points to the ':'.  Skip it and read the
-        field type. */
+         field type. */
 
       p = ++(*pp);
       if (p[-1] != ':')
@@ -3302,7 +3341,7 @@ read_cpp_abbrev (fip, pp, type, objfile)
        }
       fip->list->field.type = read_type (pp, objfile);
       if (**pp == ',')
-       (*pp)++;                        /* Skip the comma.  */
+       (*pp)++;                /* Skip the comma.  */
       else
        return 0;
 
@@ -3320,8 +3359,8 @@ read_cpp_abbrev (fip, pp, type, objfile)
     {
       complain (&invalid_cpp_abbrev_complaint, *pp);
       /* We have no idea what syntax an unrecognized abbrev would have, so
-        better return 0.  If we returned 1, we would need to at least advance
-        *pp to avoid an infinite loop.  */
+         better return 0.  If we returned 1, we would need to at least advance
+         *pp to avoid an infinite loop.  */
       return 0;
     }
   return 1;
@@ -3338,7 +3377,7 @@ read_one_struct_field (fip, pp, p, type, objfile)
   /* The following is code to work around cfront generated stabs.
      The stabs contains full mangled name for each field.
      We try to demangle the name and extract the field name out of it.
-  */
+   */
   if (ARM_DEMANGLING && current_subfile->language == language_cplus)
     {
       char save_p;
@@ -3347,40 +3386,40 @@ read_one_struct_field (fip, pp, p, type, objfile)
       *p = '\0';
       dem = cplus_demangle (*pp, DMGL_ANSI | DMGL_PARAMS);
       if (dem != NULL)
-        {
-          dem_p = strrchr (dem, ':');
-          if (dem_p != 0 && *(dem_p-1)==':')
-            dem_p++;
-          FIELD_NAME (fip->list->field) =
-            obsavestring (dem_p, strlen (dem_p), &objfile -> type_obstack);
-        }
+       {
+         dem_p = strrchr (dem, ':');
+         if (dem_p != 0 && *(dem_p - 1) == ':')
+           dem_p++;
+         FIELD_NAME (fip->list->field) =
+           obsavestring (dem_p, strlen (dem_p), &objfile->type_obstack);
+       }
       else
-        {
-          FIELD_NAME (fip->list->field) =
-            obsavestring (*pp, p - *pp, &objfile -> type_obstack);
-        }
+       {
+         FIELD_NAME (fip->list->field) =
+           obsavestring (*pp, p - *pp, &objfile->type_obstack);
+       }
       *p = save_p;
     }
   /* end of code for cfront work around */
 
   else
-    fip -> list -> field.name =
-    obsavestring (*pp, p - *pp, &objfile -> type_obstack);
+    fip->list->field.name =
+      obsavestring (*pp, p - *pp, &objfile->type_obstack);
   *pp = p + 1;
 
   /* This means we have a visibility for a field coming. */
   if (**pp == '/')
     {
       (*pp)++;
-      fip -> list -> visibility = *(*pp)++;
+      fip->list->visibility = *(*pp)++;
     }
   else
     {
       /* normal dbx-style format, no explicit visibility */
-      fip -> list -> visibility = VISIBILITY_PUBLIC;
+      fip->list->visibility = VISIBILITY_PUBLIC;
     }
 
-  fip -> list -> field.type = read_type (pp, objfile);
+  fip->list->field.type = read_type (pp, objfile);
   if (**pp == ':')
     {
       p = ++(*pp);
@@ -3388,12 +3427,13 @@ read_one_struct_field (fip, pp, p, type, objfile)
       /* Possible future hook for nested types. */
       if (**pp == '!')
        {
-         fip -> list -> field.bitpos = (long)-2; /* nested type */
+         fip->list->field.bitpos = (long) -2;  /* nested type */
          p = ++(*pp);
        }
-      else ...;
+      else
+       ...;
 #endif
-      while (*p != ';') 
+      while (*p != ';')
        {
          p++;
        }
@@ -3431,28 +3471,28 @@ read_one_struct_field (fip, pp, p, type, objfile)
       && FIELD_BITSIZE (fip->list->field) == 0)
     {
       /* This can happen in two cases: (1) at least for gcc 2.4.5 or so,
-        it is a field which has been optimized out.  The correct stab for
-        this case is to use VISIBILITY_IGNORE, but that is a recent
-        invention.  (2) It is a 0-size array.  For example
-        union { int num; char str[0]; } foo.  Printing "<no value>" for
-        str in "p foo" is OK, since foo.str (and thus foo.str[3])
-        will continue to work, and a 0-size array as a whole doesn't
-        have any contents to print.
-
-        I suspect this probably could also happen with gcc -gstabs (not
-        -gstabs+) for static fields, and perhaps other C++ extensions.
-        Hopefully few people use -gstabs with gdb, since it is intended
-        for dbx compatibility.  */
+         it is a field which has been optimized out.  The correct stab for
+         this case is to use VISIBILITY_IGNORE, but that is a recent
+         invention.  (2) It is a 0-size array.  For example
+         union { int num; char str[0]; } foo.  Printing "<no value>" for
+         str in "p foo" is OK, since foo.str (and thus foo.str[3])
+         will continue to work, and a 0-size array as a whole doesn't
+         have any contents to print.
+
+         I suspect this probably could also happen with gcc -gstabs (not
+         -gstabs+) for static fields, and perhaps other C++ extensions.
+         Hopefully few people use -gstabs with gdb, since it is intended
+         for dbx compatibility.  */
 
       /* Ignore this field.  */
-      fip -> list-> visibility = VISIBILITY_IGNORE;
+      fip->list->visibility = VISIBILITY_IGNORE;
     }
   else
     {
       /* Detect an unpacked field and mark it as such.
-        dbx gives a bit size for all fields.
-        Note that forward refs cannot be packed,
-        and treat enums as if they had the width of ints.  */
+         dbx gives a bit size for all fields.
+         Note that forward refs cannot be packed,
+         and treat enums as if they had the width of ints.  */
 
       struct type *field_type = check_typedef (FIELD_TYPE (fip->list->field));
 
@@ -3463,11 +3503,11 @@ read_one_struct_field (fip, pp, p, type, objfile)
        {
          FIELD_BITSIZE (fip->list->field) = 0;
        }
-      if ((FIELD_BITSIZE (fip->list->field) 
+      if ((FIELD_BITSIZE (fip->list->field)
           == TARGET_CHAR_BIT * TYPE_LENGTH (field_type)
           || (TYPE_CODE (field_type) == TYPE_CODE_ENUM
-              && FIELD_BITSIZE (fip->list->field) == TARGET_INT_BIT )
-          )
+              && FIELD_BITSIZE (fip->list->field) == TARGET_INT_BIT)
+         )
          &&
          FIELD_BITPOS (fip->list->field) % 8 == 0)
        {
@@ -3479,7 +3519,7 @@ read_one_struct_field (fip, pp, p, type, objfile)
 
 /* Read struct or class data fields.  They have the form:
 
-       NAME : [VISIBILITY] TYPENUM , BITPOS , BITSIZE ;
+   NAME : [VISIBILITY] TYPENUM , BITPOS , BITSIZE ;
 
    At the end, we see a semicolon instead of a field.
 
@@ -3488,10 +3528,10 @@ read_one_struct_field (fip, pp, p, type, objfile)
 
    The optional VISIBILITY is one of:
 
-       '/0'    (VISIBILITY_PRIVATE)
-       '/1'    (VISIBILITY_PROTECTED)
-       '/2'    (VISIBILITY_PUBLIC)
-       '/9'    (VISIBILITY_IGNORE)
+   '/0' (VISIBILITY_PRIVATE)
+   '/1' (VISIBILITY_PROTECTED)
+   '/2' (VISIBILITY_PUBLIC)
+   '/9' (VISIBILITY_IGNORE)
 
    or nothing, for C style fields with public visibility.
 
@@ -3517,22 +3557,23 @@ read_struct_fields (fip, pp, type, objfile)
 
   while (**pp != ';')
     {
-      if (os9k_stabs && **pp == ',') break;
+      if (os9k_stabs && **pp == ',')
+       break;
       STABS_CONTINUE (pp, objfile);
       /* Get space to record the next field's data.  */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
       make_cleanup (free, new);
       memset (new, 0, sizeof (struct nextfield));
-      new -> next = fip -> list;
-      fip -> list = new;
+      new->next = fip->list;
+      fip->list = new;
 
       /* Get the field name.  */
       p = *pp;
 
       /* If is starts with CPLUS_MARKER it is a special abbreviation,
-        unless the CPLUS_MARKER is followed by an underscore, in
-        which case it is just the name of an anonymous type, which we
-        should handle like any other type name.  */
+         unless the CPLUS_MARKER is followed by an underscore, in
+         which case it is just the name of an anonymous type, which we
+         should handle like any other type name.  */
 
       if (is_cplus_marker (p[0]) && p[1] != '_')
        {
@@ -3542,11 +3583,11 @@ read_struct_fields (fip, pp, type, objfile)
        }
 
       /* Look for the ':' that separates the field name from the field
-        values.  Data members are delimited by a single ':', while member
-        functions are delimited by a pair of ':'s.  When we hit the member
-        functions (if any), terminate scan loop and return. */
+         values.  Data members are delimited by a single ':', while member
+         functions are delimited by a pair of ':'s.  When we hit the member
+         functions (if any), terminate scan loop and return. */
 
-      while (*p != ':' && *p != '\0') 
+      while (*p != ':' && *p != '\0')
        {
          p++;
        }
@@ -3563,12 +3604,12 @@ read_struct_fields (fip, pp, type, objfile)
   if (p[0] == ':' && p[1] == ':')
     {
       /* chill the list of fields: the last entry (at the head) is a
-        partially constructed entry which we now scrub. */
-      fip -> list = fip -> list -> next;
+         partially constructed entry which we now scrub. */
+      fip->list = fip->list->next;
     }
   return 1;
 }
-
+/* *INDENT-OFF* */
 /* The stabs for C++ derived classes contain baseclass information which
    is marked by a '!' character after the total size.  This function is
    called when we encounter the baseclass marker, and slurps up all the
@@ -3592,6 +3633,9 @@ read_struct_fields (fip, pp, type, objfile)
        Type number of base class ____________________________________|
 
   Return 1 for success, 0 for (error-type-inducing) failure.  */
+/* *INDENT-ON* */
+
+
 
 static int
 read_baseclasses (fip, pp, type, objfile)
@@ -3643,50 +3687,53 @@ read_baseclasses (fip, pp, type, objfile)
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
       make_cleanup (free, new);
       memset (new, 0, sizeof (struct nextfield));
-      new -> next = fip -> list;
-      fip -> list = new;
+      new->next = fip->list;
+      fip->list = new;
       FIELD_BITSIZE (new->field) = 0;  /* this should be an unpacked field! */
 
       STABS_CONTINUE (pp, objfile);
       switch (**pp)
        {
-         case '0':
-           /* Nothing to do. */
-           break;
-         case '1':
-           SET_TYPE_FIELD_VIRTUAL (type, i);
-           break;
-         default:
-           /* Unknown character.  Complain and treat it as non-virtual.  */
+       case '0':
+         /* Nothing to do. */
+         break;
+       case '1':
+         SET_TYPE_FIELD_VIRTUAL (type, i);
+         break;
+       default:
+         /* Unknown character.  Complain and treat it as non-virtual.  */
+         {
+           static struct complaint msg =
            {
-             static struct complaint msg = {
-               "Unknown virtual character `%c' for baseclass", 0, 0};
-             complain (&msg, **pp);
-           }
+             "Unknown virtual character `%c' for baseclass", 0, 0};
+           complain (&msg, **pp);
+         }
        }
       ++(*pp);
 
-      new -> visibility = *(*pp)++;
-      switch (new -> visibility)
+      new->visibility = *(*pp)++;
+      switch (new->visibility)
        {
-         case VISIBILITY_PRIVATE:
-         case VISIBILITY_PROTECTED:
-         case VISIBILITY_PUBLIC:
-           break;
-         default:
-           /* Bad visibility format.  Complain and treat it as
-              public.  */
+       case VISIBILITY_PRIVATE:
+       case VISIBILITY_PROTECTED:
+       case VISIBILITY_PUBLIC:
+         break;
+       default:
+         /* Bad visibility format.  Complain and treat it as
+            public.  */
+         {
+           static struct complaint msg =
            {
-             static struct complaint msg = {
-               "Unknown visibility `%c' for baseclass", 0, 0};
-             complain (&msg, new -> visibility);
-             new -> visibility = VISIBILITY_PUBLIC;
-           }
+             "Unknown visibility `%c' for baseclass", 0, 0
+           };
+           complain (&msg, new->visibility);
+           new->visibility = VISIBILITY_PUBLIC;
+         }
        }
 
       {
        int nbits;
-       
+
        /* The remaining value is the bit offset of the portion of the object
           corresponding to this baseclass.  Always zero in the absence of
           multiple inheritance.  */
@@ -3697,11 +3744,11 @@ read_baseclasses (fip, pp, type, objfile)
       }
 
       /* The last piece of baseclass information is the type of the
-        base class.  Read it, and remember it's type name as this
-        field's name. */
+         base class.  Read it, and remember it's type name as this
+         field's name. */
 
-      new -> field.type = read_type (pp, objfile);
-      new -> field.name = type_name_no_tag (new -> field.type);
+      new->field.type = read_type (pp, objfile);
+      new->field.name = type_name_no_tag (new->field.type);
 
       /* skip trailing ';' and bump count of number of fields seen */
       if (**pp == ';')
@@ -3771,16 +3818,16 @@ read_tilde_fields (fip, pp, type, objfile)
              /* Premature end of symbol.  */
              return 0;
            }
-         
+
          TYPE_VPTR_BASETYPE (type) = t;
-         if (type == t)                /* Our own class provides vtbl ptr */
+         if (type == t)        /* Our own class provides vtbl ptr */
            {
              for (i = TYPE_NFIELDS (t) - 1;
                   i >= TYPE_N_BASECLASSES (t);
                   --i)
                {
-                 if (! strncmp (TYPE_FIELD_NAME (t, i), vptr_name, 
-                                sizeof (vptr_name) - 1))
+                 if (!strncmp (TYPE_FIELD_NAME (t, i), vptr_name,
+                               sizeof (vptr_name) - 1))
                    {
                      TYPE_VPTR_FIELDNO (type) = i;
                      goto gotit;
@@ -3795,7 +3842,7 @@ read_tilde_fields (fip, pp, type, objfile)
              TYPE_VPTR_FIELDNO (type) = TYPE_VPTR_FIELDNO (t);
            }
 
-    gotit:
+       gotit:
          *pp = p + 1;
        }
     }
@@ -3810,11 +3857,11 @@ attach_fn_fields_to_type (fip, type)
   register int n;
 
   for (n = TYPE_NFN_FIELDS (type);
-       fip -> fnlist != NULL;
-       fip -> fnlist = fip -> fnlist -> next)
+       fip->fnlist != NULL;
+       fip->fnlist = fip->fnlist->next)
     {
-      --n;                      /* Circumvent Sun3 compiler bug */
-      TYPE_FN_FIELDLISTS (type)[n] = fip -> fnlist -> fn_fieldlist;
+      --n;                     /* Circumvent Sun3 compiler bug */
+      TYPE_FN_FIELDLISTS (type)[n] = fip->fnlist->fn_fieldlist;
     }
   return 1;
 }
@@ -3822,11 +3869,11 @@ attach_fn_fields_to_type (fip, type)
 /* read cfront class static data.
    pp points to string starting with the list of static data
    eg: A:ZcA;1@Bpub v2@Bvirpri;__ct__1AFv func__1AFv *sfunc__1AFv ;as__1A ;;
-                                                                  ^^^^^^^^
+   ^^^^^^^^
 
-       A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;;
-                                                                              ^
  */
+   A:ZcA;;foopri__1AFv foopro__1AFv __ct__1AFv __ct__1AFRC1A foopub__1AFv ;;;
+   ^
+ */
 
 static int
 read_cfront_static_fields (fip, pp, type, objfile)
@@ -3835,12 +3882,12 @@ read_cfront_static_fields (fip, pp, type, objfile)
      struct type *type;
      struct objfile *objfile;
 {
-  struct nextfield * new;
+  struct nextfield *new;
   struct type *stype;
-  char * sname;
-  struct symbol * ref_static=0;
-      
-  if (**pp==';')               /* no static data; return */
+  char *sname;
+  struct symbol *ref_static = 0;
+
+  if (**pp == ';')             /* no static data; return */
     {
       ++(*pp);
       return 1;
@@ -3849,33 +3896,34 @@ read_cfront_static_fields (fip, pp, type, objfile)
   /* Process each field in the list until we find the terminating ";" */
 
   /* eg: p = "as__1A ;;;" */
-  STABS_CONTINUE (pp, objfile);                /* handle \\ */
-  while (**pp!=';' && (sname = get_substring (pp, ' '), sname)) 
+  STABS_CONTINUE (pp, objfile);        /* handle \\ */
+  while (**pp != ';' && (sname = get_substring (pp, ' '), sname))
     {
-      ref_static = lookup_symbol (sname, 0, VAR_NAMESPACE, 0, 0); /*demangled_name*/
-      if (!ref_static) 
-        {
-          static struct complaint msg = {"\
+      ref_static = lookup_symbol (sname, 0, VAR_NAMESPACE, 0, 0);      /*demangled_name */
+      if (!ref_static)
+       {
+         static struct complaint msg =
+         {"\
                Unable to find symbol for static data field %s\n",
-                                0, 0};
+          0, 0};
          complain (&msg, sname);
          continue;
        }
-      stype = SYMBOL_TYPE(ref_static);
+      stype = SYMBOL_TYPE (ref_static);
 
       /* allocate a new fip */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
       make_cleanup (free, new);
       memset (new, 0, sizeof (struct nextfield));
-      new -> next = fip -> list;
-      fip -> list = new;
+      new->next = fip->list;
+      fip->list = new;
 
       /* set visibility */
       /* FIXME! no way to tell visibility from stabs??? */
-      new -> visibility = VISIBILITY_PUBLIC;
+      new->visibility = VISIBILITY_PUBLIC;
 
       /* set field info into fip */
-      fip -> list -> field.type = stype; 
+      fip->list->field.type = stype;
 
       /* set bitpos & bitsize */
       SET_FIELD_PHYSNAME (fip->list->field, savestring (sname, strlen (sname)));
@@ -3884,26 +3932,26 @@ read_cfront_static_fields (fip, pp, type, objfile)
       /* The following is code to work around cfront generated stabs.
          The stabs contains full mangled name for each field.
          We try to demangle the name and extract the field name out of it.
-      */
+       */
       if (ARM_DEMANGLING)
-        {
-          char *dem, *dem_p;
-          dem = cplus_demangle (sname, DMGL_ANSI | DMGL_PARAMS);
-          if (dem != NULL)
-            {
-              dem_p = strrchr (dem, ':');
-              if (dem_p != 0 && *(dem_p-1)==':')
-                dem_p++;
-              fip->list->field.name =
-                obsavestring (dem_p, strlen (dem_p), &objfile -> type_obstack);
-            }
-          else
-            {
-              fip->list->field.name =
-                obsavestring (sname, strlen (sname), &objfile -> type_obstack); 
+       {
+         char *dem, *dem_p;
+         dem = cplus_demangle (sname, DMGL_ANSI | DMGL_PARAMS);
+         if (dem != NULL)
+           {
+             dem_p = strrchr (dem, ':');
+             if (dem_p != 0 && *(dem_p - 1) == ':')
+               dem_p++;
+             fip->list->field.name =
+               obsavestring (dem_p, strlen (dem_p), &objfile->type_obstack);
+           }
+         else
+           {
+             fip->list->field.name =
+               obsavestring (sname, strlen (sname), &objfile->type_obstack);
            }
-        } /* end of code for cfront work around */ 
-    } /* loop again for next static field */
+       }                       /* end of code for cfront work around */
+    }                          /* loop again for next static field */
   return 1;
 }
 
@@ -3919,38 +3967,38 @@ copy_cfront_struct_fields (fip, type, objfile)
      struct type *type;
      struct objfile *objfile;
 {
-  int nfields = TYPE_NFIELDS(type);
+  int nfields = TYPE_NFIELDS (type);
   int i;
-  struct nextfield * new;
+  struct nextfield *new;
 
   /* Copy the fields into the list of fips and reset the types 
      to remove the old fields */
 
-  for (i=0; i<nfields; i++)
+  for (i = 0; i < nfields; i++)
     {
       /* allocate a new fip */
       new = (struct nextfield *) xmalloc (sizeof (struct nextfield));
       make_cleanup (free, new);
       memset (new, 0, sizeof (struct nextfield));
-      new -> next = fip -> list;
-      fip -> list = new;
+      new->next = fip->list;
+      fip->list = new;
 
       /* copy field info into fip */
-      new -> field = TYPE_FIELD (type, i);
+      new->field = TYPE_FIELD (type, i);
       /* set visibility */
       if (TYPE_FIELD_PROTECTED (type, i))
-       new -> visibility = VISIBILITY_PROTECTED;
+       new->visibility = VISIBILITY_PROTECTED;
       else if (TYPE_FIELD_PRIVATE (type, i))
-        new -> visibility = VISIBILITY_PRIVATE;
+       new->visibility = VISIBILITY_PRIVATE;
       else
-        new -> visibility = VISIBILITY_PUBLIC;
+       new->visibility = VISIBILITY_PUBLIC;
     }
   /* Now delete the fields from the type since we will be 
      allocing new space once we get the rest of the fields 
      in attach_fields_to_type.
      The pointer TYPE_FIELDS(type) is left dangling but should 
      be freed later by objstack_free */
-  TYPE_FIELDS (type)=0;
+  TYPE_FIELDS (type) = 0;
   TYPE_NFIELDS (type) = 0;
 
   return 1;
@@ -3975,10 +4023,10 @@ attach_fields_to_type (fip, type, objfile)
      allocate and build the private_field_bits and protected_field_bits
      bitfields. */
 
-  for (scan = fip -> list; scan != NULL; scan = scan -> next)
+  for (scan = fip->list; scan != NULL; scan = scan->next)
     {
       nfields++;
-      if (scan -> visibility != VISIBILITY_PUBLIC)
+      if (scan->visibility != VISIBILITY_PUBLIC)
        {
          non_public_fields++;
        }
@@ -4016,34 +4064,35 @@ attach_fields_to_type (fip, type, objfile)
 
   while (nfields-- > 0)
     {
-      TYPE_FIELD (type, nfields) = fip -> list -> field;
-      switch (fip -> list -> visibility)
+      TYPE_FIELD (type, nfields) = fip->list->field;
+      switch (fip->list->visibility)
        {
-         case VISIBILITY_PRIVATE:
-           SET_TYPE_FIELD_PRIVATE (type, nfields);
-           break;
+       case VISIBILITY_PRIVATE:
+         SET_TYPE_FIELD_PRIVATE (type, nfields);
+         break;
 
-         case VISIBILITY_PROTECTED:
-           SET_TYPE_FIELD_PROTECTED (type, nfields);
-           break;
+       case VISIBILITY_PROTECTED:
+         SET_TYPE_FIELD_PROTECTED (type, nfields);
+         break;
 
-         case VISIBILITY_IGNORE:
-           SET_TYPE_FIELD_IGNORE (type, nfields);
-           break;
+       case VISIBILITY_IGNORE:
+         SET_TYPE_FIELD_IGNORE (type, nfields);
+         break;
 
-         case VISIBILITY_PUBLIC:
-           break;
+       case VISIBILITY_PUBLIC:
+         break;
 
-         default:
-           /* Unknown visibility.  Complain and treat it as public.  */
+       default:
+         /* Unknown visibility.  Complain and treat it as public.  */
+         {
+           static struct complaint msg =
            {
-             static struct complaint msg = {
-               "Unknown visibility `%c' for field", 0, 0};
-             complain (&msg, fip -> list -> visibility);
-           }
-           break;
+             "Unknown visibility `%c' for field", 0, 0};
+           complain (&msg, fip->list->visibility);
+         }
+         break;
        }
-      fip -> list = fip -> list -> next;
+      fip->list = fip->list->next;
     }
   return 1;
 }
@@ -4060,7 +4109,7 @@ attach_fields_to_type (fip, type, objfile)
    OBJFILE points to the current objfile from which the stabs information is
    being read.  (Note that it is redundant in that TYPE also contains a pointer
    to this same objfile, so it might be a good idea to eliminate it.  FIXME). 
  */
+ */
 
 static struct type *
 read_struct_type (pp, type, objfile)
@@ -4158,7 +4207,7 @@ read_array_type (pp, type, objfile)
   upper = read_huge_number (pp, ';', &nbits);
   if (nbits != 0)
     return error_type (pp, objfile);
-  
+
   element_type = read_type (pp, objfile);
 
   if (adjustable)
@@ -4211,8 +4260,8 @@ read_enum_type (pp, type, objfile)
   if (os9k_stabs)
     {
       /* Size.  Perhaps this does not have to be conditionalized on
-        os9k_stabs (assuming the name of an enum constant can't start
-        with a digit).  */
+         os9k_stabs (assuming the name of an enum constant can't start
+         with a digit).  */
       read_huge_number (pp, 0, &nbits);
       if (nbits != 0)
        return error_type (pp, objfile);
@@ -4224,7 +4273,7 @@ read_enum_type (pp, type, objfile)
     {
       /* Skip over the type.  */
       while (**pp != ':')
-        (*pp)++;
+       (*pp)++;
 
       /* Skip over the colon.  */
       (*pp)++;
@@ -4237,18 +4286,19 @@ read_enum_type (pp, type, objfile)
     {
       STABS_CONTINUE (pp, objfile);
       p = *pp;
-      while (*p != ':') p++;
-      name = obsavestring (*pp, p - *pp, &objfile -> symbol_obstack);
+      while (*p != ':')
+       p++;
+      name = obsavestring (*pp, p - *pp, &objfile->symbol_obstack);
       *pp = p + 1;
       n = read_huge_number (pp, ',', &nbits);
       if (nbits != 0)
        return error_type (pp, objfile);
 
       sym = (struct symbol *)
-       obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
+       obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
       memset (sym, 0, sizeof (struct symbol));
       SYMBOL_NAME (sym) = name;
-      SYMBOL_LANGUAGE (sym) = current_subfile -> language;
+      SYMBOL_LANGUAGE (sym) = current_subfile->language;
       SYMBOL_CLASS (sym) = LOC_CONST;
       SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
       SYMBOL_VALUE (sym) = n;
@@ -4303,11 +4353,11 @@ read_enum_type (pp, type, objfile)
 /* Sun's ACC uses a somewhat saner method for specifying the builtin
    typedefs in every file (for int, long, etc):
 
-       type = b <signed> <width> <format type>; <offset>; <nbits>
-       signed = u or s.
-       optional format type = c or b for char or boolean.
-       offset = offset from high order bit to start bit of type.
-       width is # bytes in object of this type, nbits is # bits in type.
+   type = b <signed> <width> <format type>; <offset>; <nbits>
+   signed = u or s.
+   optional format type = c or b for char or boolean.
+   offset = offset from high order bit to start bit of type.
+   width is # bytes in object of this type, nbits is # bits in type.
 
    The width/offset stuff appears to be for small objects stored in
    larger ones (e.g. `shorts' in `int' registers).  We ignore it for now,
@@ -4326,14 +4376,14 @@ read_sun_builtin_type (pp, typenums, objfile)
 
   switch (**pp)
     {
-      case 's':
-        signed_type = 1;
-       break;
-      case 'u':
-       signed_type = 0;
-       break;
-      default:
-       return error_type (pp, objfile);
+    case 's':
+      signed_type = 1;
+      break;
+    case 'u':
+      signed_type = 0;
+      break;
+    default:
+      return error_type (pp, objfile);
     }
   (*pp)++;
 
@@ -4379,12 +4429,12 @@ read_sun_builtin_type (pp, typenums, objfile)
 
   if (type_bits == 0)
     return init_type (TYPE_CODE_VOID, 1,
-                     signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL,
+                     signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *) NULL,
                      objfile);
   else
     return init_type (code,
                      type_bits / TARGET_CHAR_BIT,
-                     signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL,
+                     signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *) NULL,
                      objfile);
 }
 
@@ -4444,7 +4494,7 @@ read_huge_number (pp, end, bits)
   int nbits = 0;
   int c;
   long upper_limit;
-  
+
   if (*p == '-')
     {
       sign = -1;
@@ -4473,9 +4523,9 @@ read_huge_number (pp, end, bits)
        }
       else
        overflow = 1;
-      
+
       /* This depends on large values being output in octal, which is
-        what GCC does. */
+         what GCC does. */
       if (radix == 8)
        {
          if (nbits == 0)
@@ -4517,9 +4567,9 @@ read_huge_number (pp, end, bits)
            *bits = -1;
          return 0;
        }
-      
+
       /* -0x7f is the same as 0x80.  So deal with it by adding one to
-        the number of bits.  */
+         the number of bits.  */
       if (sign == -1)
        ++nbits;
       if (bits)
@@ -4592,8 +4642,8 @@ read_range_type (pp, typenums, objfile)
          nbits = n3bits;
        }
       /* Range from <large number> to <large number>-1 is a large signed
-        integral type.  Take care of the case where <large number> doesn't
-        fit in a long but <large number>-1 does.  */
+         integral type.  Take care of the case where <large number> doesn't
+         fit in a long but <large number>-1 does.  */
       else if ((n2bits != 0 && n3bits != 0 && n2bits == n3bits + 1)
               || (n2bits != 0 && n3bits == 0
                   && (n2bits == sizeof (long) * HOST_CHAR_BIT)
@@ -4647,7 +4697,7 @@ read_range_type (pp, typenums, objfile)
     {
       /* It is unsigned int or unsigned long.  */
       /* GCC 2.3.3 uses this for long long too, but that is just a GDB 3.5
-        compatibility hack.  */
+         compatibility hack.  */
       return init_type (TYPE_CODE_INT, TARGET_INT_BIT / TARGET_CHAR_BIT,
                        TYPE_FLAG_UNSIGNED, NULL, objfile);
     }
@@ -4664,27 +4714,39 @@ read_range_type (pp, typenums, objfile)
   /* We used to do this only for subrange of self or subrange of int.  */
   else if (n2 == 0)
     {
+      /* -1 is used for the upper bound of (4 byte) "unsigned int" and
+         "unsigned long", and we already checked for that,
+         so don't need to test for it here.  */
+
       if (n3 < 0)
        /* n3 actually gives the size.  */
-       return init_type (TYPE_CODE_INT, - n3, TYPE_FLAG_UNSIGNED,
+       return init_type (TYPE_CODE_INT, -n3, TYPE_FLAG_UNSIGNED,
                          NULL, objfile);
-      if (n3 == 0xff)
-       return init_type (TYPE_CODE_INT, 1, TYPE_FLAG_UNSIGNED, NULL, objfile);
-      if (n3 == 0xffff)
-       return init_type (TYPE_CODE_INT, 2, TYPE_FLAG_UNSIGNED, NULL, objfile);
 
-      /* -1 is used for the upper bound of (4 byte) "unsigned int" and
-        "unsigned long", and we already checked for that,
-        so don't need to test for it here.  */
+      /* Is n3 == 2**(8n)-1 for some integer n?  Then it's an
+         unsigned n-byte integer.  But do require n to be a power of
+         two; we don't want 3- and 5-byte integers flying around.  */
+      {
+       int bytes;
+       unsigned long bits;
+
+       bits = n3;
+       for (bytes = 0; (bits & 0xff) == 0xff; bytes++)
+         bits >>= 8;
+       if (bits == 0
+           && ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */
+         return init_type (TYPE_CODE_INT, bytes, TYPE_FLAG_UNSIGNED, NULL,
+                           objfile);
+      }
     }
   /* I think this is for Convex "long long".  Since I don't know whether
      Convex sets self_subrange, I also accept that particular size regardless
      of self_subrange.  */
   else if (n3 == 0 && n2 < 0
           && (self_subrange
-              || n2 == - TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT))
-    return init_type (TYPE_CODE_INT, - n2, 0, NULL, objfile);
-  else if (n2 == -n3 -1)
+              || n2 == -TARGET_LONG_LONG_BIT / TARGET_CHAR_BIT))
+    return init_type (TYPE_CODE_INT, -n2, 0, NULL, objfile);
+  else if (n2 == -n3 - 1)
     {
       if (n3 == 0x7f)
        return init_type (TYPE_CODE_INT, 1, 0, NULL, objfile);
@@ -4696,7 +4758,7 @@ read_range_type (pp, typenums, objfile)
 
   /* We have a real range type on our hands.  Allocate space and
      return a real pointer.  */
- handle_true_range:
+handle_true_range:
 
   if (self_subrange)
     index_type = builtin_type_int;
@@ -4732,14 +4794,14 @@ read_args (pp, end, objfile)
      struct objfile *objfile;
 {
   /* FIXME!  Remove this arbitrary limit!  */
-  struct type *types[1024], **rval; /* allow for fns of 1023 parameters */
+  struct type *types[1024], **rval;    /* allow for fns of 1023 parameters */
   int n = 0;
 
   while (**pp != end)
     {
       if (**pp != ',')
        /* Invalid argument list: no ','.  */
-       return (struct type **)-1;
+       return (struct type **) -1;
       (*pp)++;
       STABS_CONTINUE (pp, objfile);
       types[n++] = read_type (pp, objfile);
@@ -4750,7 +4812,7 @@ read_args (pp, end, objfile)
     {
       rval = (struct type **) xmalloc (2 * sizeof (struct type *));
     }
-  else if (TYPE_CODE (types[n-1]) != TYPE_CODE_VOID)
+  else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
     {
       rval = (struct type **) xmalloc ((n + 1) * sizeof (struct type *));
       memset (rval + n, 0, sizeof (struct type *));
@@ -4789,7 +4851,8 @@ common_block_start (name, objfile)
 {
   if (common_block_name != NULL)
     {
-      static struct complaint msg = {
+      static struct complaint msg =
+      {
        "Invalid symbol data: common block within common block",
        0, 0};
       complain (&msg);
@@ -4797,7 +4860,7 @@ common_block_start (name, objfile)
   common_block = local_symbols;
   common_block_i = local_symbols ? local_symbols->nsyms : 0;
   common_block_name = obsavestring (name, strlen (name),
-                                   &objfile -> symbol_obstack);
+                                   &objfile->symbol_obstack);
 }
 
 /* Process a N_ECOMM symbol.  */
@@ -4819,13 +4882,14 @@ common_block_end (objfile)
 
   if (common_block_name == NULL)
     {
-      static struct complaint msg = {"ECOMM symbol unmatched by BCOMM", 0, 0};
+      static struct complaint msg =
+      {"ECOMM symbol unmatched by BCOMM", 0, 0};
       complain (&msg);
       return;
     }
 
-  sym = (struct symbol *) 
-    obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
+  sym = (struct symbol *)
+    obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
   memset (sym, 0, sizeof (struct symbol));
   /* Note: common_block_name already saved on symbol_obstack */
   SYMBOL_NAME (sym) = common_block_name;
@@ -4867,20 +4931,20 @@ common_block_end (objfile)
 
 static void
 fix_common_block (sym, valu)
-    struct symbol *sym;
-    int valu;
+     struct symbol *sym;
+     int valu;
 {
   struct pending *next = (struct pending *) SYMBOL_TYPE (sym);
-  for ( ; next; next = next->next)
+  for (; next; next = next->next)
     {
       register int j;
       for (j = next->nsyms - 1; j >= 0; j--)
        SYMBOL_VALUE_ADDRESS (next->symbol[j]) += valu;
     }
 }
+\f
 
 
-\f
 /* What about types defined as forward references inside of a small lexical
    scope?  */
 /* Add a type to the list of undefined types to be checked through
@@ -4904,11 +4968,11 @@ add_undefined_type (type)
    up if possible.  We have two kinds of undefined types:
 
    TYPE_CODE_ARRAY:  Array whose target type wasn't defined yet.
-                       Fix:  update array length using the element bounds
-                       and the target type's length.
+   Fix:  update array length using the element bounds
+   and the target type's length.
    TYPE_CODE_STRUCT, TYPE_CODE_UNION:  Structure whose fields were not
-                       yet defined at the time a pointer to it was made.
-                       Fix:  Do a full lookup on the struct/union tag.  */
+   yet defined at the time a pointer to it was made.
+   Fix:  Do a full lookup on the struct/union tag.  */
 void
 cleanup_undefined_types ()
 {
@@ -4919,9 +4983,9 @@ cleanup_undefined_types ()
       switch (TYPE_CODE (*type))
        {
 
-         case TYPE_CODE_STRUCT:
-         case TYPE_CODE_UNION:
-         case TYPE_CODE_ENUM:
+       case TYPE_CODE_STRUCT:
+       case TYPE_CODE_UNION:
+       case TYPE_CODE_ENUM:
          {
            /* Check if it has been defined since.  Need to do this here
               as well as in check_typedef to deal with the (legitimate in
@@ -4936,7 +5000,8 @@ cleanup_undefined_types ()
 
                if (typename == NULL)
                  {
-                   static struct complaint msg = {"need a type name", 0, 0};
+                   static struct complaint msg =
+                   {"need a type name", 0, 0};
                    complain (&msg);
                    break;
                  }
@@ -4945,7 +5010,7 @@ cleanup_undefined_types ()
                    for (i = 0; i < ppt->nsyms; i++)
                      {
                        struct symbol *sym = ppt->symbol[i];
-                       
+
                        if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
                            && SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE
                            && (TYPE_CODE (SYMBOL_TYPE (sym)) ==
@@ -4963,7 +5028,8 @@ cleanup_undefined_types ()
 
        default:
          {
-           static struct complaint msg = {"\
+           static struct complaint msg =
+           {"\
 GDB internal error.  cleanup_undefined_types with bad type %d.", 0, 0};
            complain (&msg, TYPE_CODE (*type));
          }
@@ -5000,7 +5066,7 @@ scan_file_globals (objfile)
   while (1)
     {
       /* Avoid expensive loop through all minimal symbols if there are
-        no unresolved symbols.  */
+         no unresolved symbols.  */
       for (hash = 0; hash < HASHSIZE; hash++)
        {
          if (global_sym_chain[hash])
@@ -5009,7 +5075,7 @@ scan_file_globals (objfile)
       if (hash >= HASHSIZE)
        return;
 
-      for (msymbol = resolve_objfile -> msymbols;
+      for (msymbol = resolve_objfile->msymbols;
           msymbol && SYMBOL_NAME (msymbol) != NULL;
           msymbol++)
        {
@@ -5036,7 +5102,7 @@ scan_file_globals (objfile)
          for (sym = global_sym_chain[hash]; sym;)
            {
              if (SYMBOL_NAME (msymbol)[0] == SYMBOL_NAME (sym)[0] &&
-                 STREQ(SYMBOL_NAME (msymbol) + 1, SYMBOL_NAME (sym) + 1))
+                 STREQ (SYMBOL_NAME (msymbol) + 1, SYMBOL_NAME (sym) + 1))
                {
 
                  struct alias_list *aliases;
@@ -5051,7 +5117,7 @@ scan_file_globals (objfile)
                    {
                      global_sym_chain[hash] = SYMBOL_VALUE_CHAIN (sym);
                    }
-                 
+
                  /* Check to see whether we need to fix up a common block.  */
                  /* Note: this code might be executed several times for
                     the same symbol if there are multiple references.  */
@@ -5059,7 +5125,7 @@ scan_file_globals (objfile)
                  /* If symbol has aliases, do minimal symbol fixups for each.
                     These live aliases/references weren't added to 
                     global_sym_chain hash but may also need to be fixed up. */
-                 /* FIXME: Maybe should have added aliases to the global chain,                     resolved symbol name, then treated aliases as normal 
+                 /* FIXME: Maybe should have added aliases to the global chain,                     resolved symbol name, then treated aliases as normal 
                     symbols?  Still, we wouldn't want to add_to_list. */
                  /* Now do the same for each alias of this symbol */
                  rsym = sym;
@@ -5086,7 +5152,7 @@ scan_file_globals (objfile)
                        rsym = NULL;
                    }
 
-                 
+
                  if (prev)
                    {
                      sym = SYMBOL_VALUE_CHAIN (prev);
@@ -5127,7 +5193,7 @@ scan_file_globals (objfile)
            SYMBOL_CLASS (prev) = LOC_UNRESOLVED;
          else
            complain (&unresolved_sym_chain_complaint,
-                     objfile -> name, SYMBOL_NAME (prev));
+                     objfile->name, SYMBOL_NAME (prev));
        }
     }
   memset (global_sym_chain, 0, sizeof (global_sym_chain));
@@ -5156,7 +5222,8 @@ stabsread_new_init ()
 /* Initialize anything that needs initializing at the same time as
    start_symtab() is called. */
 
-void start_stabs ()
+void
+start_stabs ()
 {
   global_stabs = NULL;         /* AIX COFF */
   /* Leave FILENUM of 0 free for builtin types and this file's types.  */
@@ -5172,7 +5239,8 @@ void start_stabs ()
 
 /* Call after end_symtab() */
 
-void end_stabs ()
+void
+end_stabs ()
 {
   if (type_vector)
     {
index e36316e..c586f45 100644 (file)
@@ -1,22 +1,22 @@
 /* Print and select stack frames for GDB, the GNU debugger.
-   Copyright 1986, 87, 89, 91, 92, 93, 94, 95, 96, 98, 1999
-   Free Software Foundation, Inc.
+   Copyright 1986, 1987, 1989, 1991-1996, 1998-2000 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include <ctype.h>
 #include "defs.h"
@@ -36,6 +36,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "annotate.h"
 #include "symfile.h"
 #include "objfiles.h"
+#ifdef UI_OUT
+#include "ui-out.h"
+#endif
 
 /* Prototypes for exported functions. */
 
@@ -65,32 +68,38 @@ static void up_silently_command PARAMS ((char *, int));
 
 void frame_command PARAMS ((char *, int));
 
+static void current_frame_command PARAMS ((char *, int));
+
 static void select_frame_command PARAMS ((char *, int));
 
-static void print_frame_arg_vars PARAMS ((struct frame_info *, GDB_FILE *));
+static void print_frame_arg_vars (struct frame_info *, struct ui_file *);
 
 static void catch_info PARAMS ((char *, int));
 
 static void args_plus_locals_info PARAMS ((char *, int));
 
-static void print_frame_label_vars PARAMS ((struct frame_info *,
-                                           int,
-                                           GDB_FILE *));
+static void print_frame_label_vars (struct frame_info *, int,
+                                   struct ui_file *);
 
-static void print_frame_local_vars PARAMS ((struct frame_info *,
-                                           int,
-                                           GDB_FILE *));
+static void print_frame_local_vars (struct frame_info *, int,
+                                   struct ui_file *);
 
-static int print_block_frame_labels PARAMS ((struct block *, int *,
-                                            GDB_FILE *));
+static int print_block_frame_labels (struct block *, int *,
+                                    struct ui_file *);
 
-static int print_block_frame_locals PARAMS ((struct block *,
-                                            struct frame_info *,
-                                            int,
-                                            GDB_FILE *));
+static int print_block_frame_locals (struct block *,
+                                    struct frame_info *,
+                                    int,
+                                    struct ui_file *);
+
+static void print_frame (struct frame_info *fi, 
+                        int level, 
+                        int source, 
+                        int args, 
+                        struct symtab_and_line sal);
 
 static void print_frame_info_base PARAMS ((struct frame_info *, int, int, int));
-  
+
 static void print_stack_frame_base PARAMS ((struct frame_info *, int, int));
 
 static void backtrace_command PARAMS ((char *, int));
@@ -121,24 +130,26 @@ int selected_frame_level;
    cases and in a slightly different syntax.  */
 
 int annotation_level = 0;
-
 \f
-struct print_stack_frame_args {
-  struct frame_info *fi;
-  int level;
-  int source;
-  int args;
-};
+
+struct print_stack_frame_args
+  {
+    struct frame_info *fi;
+    int level;
+    int source;
+    int args;
+  };
 
 static int print_stack_frame_base_stub PARAMS ((char *));
 
 /* Show and print the frame arguments.
    Pass the args the way catch_errors wants them.  */
+static int show_and_print_stack_frame_stub PARAMS ((void *args));
 static int
 show_and_print_stack_frame_stub (args)
-     char *args;
+     void *args;
 {
-  struct print_stack_frame_args *p = (struct print_stack_frame_args *)args;
+  struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
   /* Reversed order of these so tuiDo() doesn't occur
    * in the middle of "Breakpoint 1 ... [location]" printing = RT
@@ -152,11 +163,12 @@ show_and_print_stack_frame_stub (args)
 
 /* Show or print the frame arguments.
    Pass the args the way catch_errors wants them.  */
+static int print_stack_frame_stub PARAMS ((void *args));
 static int
 print_stack_frame_stub (args)
-     char *args;
+     void *args;
 {
-  struct print_stack_frame_args *p = (struct print_stack_frame_args *)args;
+  struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
   if (tui_version)
     print_frame_info (p->fi, p->level, p->source, p->args);
@@ -174,7 +186,7 @@ static int
 print_stack_frame_base_stub (args)
      char *args;
 {
-  struct print_stack_frame_args *p = (struct print_stack_frame_args *)args;
+  struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
   print_frame_info_base (p->fi, p->level, p->source, p->args);
   return 0;
@@ -182,11 +194,12 @@ print_stack_frame_base_stub (args)
 
 /* print the frame arguments to the terminal.  
    Pass the args the way catch_errors wants them.  */
+static int print_only_stack_frame_stub PARAMS ((void *));
 static int
 print_only_stack_frame_stub (args)
-     char *args;
+     void *args;
 {
-  struct print_stack_frame_args *p = (struct print_stack_frame_args *)args;
+  struct print_stack_frame_args *p = (struct print_stack_frame_args *) args;
 
   print_frame_info_base (p->fi, p->level, p->source, p->args);
   return 0;
@@ -215,7 +228,7 @@ print_stack_frame_base (fi, level, source)
   args.source = source;
   args.args = 1;
 
-  catch_errors (print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ALL);
+  catch_errors (print_stack_frame_stub, &args, "", RETURN_MASK_ALL);
 }
 
 /* Show and print a stack frame briefly.  FRAME_INFI should be the frame info
@@ -241,7 +254,7 @@ show_and_print_stack_frame (fi, level, source)
   args.source = source;
   args.args = 1;
 
-  catch_errors (show_and_print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ALL);
+  catch_errors (show_and_print_stack_frame_stub, &args, "", RETURN_MASK_ALL);
 }
 
 
@@ -268,7 +281,7 @@ print_stack_frame (fi, level, source)
   args.source = source;
   args.args = 1;
 
-  catch_errors (print_stack_frame_stub, (char *)&args, "", RETURN_MASK_ALL);
+  catch_errors (print_stack_frame_stub, (char *) &args, "", RETURN_MASK_ALL);
 }
 
 /* Print a stack frame briefly.  FRAME_INFI should be the frame info
@@ -294,13 +307,14 @@ print_only_stack_frame (fi, level, source)
   args.source = source;
   args.args = 1;
 
-  catch_errors (print_only_stack_frame_stub, 
-                (char *)&args, "", RETURN_MASK_ALL);
+  catch_errors (print_only_stack_frame_stub, &args, "", RETURN_MASK_ALL);
 }
 
-struct print_args_args {
+struct print_args_args
+{
   struct symbol *func;
   struct frame_info *fi;
+  struct ui_file *stream;
 };
 
 static int print_args_stub PARAMS ((PTR));
@@ -312,22 +326,22 @@ print_args_stub (args)
      PTR args;
 {
   int numargs;
-  struct print_args_args *p = (struct print_args_args *)args;
+  struct print_args_args *p = (struct print_args_args *) args;
 
-  FRAME_NUM_ARGS (numargs, (p->fi));
-  print_frame_args (p->func, p->fi, numargs, gdb_stdout);
+  numargs = FRAME_NUM_ARGS (p->fi);
+  print_frame_args (p->func, p->fi, numargs, p->stream);
   return 0;
 }
 
 /* Print information about a frame for frame "fi" at level "level".
- * Used in "where" output, also used to emit breakpoint or step messages.
- * LEVEL is the level of the frame, or -1 if it is the innermost frame
- * but we don't want to print the level.
- * The meaning of the SOURCE argument is:
- * -1: Print only source line
- *  0: Print only location
- *  1: Print location and source line
- */
+   Used in "where" output, also used to emit breakpoint or step
+   messages.  
+   LEVEL is the level of the frame, or -1 if it is the
+   innermost frame but we don't want to print the level.  
+   The meaning of the SOURCE argument is: 
+   SRC_LINE: Print only source line
+   LOCATION: Print only location 
  LOC_AND_SRC: Print location and source line.  */
 
 static void
 print_frame_info_base (fi, level, source, args)
@@ -337,9 +351,8 @@ print_frame_info_base (fi, level, source, args)
      int args;
 {
   struct symtab_and_line sal;
-  struct symbol *func;
-  register char *funname = 0;
-  enum language funlang = language_unknown;
+  int source_print;
+  int location_print;
 
 #if 0
   char buf[MAX_REGISTER_RAW_SIZE];
@@ -348,8 +361,8 @@ print_frame_info_base (fi, level, source, args)
   /* On the 68k, this spends too much time in m68k_find_saved_regs.  */
 
   /* Get the value of SP_REGNUM relative to the frame.  */
-  get_saved_register (buf, (int *)NULL, (CORE_ADDR *)NULL,
-                     FRAME_INFO_ID (fi), SP_REGNUM, (enum lval_type *)NULL);
+  get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL,
+                   FRAME_INFO_ID (fi), SP_REGNUM, (enum lval_type *) NULL);
   sp = extract_address (buf, REGISTER_RAW_SIZE (SP_REGNUM));
 
   /* This is not a perfect test, because if a function alloca's some
@@ -364,7 +377,7 @@ print_frame_info_base (fi, level, source, args)
       annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
 
       /* Do this regardless of SOURCE because we don't have any source
-        to list for this frame.  */
+         to list for this frame.  */
       if (level >= 0)
        printf_filtered ("#%-2d ", level);
       annotate_function_call ();
@@ -377,7 +390,7 @@ print_frame_info_base (fi, level, source, args)
       annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
 
       /* Do this regardless of SOURCE because we don't have any source
-        to list for this frame.  */
+         to list for this frame.  */
       if (level >= 0)
        printf_filtered ("#%-2d ", level);
       annotate_signal_handler_caller ();
@@ -398,28 +411,91 @@ print_frame_info_base (fi, level, source, args)
                  && !fi->next->signal_handler_caller
                  && !frame_in_dummy (fi->next));
 
+  location_print = (source == LOCATION 
+                   || source == LOC_AND_ADDRESS
+                   || source == SRC_AND_LOC);
+
+  if (location_print || !sal.symtab)
+    print_frame (fi, level, source, args, sal);
+
+  source_print = (source == SRC_LINE || source == SRC_AND_LOC);
+
+  if (source_print && sal.symtab)
+    {
+      int done = 0;
+      int mid_statement = (source == SRC_LINE) && (fi->pc != sal.pc);
+
+      if (annotation_level)
+       done = identify_source_line (sal.symtab, sal.line, mid_statement,
+                                    fi->pc);
+      if (!done)
+       {
+         if (addressprint && mid_statement && !tui_version)
+           {
+#ifdef UI_OUT
+             ui_out_field_core_addr (uiout, "addr", fi->pc);
+             ui_out_text (uiout, "\t");
+#else
+             print_address_numeric (fi->pc, 1, gdb_stdout);
+             printf_filtered ("\t");
+#endif
+           }
+         if (print_frame_info_listing_hook)
+           print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0);
+         else if (!tui_version)
+           print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
+       }
+      current_source_line = max (sal.line - lines_to_list / 2, 1);
+    }
+
+  if (source != 0)
+    set_default_breakpoint (1, fi->pc, sal.symtab, sal.line);
+
+  annotate_frame_end ();
+
+  gdb_flush (gdb_stdout);
+}
+
+static void
+print_frame (struct frame_info *fi, 
+            int level, 
+            int source, 
+            int args, 
+            struct symtab_and_line sal)
+{
+  struct symbol *func;
+  register char *funname = 0;
+  enum language funlang = language_unknown;
+#ifdef UI_OUT
+  struct ui_stream *stb;
+  struct cleanup *old_chain;
+
+  stb = ui_out_stream_new (uiout);
+  old_chain = make_cleanup ((make_cleanup_func) ui_out_stream_delete, stb);
+#endif /* UI_OUT */
+
   func = find_pc_function (fi->pc);
   if (func)
     {
       /* In certain pathological cases, the symtabs give the wrong
-        function (when we are in the first function in a file which
-        is compiled without debugging symbols, the previous function
-        is compiled with debugging symbols, and the "foo.o" symbol
-        that is supposed to tell us where the file with debugging symbols
-        ends has been truncated by ar because it is longer than 15
-        characters).  This also occurs if the user uses asm() to create
-        a function but not stabs for it (in a file compiled -g).
-
-        So look in the minimal symbol tables as well, and if it comes
-        up with a larger address for the function use that instead.
-        I don't think this can ever cause any problems; there shouldn't
-        be any minimal symbols in the middle of a function; if this is
-        ever changed many parts of GDB will need to be changed (and we'll
-        create a find_pc_minimal_function or some such).  */
+         function (when we are in the first function in a file which
+         is compiled without debugging symbols, the previous function
+         is compiled with debugging symbols, and the "foo.o" symbol
+         that is supposed to tell us where the file with debugging symbols
+         ends has been truncated by ar because it is longer than 15
+         characters).  This also occurs if the user uses asm() to create
+         a function but not stabs for it (in a file compiled -g).
+
+         So look in the minimal symbol tables as well, and if it comes
+         up with a larger address for the function use that instead.
+         I don't think this can ever cause any problems; there shouldn't
+         be any minimal symbols in the middle of a function; if this is
+         ever changed many parts of GDB will need to be changed (and we'll
+         create a find_pc_minimal_function or some such).  */
 
       struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (fi->pc);
       if (msymbol != NULL
-         && (SYMBOL_VALUE_ADDRESS (msymbol) 
+         && (SYMBOL_VALUE_ADDRESS (msymbol)
              > BLOCK_START (SYMBOL_BLOCK_VALUE (func))))
        {
 #if 0
@@ -438,31 +514,29 @@ print_frame_info_base (fi, level, source, args)
        }
       else
        {
-          /* I'd like to use SYMBOL_SOURCE_NAME() here, to display
-           * the demangled name that we already have stored in
-           * the symbol table, but we stored a version with
-           * DMGL_PARAMS turned on, and here we don't want
-           * to display parameters. So call the demangler again,
-           * with DMGL_ANSI only. RT
-           * (Yes, I know that printf_symbol_filtered() will
-           * again try to demangle the name on the fly, but
-           * the issue is that if cplus_demangle() fails here,
-           * it'll fail there too. So we want to catch the failure
-           * ("demangled==NULL" case below) here, while we still
-           * have our hands on the function symbol.)
-           */
-          char * demangled;
+         /* I'd like to use SYMBOL_SOURCE_NAME() here, to display the
+            demangled name that we already have stored in the symbol
+            table, but we stored a version with DMGL_PARAMS turned
+            on, and here we don't want to display parameters. So call
+            the demangler again, with DMGL_ANSI only. (Yes, I know
+            that printf_symbol_filtered() will again try to demangle
+            the name on the fly, but the issue is that if
+            cplus_demangle() fails here, it'll fail there too. So we
+            want to catch the failure ("demangled==NULL" case below)
+            here, while we still have our hands on the function
+            symbol.) */
+         char *demangled;
          funname = SYMBOL_NAME (func);
          funlang = SYMBOL_LANGUAGE (func);
-          if (funlang == language_cplus) {
-            demangled = cplus_demangle (funname, DMGL_ANSI);
-            if (demangled == NULL)
-              /* If the demangler fails, try the demangled name
-               * from the symbol table. This'll have parameters,
-               * but that's preferable to diplaying a mangled name.
-               */
-             funname = SYMBOL_SOURCE_NAME (func);
-          }
+         if (funlang == language_cplus)
+           {
+             demangled = cplus_demangle (funname, DMGL_ANSI);
+             if (demangled == NULL)
+               /* If the demangler fails, try the demangled name from
+                  the symbol table. This'll have parameters, but
+                  that's preferable to diplaying a mangled name. */
+               funname = SYMBOL_SOURCE_NAME (func);
+           }
        }
     }
   else
@@ -475,145 +549,190 @@ print_frame_info_base (fi, level, source, args)
        }
     }
 
-  if (source >= 0 || !sal.symtab)
-    {
-      annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
+  annotate_frame_begin (level == -1 ? 0 : level, fi->pc);
 
-      if (level >= 0)
-       printf_filtered ("#%-2d ", level);
-      if (addressprint)
-       if (fi->pc != sal.pc || !sal.symtab)
-         {
-           annotate_frame_address ();
-           print_address_numeric (fi->pc, 1, gdb_stdout);
-           annotate_frame_address_end ();
-           printf_filtered (" in ");
-         }
-      annotate_frame_function_name ();
-      fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
-                              DMGL_ANSI);
+#ifdef UI_OUT
+  ui_out_list_begin (uiout, "frame");
+#endif
+
+  if (level >= 0)
+    {
+#ifdef UI_OUT
+      ui_out_text (uiout, "#");
+      ui_out_field_fmt (uiout, "level", "%-2d", level);
+      ui_out_spaces (uiout, 1);
+#else
+      printf_filtered ("#%-2d ", level);
+#endif
+    }
+  if (addressprint)
+    if (fi->pc != sal.pc || !sal.symtab || source == LOC_AND_ADDRESS)
+      {
+       annotate_frame_address ();
+#ifdef UI_OUT
+       ui_out_field_core_addr (uiout, "addr", fi->pc);
+       annotate_frame_address_end ();
+       ui_out_text (uiout, " in ");
+#else
+       print_address_numeric (fi->pc, 1, gdb_stdout);
+       annotate_frame_address_end ();
+       printf_filtered (" in ");
+#endif
+      }
+  annotate_frame_function_name ();
+#ifdef UI_OUT
+  fprintf_symbol_filtered (stb->stream, funname ? funname : "??", funlang,
+                          DMGL_ANSI);
+  ui_out_field_stream (uiout, "func", stb);
+  ui_out_wrap_hint (uiout, "   ");
+#else
+  fprintf_symbol_filtered (gdb_stdout, funname ? funname : "??", funlang,
+                          DMGL_ANSI);
+  wrap_here ("   ");
+#endif
+  annotate_frame_args ();
+      
+#ifdef UI_OUT
+  ui_out_text (uiout, " (");
+#else
+  fputs_filtered (" (", gdb_stdout);
+#endif
+  if (args)
+    {
+      struct print_args_args args;
+      args.fi = fi;
+      args.func = func;
+      args.stream = gdb_stdout;
+#ifdef UI_OUT
+      ui_out_list_begin (uiout, "args");
+      catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
+      /* FIXME: args must be a list. If one argument is a string it will
+                have " that will not be properly escaped.  */
+      ui_out_list_end (uiout);
+#else
+      catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
+#endif
+      QUIT;
+    }
+#ifdef UI_OUT
+  ui_out_text (uiout, ")");
+#else
+  printf_filtered (")");
+#endif
+  if (sal.symtab && sal.symtab->filename)
+    {
+      annotate_frame_source_begin ();
+#ifdef UI_OUT
+      ui_out_wrap_hint (uiout, "   ");
+      ui_out_text (uiout, " at ");
+      annotate_frame_source_file ();
+      ui_out_field_string (uiout, "file", sal.symtab->filename);
+      annotate_frame_source_file_end ();
+      ui_out_text (uiout, ":");
+      annotate_frame_source_line ();
+      ui_out_field_int (uiout, "line", sal.line);
+#else
       wrap_here ("   ");
-      annotate_frame_args ();
-      fputs_filtered (" (", gdb_stdout);
-      if (args)
-       {
-         struct print_args_args args;
-         args.fi = fi;
-         args.func = func;
-         catch_errors (print_args_stub, &args, "", RETURN_MASK_ALL);
-         QUIT;
-       }
-      printf_filtered (")");
-      if (sal.symtab && sal.symtab->filename)
-       {
-         annotate_frame_source_begin ();
-          wrap_here ("   ");
-         printf_filtered (" at ");
-         annotate_frame_source_file ();
-         printf_filtered ("%s", sal.symtab->filename);
-         annotate_frame_source_file_end ();
-         printf_filtered (":");
-         annotate_frame_source_line ();
-         printf_filtered ("%d", sal.line);
-         annotate_frame_source_end ();
-       }
+      printf_filtered (" at ");
+      annotate_frame_source_file ();
+      printf_filtered ("%s", sal.symtab->filename);
+      annotate_frame_source_file_end ();
+      printf_filtered (":");
+      annotate_frame_source_line ();
+      printf_filtered ("%d", sal.line);
+#endif
+      annotate_frame_source_end ();
+    }
 
 #ifdef PC_LOAD_SEGMENT
-     /* If we couldn't print out function name but if can figure out what
-        load segment this pc value is from, at least print out some info
-       about its load segment. */
-      if (!funname)
-       {
-         annotate_frame_where ();
-         wrap_here ("  ");
-         printf_filtered (" from %s", PC_LOAD_SEGMENT (fi->pc));
-       }
-#endif
-#ifdef PC_SOLIB
-      if (!funname || (!sal.symtab || !sal.symtab->filename))
-       {
-         char *lib = PC_SOLIB (fi->pc);
-         if (lib)
-           {
-             annotate_frame_where ();
-             wrap_here ("  ");
-             printf_filtered (" from %s", lib);
-           }
-       }
+  /* If we couldn't print out function name but if can figure out what
+         load segment this pc value is from, at least print out some info
+         about its load segment. */
+  if (!funname)
+    {
+      annotate_frame_where ();
+#ifdef UI_OUT
+      ui_out_wrap_hint (uiout, "  ");
+      ui_out_text (uiout, " from ");
+      ui_out_field_string (uiout, "from", PC_LOAD_SEGMENT (fi->pc));
+#else
+      wrap_here ("  ");
+      printf_filtered (" from %s", PC_LOAD_SEGMENT (fi->pc));
 #endif
-      printf_filtered ("\n");
     }
+#endif /* PC_LOAD_SEGMENT */
 
-  if ((source != 0) && sal.symtab)
+#ifdef PC_SOLIB
+  if (!funname || (!sal.symtab || !sal.symtab->filename))
     {
-      int done = 0;
-      int mid_statement = source < 0 && fi->pc != sal.pc;
-      if (annotation_level)
-       done = identify_source_line (sal.symtab, sal.line, mid_statement,
-                                    fi->pc);
-      if (!done)
+      char *lib = PC_SOLIB (fi->pc);
+      if (lib)
        {
-         if (addressprint && mid_statement && !tui_version)
-           {
-             print_address_numeric (fi->pc, 1, gdb_stdout);
-             printf_filtered ("\t");
-           }
-         if (print_frame_info_listing_hook)
-           print_frame_info_listing_hook (sal.symtab, sal.line, sal.line + 1, 0);
-         else if (!tui_version)
-           print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
+         annotate_frame_where ();
+#ifdef UI_OUT
+         ui_out_wrap_hint (uiout, "  ");
+         ui_out_text (uiout, " from ");
+         ui_out_field_string (uiout, "from", lib);
+#else
+         wrap_here ("  ");
+         printf_filtered (" from %s", lib);
+#endif
        }
-      current_source_line = max (sal.line - lines_to_list/2, 1);
     }
-  if (source != 0)
-    set_default_breakpoint (1, fi->pc, sal.symtab, sal.line);
-
-  annotate_frame_end ();
+#endif /* PC_SOLIB */
 
-  gdb_flush (gdb_stdout);
+#ifdef UI_OUT
+  ui_out_list_end (uiout);
+  ui_out_text (uiout, "\n");
+  do_cleanups (old_chain);
+#else
+  printf_filtered ("\n");
+#endif
 }
 \f
 
+#if 0
 void
-stack_publish_stopped_with_no_frame()
+stack_publish_stopped_with_no_frame ()
 {
-  TUIDO(((TuiOpaqueFuncPtr)tuiUpdateOnEnd));
+  TUIDO (((TuiOpaqueFuncPtr) tuiUpdateOnEnd));
 
   return;
 }
+#endif
 
 /* Show or print the frame info.  If this is the tui, it will be shown in 
    the source display */
 void
-print_frame_info(fi, level, source, args)
+print_frame_info (fi, level, source, args)
      struct frame_info *fi;
      register int level;
      int source;
      int args;
 {
   if (!tui_version)
-    print_frame_info_base(fi, level, source, args);
+    print_frame_info_base (fi, level, source, args);
   else
-  {
-    if (fi && (frame_in_dummy(fi) || fi->signal_handler_caller))
-      print_frame_info_base(fi, level, source, args);
-    else
-      {
-       TUIDO(((TuiOpaqueFuncPtr)tui_vShowFrameInfo, fi));
-      }
-  }
+    {
+      if (fi && (frame_in_dummy (fi) || fi->signal_handler_caller))
+       print_frame_info_base (fi, level, source, args);
+      else
+       {
+         TUIDO (((TuiOpaqueFuncPtr) tui_vShowFrameInfo, fi));
+       }
+    }
 }
 
 /* Show the frame info.  If this is the tui, it will be shown in 
    the source display otherwise, nothing is done */
 void
-show_stack_frame(fi)
+show_stack_frame (fi)
      struct frame_info *fi;
 {
-  TUIDO(((TuiOpaqueFuncPtr)tui_vShowFrameInfo, fi));
+  TUIDO (((TuiOpaqueFuncPtr) tui_vShowFrameInfo, fi));
 }
-
 \f
+
 /* Read a frame specification in whatever the appropriate format is.
    Call error() if the specification is in any way invalid (i.e.
    this function never returns NULL).  */
@@ -625,22 +744,23 @@ parse_frame_specification (frame_exp)
   int numargs = 0;
 #define        MAXARGS 4
   CORE_ADDR args[MAXARGS];
-  
+
   if (frame_exp)
     {
       char *addr_string, *p;
       struct cleanup *tmp_cleanup;
 
-      while (*frame_exp == ' ') frame_exp++;
+      while (*frame_exp == ' ')
+       frame_exp++;
 
       while (*frame_exp)
        {
          if (numargs > MAXARGS)
            error ("Too many args in frame specification");
          /* Parse an argument.  */
-          for (p = frame_exp; *p && *p != ' '; p++)
+         for (p = frame_exp; *p && *p != ' '; p++)
            ;
-         addr_string = savestring(frame_exp, p - frame_exp);
+         addr_string = savestring (frame_exp, p - frame_exp);
 
          {
            tmp_cleanup = make_cleanup (free, addr_string);
@@ -649,7 +769,8 @@ parse_frame_specification (frame_exp)
          }
 
          /* Skip spaces, move to possible next arg.  */
-         while (*p == ' ') p++;
+         while (*p == ' ')
+           p++;
          frame_exp = p;
        }
     }
@@ -665,7 +786,7 @@ parse_frame_specification (frame_exp)
       {
        int level = args[0];
        struct frame_info *fid =
-         find_relative_frame (get_current_frame (), &level);
+       find_relative_frame (get_current_frame (), &level);
        struct frame_info *tfid;
 
        if (level == 0)
@@ -700,17 +821,17 @@ parse_frame_specification (frame_exp)
          while ((tfid = get_prev_frame (fid)) &&
                 (tfid->frame == args[0]))
            fid = tfid;
-         
+
        /* We couldn't identify the frame as an existing frame, but
           perhaps we can create one with a single argument.  */
       }
 
-     default:
+    default:
 #ifdef SETUP_ARBITRARY_FRAME
       return SETUP_ARBITRARY_FRAME (numargs, args);
 #else
       /* Usual case.  Do it here rather than have everyone supply
-        a SETUP_ARBITRARY_FRAME that does this.  */
+         a SETUP_ARBITRARY_FRAME that does this.  */
       if (numargs == 1)
        return create_new_frame (args[0], 0);
       error ("Too many args in frame specification");
@@ -759,7 +880,7 @@ frame_info (addr_exp, from_tty)
                      && !fi->next->signal_handler_caller
                      && !frame_in_dummy (fi->next));
   func = get_frame_function (fi);
-  s = find_pc_symtab(fi->pc);
+  s = find_pc_symtab (fi->pc);
   if (func)
     {
       /* I'd like to use SYMBOL_SOURCE_NAME() here, to display
@@ -775,19 +896,19 @@ frame_info (addr_exp, from_tty)
        * ("demangled==NULL" case below) here, while we still
        * have our hands on the function symbol.)
        */
-       char * demangled;
-       funname = SYMBOL_NAME (func);
-       funlang = SYMBOL_LANGUAGE (func);
-       if (funlang == language_cplus)
-        {
-          demangled = cplus_demangle (funname, DMGL_ANSI);
-          /* If the demangler fails, try the demangled name
-           * from the symbol table. This'll have parameters,
-           * but that's preferable to diplaying a mangled name.
-           */
-          if (demangled == NULL)
-            funname = SYMBOL_SOURCE_NAME (func);
-        }
+      char *demangled;
+      funname = SYMBOL_NAME (func);
+      funlang = SYMBOL_LANGUAGE (func);
+      if (funlang == language_cplus)
+       {
+         demangled = cplus_demangle (funname, DMGL_ANSI);
+         /* If the demangler fails, try the demangled name
+          * from the symbol table. This'll have parameters,
+          * but that's preferable to diplaying a mangled name.
+          */
+         if (demangled == NULL)
+           funname = SYMBOL_SOURCE_NAME (func);
+       }
     }
   else
     {
@@ -832,10 +953,8 @@ frame_info (addr_exp, from_tty)
   printf_filtered ("\n");
 
   {
-    int frameless = 0;
-#ifdef FRAMELESS_FUNCTION_INVOCATION
-    FRAMELESS_FUNCTION_INVOCATION (fi, frameless);
-#endif
+    int frameless;
+    frameless = FRAMELESS_FUNCTION_INVOCATION (fi);
     if (frameless)
       printf_filtered (" (FRAMELESS),");
   }
@@ -876,7 +995,7 @@ frame_info (addr_exp, from_tty)
        print_address_numeric (arg_list, 1, gdb_stdout);
        printf_filtered (",");
 
-       FRAME_NUM_ARGS (numargs, fi);
+       numargs = FRAME_NUM_ARGS (fi);
        if (numargs < 0)
          puts_filtered (" args: ");
        else if (numargs == 0)
@@ -907,7 +1026,7 @@ frame_info (addr_exp, from_tty)
   if (fi->saved_regs != NULL)
     {
       /* The sp is special; what's returned isn't the save address, but
-        actually the value of the previous frame's sp.  */
+         actually the value of the previous frame's sp.  */
       printf_filtered (" Previous frame's sp is ");
       print_address_numeric (fi->saved_regs[SP_REGNUM], 1, gdb_stdout);
       printf_filtered ("\n");
@@ -931,9 +1050,9 @@ frame_info (addr_exp, from_tty)
   else
     {
       /* We could get some information about saved registers by
-        calling get_saved_register on each register.  Which info goes
-        with which frame is necessarily lost, however, and I suspect
-        that the users don't care whether they get the info.  */
+         calling get_saved_register on each register.  Which info goes
+         with which frame is necessarily lost, however, and I suspect
+         that the users don't care whether they get the info.  */
       puts_filtered ("\n");
     }
 }
@@ -971,6 +1090,7 @@ backtrace_limit_info (arg, from_tty)
 
 /* Print briefly all stack frames or just the innermost COUNT frames.  */
 
+static void backtrace_command_1 PARAMS ((char *count_exp, int show_locals, int from_tty));
 static void
 backtrace_command_1 (count_exp, show_locals, from_tty)
      char *count_exp;
@@ -1007,7 +1127,7 @@ backtrace_command_1 (count_exp, show_locals, from_tty)
              QUIT;
              current = get_prev_frame (current);
            }
-         
+
          /* Will stop when CURRENT reaches the top of the stack.  TRAILING
             will be COUNT below it.  */
          while (current)
@@ -1017,7 +1137,7 @@ backtrace_command_1 (count_exp, show_locals, from_tty)
              current = get_prev_frame (current);
              trailing_level++;
            }
-         
+
          count = -1;
        }
     }
@@ -1027,12 +1147,12 @@ backtrace_command_1 (count_exp, show_locals, from_tty)
   if (info_verbose)
     {
       struct partial_symtab *ps;
-      
+
       /* Read in symbols for all of the frames.  Need to do this in
-        a separate pass so that "Reading in symbols for xxx" messages
-        don't screw up the appearance of the backtrace.  Also
-        if people have strong opinions against reading symbols for
-        backtrace this may have to be an option.  */
+         a separate pass so that "Reading in symbols for xxx" messages
+         don't screw up the appearance of the backtrace.  Also
+         if people have strong opinions against reading symbols for
+         backtrace this may have to be an option.  */
       i = count;
       for (fi = trailing;
           fi != NULL && i--;
@@ -1052,12 +1172,12 @@ backtrace_command_1 (count_exp, show_locals, from_tty)
       QUIT;
 
       /* Don't use print_stack_frame; if an error() occurs it probably
-        means further attempts to backtrace would fail (on the other
-        hand, perhaps the code does or could be fixed to make sure
-        the frame->prev field gets set to NULL in that case).  */
+         means further attempts to backtrace would fail (on the other
+         hand, perhaps the code does or could be fixed to make sure
+         the frame->prev field gets set to NULL in that case).  */
       print_frame_info_base (fi, trailing_level + i, 0, 1);
       if (show_locals)
-       print_frame_local_vars(fi, 1, gdb_stdout);
+       print_frame_local_vars (fi, 1, gdb_stdout);
     }
 
   /* If we've stopped before the end, mention that.  */
@@ -1070,68 +1190,69 @@ backtrace_command (arg, from_tty)
      char *arg;
      int from_tty;
 {
-  struct cleanup    *old_chain = (struct cleanup *)NULL;
-  char              **argv = (char **)NULL;
-  int               argIndicatingFullTrace = (-1), totArgLen = 0, argc = 0;
-  char              *argPtr = arg;
+  struct cleanup *old_chain = (struct cleanup *) NULL;
+  char **argv = (char **) NULL;
+  int argIndicatingFullTrace = (-1), totArgLen = 0, argc = 0;
+  char *argPtr = arg;
 
-  if (arg != (char *)NULL)
+  if (arg != (char *) NULL)
     {
       int i;
 
-      argv = buildargv(arg);
-      old_chain = make_cleanup ((make_cleanup_func) freeargv, (char *)argv);
+      argv = buildargv (arg);
+      old_chain = make_cleanup_freeargv (argv);
       argc = 0;
-      for (i = 0; (argv[i] != (char *)NULL); i++)
-        {
-          int j;
-
-          for (j = 0; (j < strlen(argv[i])); j++)
-            argv[i][j] = tolower(argv[i][j]);
-
-          if (argIndicatingFullTrace < 0 && subsetCompare(argv[i], "full"))
-            argIndicatingFullTrace = argc;
-          else
-            {
-              argc++;
-              totArgLen += strlen(argv[i]);
-            }
-        }
+      for (i = 0; (argv[i] != (char *) NULL); i++)
+       {
+         unsigned int j;
+
+         for (j = 0; (j < strlen (argv[i])); j++)
+           argv[i][j] = tolower (argv[i][j]);
+
+         if (argIndicatingFullTrace < 0 && subset_compare (argv[i], "full"))
+           argIndicatingFullTrace = argc;
+         else
+           {
+             argc++;
+             totArgLen += strlen (argv[i]);
+           }
+       }
       totArgLen += argc;
       if (argIndicatingFullTrace >= 0)
-        {
-          if (totArgLen > 0)
-            {
-              argPtr = (char *)xmalloc(totArgLen + 1);
-              if (!argPtr)
-                nomem(0);
-              else
-                {
-                  memset(argPtr, 0, totArgLen + 1);
-                  for (i = 0; (i < (argc + 1)); i++)
-                    {
-                      if (i != argIndicatingFullTrace)
-                        {
-                          strcat(argPtr, argv[i]);
-                          strcat(argPtr, " ");
-                        }
-                    }
-                }
-            }
-          else
-            argPtr = (char *)NULL;
-        }
+       {
+         if (totArgLen > 0)
+           {
+             argPtr = (char *) xmalloc (totArgLen + 1);
+             if (!argPtr)
+               nomem (0);
+             else
+               {
+                 memset (argPtr, 0, totArgLen + 1);
+                 for (i = 0; (i < (argc + 1)); i++)
+                   {
+                     if (i != argIndicatingFullTrace)
+                       {
+                         strcat (argPtr, argv[i]);
+                         strcat (argPtr, " ");
+                       }
+                   }
+               }
+           }
+         else
+           argPtr = (char *) NULL;
+       }
     }
 
   backtrace_command_1 (argPtr, (argIndicatingFullTrace >= 0), from_tty);
 
   if (argIndicatingFullTrace >= 0 && totArgLen > 0)
-    free(argPtr);
+    free (argPtr);
 
   if (old_chain)
-    do_cleanups(old_chain);
+    do_cleanups (old_chain);
 }
 
+static void backtrace_full_command PARAMS ((char *arg, int from_tty));
 static void
 backtrace_full_command (arg, from_tty)
      char *arg;
@@ -1139,8 +1260,8 @@ backtrace_full_command (arg, from_tty)
 {
   backtrace_command_1 (arg, 1, from_tty);
 }
-
 \f
+
 /* Print the local variables of a block B active in FRAME.
    Return 1 if any variables were printed; 0 otherwise.  */
 
@@ -1149,7 +1270,7 @@ print_block_frame_locals (b, fi, num_tabs, stream)
      struct block *b;
      register struct frame_info *fi;
      int num_tabs;
-     register GDB_FILE *stream;
+     register struct ui_file *stream;
 {
   int nsyms;
   register int i, j;
@@ -1169,7 +1290,7 @@ print_block_frame_locals (b, fi, num_tabs, stream)
        case LOC_BASEREG:
          values_printed = 1;
          for (j = 0; j < num_tabs; j++)
-           fputs_filtered("\t", stream);
+           fputs_filtered ("\t", stream);
          fputs_filtered (SYMBOL_SOURCE_NAME (sym), stream);
          fputs_filtered (" = ", stream);
          print_variable_value (sym, fi, stream);
@@ -1190,7 +1311,7 @@ static int
 print_block_frame_labels (b, have_default, stream)
      struct block *b;
      int *have_default;
-     register GDB_FILE *stream;
+     register struct ui_file *stream;
 {
   int nsyms;
   register int i;
@@ -1238,7 +1359,7 @@ static void
 print_frame_local_vars (fi, num_tabs, stream)
      register struct frame_info *fi;
      register int num_tabs;
-     register GDB_FILE *stream;
+     register struct ui_file *stream;
 {
   register struct block *block = get_frame_block (fi);
   register int values_printed = 0;
@@ -1248,14 +1369,14 @@ print_frame_local_vars (fi, num_tabs, stream)
       fprintf_filtered (stream, "No symbol table info available.\n");
       return;
     }
-  
+
   while (block != 0)
     {
       if (print_block_frame_locals (block, fi, num_tabs, stream))
        values_printed = 1;
       /* After handling the function's top-level block, stop.
-        Don't continue to its superblock, the block of
-        per-file symbols.  */
+         Don't continue to its superblock, the block of
+         per-file symbols.  */
       if (BLOCK_FUNCTION (block))
        break;
       block = BLOCK_SUPERBLOCK (block);
@@ -1273,7 +1394,7 @@ static void
 print_frame_label_vars (fi, this_level_only, stream)
      register struct frame_info *fi;
      int this_level_only;
-     register GDB_FILE *stream;
+     register struct ui_file *stream;
 {
   register struct blockvector *bl;
   register struct block *block = get_frame_block (fi);
@@ -1326,8 +1447,8 @@ print_frame_label_vars (fi, this_level_only, stream)
        return;
 
       /* After handling the function's top-level block, stop.
-        Don't continue to its superblock, the block of
-        per-file symbols.  */
+         Don't continue to its superblock, the block of
+         per-file symbols.  */
       if (BLOCK_FUNCTION (block))
        break;
       block = BLOCK_SUPERBLOCK (block);
@@ -1355,9 +1476,9 @@ catch_info (ignore, from_tty)
      char *ignore;
      int from_tty;
 {
-  struct symtab_and_line * sal;
+  struct symtab_and_line *sal;
 
-  /* Check for target support for exception handling */ 
+  /* Check for target support for exception handling */
   sal = target_enable_exception_callback (EX_EVENT_CATCH, 1);
   if (sal)
     {
@@ -1366,16 +1487,16 @@ catch_info (ignore, from_tty)
          system to find the list of active handlers, etc. */
       fprintf_filtered (gdb_stdout, "Info catch not supported with this target/compiler combination.\n");
 #if 0
-  if (!selected_frame)
-    error ("No frame selected.");
+      if (!selected_frame)
+       error ("No frame selected.");
 #endif
     }
   else
     {
-      /* Assume g++ compiled code -- old v 4.16 behaviour */ 
+      /* Assume g++ compiled code -- old v 4.16 behaviour */
       if (!selected_frame)
-        error ("No frame selected.");
-      
+       error ("No frame selected.");
+
       print_frame_label_vars (selected_frame, 0, gdb_stdout);
     }
 }
@@ -1383,7 +1504,7 @@ catch_info (ignore, from_tty)
 static void
 print_frame_arg_vars (fi, stream)
      register struct frame_info *fi;
-     register GDB_FILE *stream;
+     register struct ui_file *stream;
 {
   struct symbol *func = get_frame_function (fi);
   register struct block *b;
@@ -1428,7 +1549,7 @@ print_frame_arg_vars (fi, stream)
             are not combined in symbol-reading.  */
 
          sym2 = lookup_symbol (SYMBOL_NAME (sym),
-                       b, VAR_NAMESPACE, (int *)NULL, (struct symtab **)NULL);
+                  b, VAR_NAMESPACE, (int *) NULL, (struct symtab **) NULL);
          print_variable_value (sym2, fi, stream);
          fprintf_filtered (stream, "\n");
          break;
@@ -1461,11 +1582,11 @@ args_plus_locals_info (ignore, from_tty)
      char *ignore;
      int from_tty;
 {
-  args_info(ignore, from_tty);
-  locals_info(ignore, from_tty);
+  args_info (ignore, from_tty);
+  locals_info (ignore, from_tty);
 }
-
 \f
+
 /* Select frame FI, and note that its stack level is LEVEL.
    LEVEL may be -1 if an actual level number is not known.  */
 
@@ -1484,54 +1605,57 @@ select_frame (fi, level)
   /* Ensure that symbols for this frame are read in.  Also, determine the
      source language of this frame, and switch to it if desired.  */
   if (fi)
-  {
-    s = find_pc_symtab (fi->pc);
-    if (s 
-       && s->language != current_language->la_language
-       && s->language != language_unknown
-       && language_mode == language_mode_auto) {
-      set_language(s->language);
+    {
+      s = find_pc_symtab (fi->pc);
+      if (s
+         && s->language != current_language->la_language
+         && s->language != language_unknown
+         && language_mode == language_mode_auto)
+       {
+         set_language (s->language);
+       }
+      /* elz: this if here fixes the problem with the pc not being displayed
+         in the tui asm layout, with no debug symbols. The value of s 
+         would be 0 here, and select_source_symtab would abort the
+         command by calling the 'error' function */
+      if (s)
+       {
+         TUIDO (((TuiOpaqueFuncPtr) tui_vSelectSourceSymtab, s));
+       }
     }
-    /* elz: this if here fixes the problem with the pc not being displayed
-       in the tui asm layout, with no debug symbols. The value of s 
-       would be 0 here, and select_source_symtab would abort the
-       command by calling the 'error' function*/
-    if (s)
-      {
-       TUIDO(((TuiOpaqueFuncPtr)tui_vSelectSourceSymtab, s));
-      }
-  }
 }
-
 \f
+
 /* Select frame FI, noting that its stack level is LEVEL.  Also print
    the stack frame and show the source if this is the tui version.  */
 void
-select_and_print_frame(fi, level)
+select_and_print_frame (fi, level)
      struct frame_info *fi;
      int level;
 {
-  select_frame(fi, level);
+  select_frame (fi, level);
   if (fi)
     {
-      print_stack_frame(fi, level, 1);
-      TUIDO(((TuiOpaqueFuncPtr)tui_vCheckDataValues, fi));
+      print_stack_frame (fi, level, 1);
+      TUIDO (((TuiOpaqueFuncPtr) tui_vCheckDataValues, fi));
     }
 }
-
 \f
+
 /* Select frame FI, noting that its stack level is LEVEL.  Be silent if
    not the TUI */
+#if 0
 void
 select_and_maybe_print_frame (fi, level)
      struct frame_info *fi;
      int level;
 {
   if (!tui_version)
-    select_frame(fi, level);
+    select_frame (fi, level);
   else
-    select_and_print_frame(fi, level);
+    select_and_print_frame (fi, level);
 }
+#endif
 
 
 /* Store the selected frame and its level into *FRAMEP and *LEVELP.
@@ -1590,13 +1714,14 @@ find_relative_frame (frame, level_offset_ptr)
   /* Going down is just as simple.  */
   if (*level_offset_ptr < 0)
     {
-      while (*level_offset_ptr < 0) {
-       frame1 = get_next_frame (frame);
-       if (!frame1)
-         break;
-       frame = frame1;
-       (*level_offset_ptr)++;
-      }
+      while (*level_offset_ptr < 0)
+       {
+         frame1 = get_next_frame (frame);
+         if (!frame1)
+           break;
+         frame = frame1;
+         (*level_offset_ptr)++;
+       }
     }
   return frame;
 }
@@ -1608,6 +1733,15 @@ find_relative_frame (frame, level_offset_ptr)
    frame expressions. */
 
 /* ARGSUSED */
+#ifdef UI_OUT
+void
+select_frame_command_wrapper (level_exp, from_tty)
+     char *level_exp;
+     int from_tty;
+{
+  select_frame_command (level_exp, from_tty);
+}
+#endif
 static void
 select_frame_command (level_exp, from_tty)
      char *level_exp;
@@ -1624,12 +1758,13 @@ select_frame_command (level_exp, from_tty)
   /* Try to figure out what level this frame is.  But if there is
      no current stack, don't error out -- let the user set one.  */
   frame1 = 0;
-  if (get_current_frame()) {
-    for (frame1 = get_prev_frame (0);
-        frame1 && frame1 != frame;
-        frame1 = get_prev_frame (frame1))
-      level++;
-  }
+  if (get_current_frame ())
+    {
+      for (frame1 = get_prev_frame (0);
+          frame1 && frame1 != frame;
+          frame1 = get_prev_frame (frame1))
+       level++;
+    }
 
   if (!frame1)
     level = 0;
@@ -1652,15 +1787,15 @@ frame_command (level_exp, from_tty)
 
 /* The XDB Compatibility command to print the current frame. */
 
-void
+static void
 current_frame_command (level_exp, from_tty)
      char *level_exp;
      int from_tty;
 {
   if (target_has_stack == 0 || selected_frame == 0)
-    error ("No stack."); 
- print_only_stack_frame (selected_frame, selected_frame_level, 1);
-  }
+    error ("No stack.");
 print_only_stack_frame (selected_frame, selected_frame_level, 1);
+}
 
 /* Select the frame up one or COUNT stack levels
    from the previously selected frame, and print it briefly.  */
@@ -1675,7 +1810,7 @@ up_silently_base (count_exp)
   if (count_exp)
     count = parse_and_eval_address (count_exp);
   count1 = count;
-  
+
   if (target_has_stack == 0 || selected_frame == 0)
     error ("No stack.");
 
@@ -1690,7 +1825,7 @@ up_silently_command (count_exp, from_tty)
      char *count_exp;
      int from_tty;
 {
-  up_silently_base(count_exp);
+  up_silently_base (count_exp);
   if (tui_version)
     print_stack_frame (selected_frame, selected_frame_level, 1);
 }
@@ -1715,9 +1850,9 @@ down_silently_base (count_exp)
   register struct frame_info *frame;
   int count = -1, count1;
   if (count_exp)
-    count = - parse_and_eval_address (count_exp);
+    count = -parse_and_eval_address (count_exp);
   count1 = count;
-  
+
   if (target_has_stack == 0 || selected_frame == 0)
     error ("No stack.");
 
@@ -1726,9 +1861,9 @@ down_silently_base (count_exp)
     {
 
       /* We only do this if count_exp is not specified.  That way "down"
-        means to really go down (and let me know if that is
-        impossible), but "down 9999" can be used to mean go all the way
-        down without getting an error.  */
+         means to really go down (and let me know if that is
+         impossible), but "down 9999" can be used to mean go all the way
+         down without getting an error.  */
 
       error ("Bottom (i.e., innermost) frame selected; you cannot go down.");
     }
@@ -1756,6 +1891,15 @@ down_command (count_exp, from_tty)
   show_and_print_stack_frame (selected_frame, selected_frame_level, 1);
 }
 \f
+#ifdef UI_OUT
+void
+return_command_wrapper (retval_exp, from_tty)
+     char *retval_exp;
+     int from_tty;
+{
+  return_command (retval_exp, from_tty);
+}
+#endif
 static void
 return_command (retval_exp, from_tty)
      char *retval_exp;
@@ -1789,7 +1933,7 @@ return_command (retval_exp, from_tty)
       return_value = value_cast (return_type, return_value);
 
       /* Make sure we have fully evaluated it, since
-        it might live in the stack frame we're about to pop.  */
+         it might live in the stack frame we're about to pop.  */
       if (VALUE_LAZY (return_value))
        value_fetch_lazy (return_value);
     }
@@ -1806,9 +1950,8 @@ return_command (retval_exp, from_tty)
              /* NOTREACHED */
            }
        }
-      else
-       if (!query ("Make selected stack frame return now? "))
-         error ("Not confirmed.");
+      else if (!query ("Make selected stack frame return now? "))
+       error ("Not confirmed.");
     }
 
   /* Do the real work.  Pop until the specified frame is current.  We
@@ -1816,7 +1959,7 @@ return_command (retval_exp, from_tty)
      a POP_FRAME.  The pc comparison makes this work even if the
      selected frame shares its fp with another frame.  */
 
-  while (selected_frame_addr != (frame = get_current_frame())->frame
+  while (selected_frame_addr != (frame = get_current_frame ())->frame
         || selected_frame_pc != frame->pc)
     POP_FRAME;
 
@@ -1846,6 +1989,7 @@ struct function_bounds
   CORE_ADDR low, high;
 };
 
+static void func_command PARAMS ((char *arg, int from_tty));
 static void
 func_command (arg, from_tty)
      char *arg;
@@ -1907,10 +2051,10 @@ get_frame_language ()
 {
   register struct symtab *s;
   enum language flang;         /* The language of the current frame */
-   
+
   if (selected_frame)
     {
-      s = find_pc_symtab(selected_frame->pc);
+      s = find_pc_symtab (selected_frame->pc);
       if (s)
        flang = s->language;
       else
@@ -1925,7 +2069,7 @@ get_frame_language ()
 void
 _initialize_stack ()
 {
-#if 0  
+#if 0
   backtrace_limit = 30;
 #endif
 
@@ -1963,8 +2107,8 @@ a command file or a user-defined command.");
 
   if (xdb_commands)
     {
-      add_com("L", class_stack, current_frame_command, 
-              "Print the current stack frame.\n");
+      add_com ("L", class_stack, current_frame_command,
+              "Print the current stack frame.\n");
       add_com_alias ("V", "frame", class_stack, 1);
     }
   add_com ("select-frame", class_stack, select_frame_command,
@@ -1981,7 +2125,7 @@ Use of the 'full' qualifier also prints the values of the local variables.\n");
     {
       add_com_alias ("t", "backtrace", class_stack, 0);
       add_com ("T", class_stack, backtrace_full_command,
-          "Print backtrace of all stack frames, or innermost COUNT frames \n\
+              "Print backtrace of all stack frames, or innermost COUNT frames \n\
 and the values of the local variables.\n\
 With a negative argument, print outermost -COUNT frames.\n\
 Usage: T <count>\n");
@@ -1999,21 +2143,21 @@ Usage: T <count>\n");
   add_info ("args", args_info,
            "Argument variables of current stack frame.");
   if (xdb_commands)
-      add_com("l", class_info, args_plus_locals_info, 
-           "Argument and local variables of current stack frame.");
+    add_com ("l", class_info, args_plus_locals_info,
+            "Argument and local variables of current stack frame.");
 
   if (dbx_commands)
-      add_com("func", class_stack, func_command, 
-         "Select the stack frame that contains <func>.\nUsage: func <name>\n");
+    add_com ("func", class_stack, func_command,
+      "Select the stack frame that contains <func>.\nUsage: func <name>\n");
 
   add_info ("catch", catch_info,
            "Exceptions that can be caught in the current stack frame.");
 
 #if 0
-  add_cmd ("backtrace-limit", class_stack, set_backtrace_limit_command, 
-          "Specify maximum number of frames for \"backtrace\" to print by default.",
+  add_cmd ("backtrace-limit", class_stack, set_backtrace_limit_command,
+  "Specify maximum number of frames for \"backtrace\" to print by default.",
           &setlist);
   add_info ("backtrace-limit", backtrace_limit_info,
-           "The maximum number of frames for \"backtrace\" to print by default.");
+     "The maximum number of frames for \"backtrace\" to print by default.");
 #endif
 }
index fb3c8f7..62857b3 100644 (file)
@@ -1,22 +1,23 @@
 /* Symbol table lookup for the GNU debugger, GDB.
    Copyright 1986, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 1998
-             Free Software Foundation, Inc.
+   Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -46,20 +47,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 /* Prototype for one function in parser-defs.h,
    instead of including that entire file. */
 
-extern char * find_template_name_end PARAMS ((char *));
+extern char *find_template_name_end PARAMS ((char *));
 
 /* Prototypes for local functions */
 
 static int find_methods PARAMS ((struct type *, char *, struct symbol **));
 
-static void completion_list_add_name PARAMS ((char *, char *, int, char *, 
-                                              char *));
+static void completion_list_add_name PARAMS ((char *, char *, int, char *,
+                                             char *));
 
-static void build_canonical_line_spec PARAMS ((struct symtab_and_line *, 
-                                               char *, char ***));
+static void build_canonical_line_spec PARAMS ((struct symtab_and_line *,
+                                              char *, char ***));
 
-static struct symtabs_and_lines decode_line_2 PARAMS ((struct symbol *[], 
-                                                       int, int, char ***));
+static struct symtabs_and_lines decode_line_2 PARAMS ((struct symbol *[],
+                                                      int, int, char ***));
 
 static void rbreak_command PARAMS ((char *, int));
 
@@ -77,37 +78,40 @@ char *operator_chars PARAMS ((char *, char **));
 
 static int find_line_common PARAMS ((struct linetable *, int, int *));
 
-static struct partial_symbol *lookup_partial_symbol PARAMS 
-                                  ((struct partial_symtab *, const char *,
-                                   int, namespace_enum));
+static struct partial_symbol *lookup_partial_symbol PARAMS
+  ((struct partial_symtab *, const char *,
+    int, namespace_enum));
 
-static struct partial_symbol *fixup_psymbol_section PARAMS ((struct 
-                                        partial_symbol *, struct objfile *));
+static struct partial_symbol *fixup_psymbol_section PARAMS ((struct
+                                      partial_symbol *, struct objfile *));
 
 static struct symtab *lookup_symtab_1 PARAMS ((char *));
 
 static void cplusplus_hint PARAMS ((char *));
 
-static struct symbol *find_active_alias PARAMS ((struct symbol *sym, 
-                                                 CORE_ADDR addr));
+static struct symbol *find_active_alias PARAMS ((struct symbol * sym,
+                                                CORE_ADDR addr));
 
 /* This flag is used in hppa-tdep.c, and set in hp-symtab-read.c */
 /* Signals the presence of objects compiled by HP compilers */
 int hp_som_som_object_present = 0;
 
-static void fixup_section PARAMS ((struct general_symbol_info *, 
-                                   struct objfile *));
+static void fixup_section PARAMS ((struct general_symbol_info *,
+                                  struct objfile *));
 
 static int file_matches PARAMS ((char *, char **, int));
 
-static void print_symbol_info PARAMS ((namespace_enum, 
-                                       struct symtab *, struct symbol *, 
-                                       int, char *));
+static void print_symbol_info PARAMS ((namespace_enum,
+                                      struct symtab *, struct symbol *,
+                                      int, char *));
 
 static void print_msymbol_info PARAMS ((struct minimal_symbol *));
 
 static void symtab_symbol_info PARAMS ((char *, namespace_enum, int));
 
+static void overload_list_add_symbol PARAMS ((struct symbol * sym,
+                                             char *oload_name));
+
 void _initialize_symtab PARAMS ((void));
 
 /* */
@@ -150,13 +154,13 @@ lookup_symtab_1 (name)
   register char *slash;
   register struct objfile *objfile;
 
- got_symtab:
+got_symtab:
 
   /* First, search for an exact match */
 
   ALL_SYMTABS (objfile, s)
     if (STREQ (name, s->filename))
-      return s;
+    return s;
 
   slash = strchr (name, '/');
 
@@ -164,16 +168,16 @@ lookup_symtab_1 (name)
 
   if (!slash)
     ALL_SYMTABS (objfile, s)
-      {
-       char *p = s -> filename;
-       char *tail = strrchr (p, '/');
+    {
+      char *p = s->filename;
+      char *tail = strrchr (p, '/');
 
-       if (tail)
-         p = tail + 1;
+      if (tail)
+       p = tail + 1;
 
-       if (STREQ (p, name))
-         return s;
-      }
+      if (STREQ (p, name))
+       return s;
+    }
 
   /* Same search rules as above apply here, but now we look thru the
      psymtabs.  */
@@ -182,9 +186,9 @@ lookup_symtab_1 (name)
   if (!ps)
     return (NULL);
 
-  if (ps -> readin)
+  if (ps->readin)
     error ("Internal: readin %s pst for `%s' found when no symtab found.",
-          ps -> filename, name);
+          ps->filename, name);
 
   s = PSYMTAB_TO_SYMTAB (ps);
 
@@ -215,7 +219,8 @@ lookup_symtab (name)
 #endif
 
   s = lookup_symtab_1 (name);
-  if (s) return s;
+  if (s)
+    return s;
 
 #if 0
   /* This screws c-exp.y:yylex if there is both a type "tree" and a symtab
@@ -230,7 +235,8 @@ lookup_symtab (name)
   strcpy (copy, name);
   strcat (copy, ".c");
   s = lookup_symtab_1 (copy);
-  if (s) return s;
+  if (s)
+    return s;
 #endif /* 0 */
 
   /* We didn't find anything; die.  */
@@ -243,33 +249,33 @@ lookup_symtab (name)
 
 struct partial_symtab *
 lookup_partial_symtab (name)
-char *name;
+     char *name;
 {
   register struct partial_symtab *pst;
   register struct objfile *objfile;
-  
+
   ALL_PSYMTABS (objfile, pst)
-    {
-      if (STREQ (name, pst -> filename))
-       {
-         return (pst);
-       }
-    }
+  {
+    if (STREQ (name, pst->filename))
+      {
+       return (pst);
+      }
+  }
 
   /* Now, search for a matching tail (only if name doesn't have any dirs) */
 
   if (!strchr (name, '/'))
     ALL_PSYMTABS (objfile, pst)
-      {
-       char *p = pst -> filename;
-       char *tail = strrchr (p, '/');
+    {
+      char *p = pst->filename;
+      char *tail = strrchr (p, '/');
 
-       if (tail)
-         p = tail + 1;
+      if (tail)
+       p = tail + 1;
 
-       if (STREQ (p, name))
-         return (pst);
-      }
+      if (STREQ (p, name))
+       return (pst);
+    }
 
   return (NULL);
 }
@@ -304,21 +310,21 @@ gdb_mangle_name (type, method_id, signature_id)
   char buf[20];
   int len = (newname == NULL ? 0 : strlen (newname));
 
-  is_full_physname_constructor = 
-    ((physname[0]=='_' && physname[1]=='_' && 
-      (isdigit(physname[2]) || physname[2]=='Q' || physname[2]=='t'))
-     || (strncmp(physname, "__ct", 4) == 0));
+  is_full_physname_constructor =
+    ((physname[0] == '_' && physname[1] == '_' &&
+      (isdigit (physname[2]) || physname[2] == 'Q' || physname[2] == 't'))
+     || (strncmp (physname, "__ct", 4) == 0));
 
   is_constructor =
-    is_full_physname_constructor || (newname && STREQ(field_name, newname));
+    is_full_physname_constructor || (newname && STREQ (field_name, newname));
 
   if (!is_destructor)
-    is_destructor = (strncmp(physname, "__dt", 4) == 0); 
+    is_destructor = (strncmp (physname, "__dt", 4) == 0);
 
   if (is_destructor || is_full_physname_constructor)
     {
-      mangled_name = (char*) xmalloc(strlen(physname)+1);
-      strcpy(mangled_name, physname);
+      mangled_name = (char *) xmalloc (strlen (physname) + 1);
+      strcpy (mangled_name, physname);
       return mangled_name;
     }
 
@@ -329,7 +335,7 @@ gdb_mangle_name (type, method_id, signature_id)
   else if (physname[0] == 't' || physname[0] == 'Q')
     {
       /* The physname for template and qualified methods already includes
-        the class name.  */
+         the class name.  */
       sprintf (buf, "__%s%s", const_prefix, volatile_prefix);
       newname = NULL;
       len = 0;
@@ -339,9 +345,9 @@ gdb_mangle_name (type, method_id, signature_id)
       sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
     }
   mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
-                         + strlen (buf) + len
-                         + strlen (physname)
-                         + 1);
+                     + strlen (buf) + len
+                     + strlen (physname)
+                     + 1);
 
   /* Only needed for GNU-mangled names.  ANSI-mangled names
      work with the normal mechanisms.  */
@@ -351,7 +357,7 @@ gdb_mangle_name (type, method_id, signature_id)
       if (opname == NULL)
        error ("No mangling for \"%s\"", field_name);
       mangled_name_len += strlen (opname);
-      mangled_name = (char *)xmalloc (mangled_name_len);
+      mangled_name = (char *) xmalloc (mangled_name_len);
 
       strncpy (mangled_name, field_name, 3);
       mangled_name[3] = '\0';
@@ -359,7 +365,7 @@ gdb_mangle_name (type, method_id, signature_id)
     }
   else
     {
-      mangled_name = (char *)xmalloc (mangled_name_len);
+      mangled_name = (char *) xmalloc (mangled_name_len);
       if (is_constructor)
        mangled_name[0] = '\0';
       else
@@ -368,16 +374,16 @@ gdb_mangle_name (type, method_id, signature_id)
   strcat (mangled_name, buf);
   /* If the class doesn't have a name, i.e. newname NULL, then we just
      mangle it using 0 for the length of the class.  Thus it gets mangled
-     as something starting with `::' rather than `classname::'. */ 
+     as something starting with `::' rather than `classname::'. */
   if (newname != NULL)
     strcat (mangled_name, newname);
 
   strcat (mangled_name, physname);
   return (mangled_name);
 }
-
 \f
 
+
 /* Find which partial symtab on contains PC and SECTION.  Return 0 if none.  */
 
 struct partial_symtab *
@@ -389,48 +395,40 @@ find_pc_sect_psymtab (pc, section)
   register struct objfile *objfile;
 
   ALL_PSYMTABS (objfile, pst)
-    {
-#if defined(HPUXHPPA)
-      if (pc >= pst->textlow && pc <= pst->texthigh)
-#else
-      if (pc >= pst->textlow && pc < pst->texthigh)
-#endif
-       {
-         struct minimal_symbol *msymbol;
-         struct partial_symtab *tpst;
-
-         /* An objfile that has its functions reordered might have
-            many partial symbol tables containing the PC, but
-            we want the partial symbol table that contains the
-            function containing the PC.  */
-         if (!(objfile->flags & OBJF_REORDERED) &&
-             section == 0)     /* can't validate section this way */
-           return (pst);
-
-         msymbol = lookup_minimal_symbol_by_pc_section (pc, section);
-         if (msymbol == NULL)
-           return (pst);
-
-         for (tpst = pst; tpst != NULL; tpst = tpst->next)
-           {
-#if defined(HPUXHPPA)
-             if (pc >= tpst->textlow && pc <= tpst->texthigh)
-#else
-             if (pc >= tpst->textlow && pc < tpst->texthigh)
-#endif
-               {
-                 struct partial_symbol *p;
+  {
+    if (pc >= pst->textlow && pc < pst->texthigh)
+      {
+       struct minimal_symbol *msymbol;
+       struct partial_symtab *tpst;
+
+       /* An objfile that has its functions reordered might have
+          many partial symbol tables containing the PC, but
+          we want the partial symbol table that contains the
+          function containing the PC.  */
+       if (!(objfile->flags & OBJF_REORDERED) &&
+           section == 0)       /* can't validate section this way */
+         return (pst);
 
-                 p = find_pc_sect_psymbol (tpst, pc, section);
-                 if (p != NULL
-                     && SYMBOL_VALUE_ADDRESS(p)
-                        == SYMBOL_VALUE_ADDRESS (msymbol))
-                   return (tpst);
-               }
-           }
+       msymbol = lookup_minimal_symbol_by_pc_section (pc, section);
+       if (msymbol == NULL)
          return (pst);
-       }
-    }
+
+       for (tpst = pst; tpst != NULL; tpst = tpst->next)
+         {
+           if (pc >= tpst->textlow && pc < tpst->texthigh)
+             {
+               struct partial_symbol *p;
+
+               p = find_pc_sect_psymbol (tpst, pc, section);
+               if (p != NULL
+                   && SYMBOL_VALUE_ADDRESS (p)
+                   == SYMBOL_VALUE_ADDRESS (msymbol))
+                 return (tpst);
+             }
+         }
+       return (pst);
+      }
+  }
   return (NULL);
 }
 
@@ -455,7 +453,7 @@ find_pc_sect_psymbol (psymtab, pc, section)
 {
   struct partial_symbol *best = NULL, *p, **pp;
   CORE_ADDR best_pc;
-  
+
   if (!psymtab)
     psymtab = find_pc_sect_psymtab (pc, section);
   if (!psymtab)
@@ -468,8 +466,8 @@ find_pc_sect_psymbol (psymtab, pc, section)
      find_pc_partial_function doesn't use a minimal symbol and thus
      cache a bad endaddr.  */
   for (pp = psymtab->objfile->global_psymbols.list + psymtab->globals_offset;
-       (pp - (psymtab->objfile->global_psymbols.list + psymtab->globals_offset)
-       < psymtab->n_global_syms);
+    (pp - (psymtab->objfile->global_psymbols.list + psymtab->globals_offset)
+     < psymtab->n_global_syms);
        pp++)
     {
       p = *pp;
@@ -480,7 +478,7 @@ find_pc_sect_psymbol (psymtab, pc, section)
              || (psymtab->textlow == 0
                  && best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0)))
        {
-         if (section)  /* match on a specific section */
+         if (section)          /* match on a specific section */
            {
              fixup_psymbol_section (p, psymtab->objfile);
              if (SYMBOL_BFD_SECTION (p) != section)
@@ -492,8 +490,8 @@ find_pc_sect_psymbol (psymtab, pc, section)
     }
 
   for (pp = psymtab->objfile->static_psymbols.list + psymtab->statics_offset;
-       (pp - (psymtab->objfile->static_psymbols.list + psymtab->statics_offset)
-       < psymtab->n_static_syms);
+    (pp - (psymtab->objfile->static_psymbols.list + psymtab->statics_offset)
+     < psymtab->n_static_syms);
        pp++)
     {
       p = *pp;
@@ -501,10 +499,10 @@ find_pc_sect_psymbol (psymtab, pc, section)
          && SYMBOL_CLASS (p) == LOC_BLOCK
          && pc >= SYMBOL_VALUE_ADDRESS (p)
          && (SYMBOL_VALUE_ADDRESS (p) > best_pc
-             || (psymtab->textlow == 0 
+             || (psymtab->textlow == 0
                  && best_pc == 0 && SYMBOL_VALUE_ADDRESS (p) == 0)))
        {
-         if (section)  /* match on a specific section */
+         if (section)          /* match on a specific section */
            {
              fixup_psymbol_section (p, psymtab->objfile);
              if (SYMBOL_BFD_SECTION (p) != section)
@@ -618,22 +616,22 @@ lookup_symbol (name, block, namespace, is_a_field_of_this, symtab)
   while (block != 0)
     {
       sym = lookup_block_symbol (block, name, namespace);
-      if (sym) 
+      if (sym)
        {
          block_found = block;
          if (symtab != NULL)
            {
              /* Search the list of symtabs for one which contains the
-                address of the start of this block.  */
+                address of the start of this block.  */
              ALL_SYMTABS (objfile, s)
-               {
-                 bv = BLOCKVECTOR (s);
-                 b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-                 if (BLOCK_START (b) <= BLOCK_START (block)
-                     && BLOCK_END (b) > BLOCK_START (block))
-                   goto found;
-               }
-found:
+             {
+               bv = BLOCKVECTOR (s);
+               b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+               if (BLOCK_START (b) <= BLOCK_START (block)
+                   && BLOCK_END (b) > BLOCK_START (block))
+                 goto found;
+             }
+           found:
              *symtab = s;
            }
 
@@ -664,22 +662,22 @@ found:
       struct block *b;
       /* Find the right symtab.  */
       ALL_SYMTABS (objfile, s)
-       {
-         bv = BLOCKVECTOR (s);
-         b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-         if (BLOCK_START (b) <= BLOCK_START (block)
-             && BLOCK_END (b) > BLOCK_START (block))
-           {
-             sym = lookup_block_symbol (b, name, VAR_NAMESPACE);
-             if (sym)
-               {
-                 block_found = b;
-                 if (symtab != NULL)
-                   *symtab = s;
-                 return fixup_symbol_section (sym, objfile);
-               }
-           }
-       }
+      {
+       bv = BLOCKVECTOR (s);
+       b = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+       if (BLOCK_START (b) <= BLOCK_START (block)
+           && BLOCK_END (b) > BLOCK_START (block))
+         {
+           sym = lookup_block_symbol (b, name, VAR_NAMESPACE);
+           if (sym)
+             {
+               block_found = b;
+               if (symtab != NULL)
+                 *symtab = s;
+               return fixup_symbol_section (sym, objfile);
+             }
+         }
+      }
     }
 
 
@@ -688,7 +686,7 @@ found:
   if (is_a_field_of_this)
     {
       struct value *v = value_of_this (0);
-      
+
       *is_a_field_of_this = 0;
       if (v && check_field (v, name))
        {
@@ -703,34 +701,34 @@ found:
      check the psymtab's. If a psymtab indicates the existence
      of the desired name as a global, then do psymtab-to-symtab
      conversion on the fly and return the found symbol. */
-  
+
   ALL_SYMTABS (objfile, s)
-    {
-      bv = BLOCKVECTOR (s);
-      block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-      sym = lookup_block_symbol (block, name, namespace);
-      if (sym) 
-       {
-         block_found = block;
-         if (symtab != NULL)
-           *symtab = s;
-         return fixup_symbol_section (sym, objfile);
-       }
-    }
+  {
+    bv = BLOCKVECTOR (s);
+    block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+    sym = lookup_block_symbol (block, name, namespace);
+    if (sym)
+      {
+       block_found = block;
+       if (symtab != NULL)
+         *symtab = s;
+       return fixup_symbol_section (sym, objfile);
+      }
+  }
 
 #ifndef HPUXHPPA
 
   /* Check for the possibility of the symbol being a function or
      a mangled variable that is stored in one of the minimal symbol tables.
      Eventually, all global symbols might be resolved in this way.  */
-  
+
   if (namespace == VAR_NAMESPACE)
     {
       msymbol = lookup_minimal_symbol (name, NULL, NULL);
       if (msymbol != NULL)
        {
          s = find_pc_sect_symtab (SYMBOL_VALUE_ADDRESS (msymbol),
-                                 SYMBOL_BFD_SECTION (msymbol));
+                                  SYMBOL_BFD_SECTION (msymbol));
          if (s != NULL)
            {
              /* This is a function which has a symtab for its address.  */
@@ -738,26 +736,27 @@ found:
              block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
              sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
                                         namespace);
-              /* We kept static functions in minimal symbol table as well as
-                in static scope. We want to find them in the symbol table. */
-               if (!sym) {
+             /* We kept static functions in minimal symbol table as well as
+                in static scope. We want to find them in the symbol table. */
+             if (!sym)
+               {
                  block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
                  sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
                                             namespace);
                }
 
              /* sym == 0 if symbol was found in the minimal symbol table
-                but not in the symtab.
-                Return 0 to use the msymbol definition of "foo_".
+                but not in the symtab.
+                Return 0 to use the msymbol definition of "foo_".
 
-                This happens for Fortran  "foo_" symbols,
-                which are "foo" in the symtab.
+                This happens for Fortran  "foo_" symbols,
+                which are "foo" in the symtab.
 
-                This can also happen if "asm" is used to make a
-                regular symbol but not a debugging symbol, e.g.
-                asm(".globl _main");
-                asm("_main:");
-                */
+                This can also happen if "asm" is used to make a
+                regular symbol but not a debugging symbol, e.g.
+                asm(".globl _main");
+                asm("_main:");
+              */
 
              if (symtab != NULL)
                *symtab = s;
@@ -768,8 +767,8 @@ found:
                   && !STREQ (name, SYMBOL_NAME (msymbol)))
            {
              /* This is a mangled variable, look it up by its
-                mangled name.  */
-             return lookup_symbol (SYMBOL_NAME (msymbol), block, 
+                mangled name.  */
+             return lookup_symbol (SYMBOL_NAME (msymbol), block,
                                    namespace, is_a_field_of_this, symtab);
            }
          /* There are no debug symbols for this file, or we are looking
@@ -777,37 +776,37 @@ found:
             Try to find a matching static symbol below. */
        }
     }
-      
+
 #endif
 
   ALL_PSYMTABS (objfile, ps)
-    {
-      if (!ps->readin && lookup_partial_symbol (ps, name, 1, namespace))
-       {
-         s = PSYMTAB_TO_SYMTAB(ps);
-         bv = BLOCKVECTOR (s);
-         block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-         sym = lookup_block_symbol (block, name, namespace);
-         if (!sym)
-            {
-              /* This shouldn't be necessary, but as a last resort
-               * try looking in the statics even though the psymtab
-               * claimed the symbol was global. It's possible that
-               * the psymtab gets it wrong in some cases.
-               */
-             block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-             sym = lookup_block_symbol (block, name, namespace);
-              if (!sym)
-               error ("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\
+  {
+    if (!ps->readin && lookup_partial_symbol (ps, name, 1, namespace))
+      {
+       s = PSYMTAB_TO_SYMTAB (ps);
+       bv = BLOCKVECTOR (s);
+       block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+       sym = lookup_block_symbol (block, name, namespace);
+       if (!sym)
+         {
+           /* This shouldn't be necessary, but as a last resort
+            * try looking in the statics even though the psymtab
+            * claimed the symbol was global. It's possible that
+            * the psymtab gets it wrong in some cases.
+            */
+           block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+           sym = lookup_block_symbol (block, name, namespace);
+           if (!sym)
+             error ("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\
 %s may be an inlined function, or may be a template function\n\
 (if a template, try specifying an instantiation: %s<type>).",
-                       name, ps->filename, name, name);
-            }
-         if (symtab != NULL)
-           *symtab = s;
-         return fixup_symbol_section (sym, objfile);
-       }
-    }
+                    name, ps->filename, name, name);
+         }
+       if (symtab != NULL)
+         *symtab = s;
+       return fixup_symbol_section (sym, objfile);
+      }
+  }
 
   /* Now search all static file-level symbols.
      Not strictly correct, but more useful than an error.
@@ -817,47 +816,47 @@ found:
      conversion on the fly and return the found symbol. */
 
   ALL_SYMTABS (objfile, s)
-    {
-      bv = BLOCKVECTOR (s);
-      block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-      sym = lookup_block_symbol (block, name, namespace);
-      if (sym) 
-       {
-         block_found = block;
-         if (symtab != NULL)
-           *symtab = s;
-         return fixup_symbol_section (sym, objfile);
-       }
-    }
+  {
+    bv = BLOCKVECTOR (s);
+    block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+    sym = lookup_block_symbol (block, name, namespace);
+    if (sym)
+      {
+       block_found = block;
+       if (symtab != NULL)
+         *symtab = s;
+       return fixup_symbol_section (sym, objfile);
+      }
+  }
 
   ALL_PSYMTABS (objfile, ps)
-    {
-      if (!ps->readin && lookup_partial_symbol (ps, name, 0, namespace))
-       {
-         s = PSYMTAB_TO_SYMTAB(ps);
-         bv = BLOCKVECTOR (s);
-         block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-         sym = lookup_block_symbol (block, name, namespace);
-         if (!sym)
-            {
-              /* This shouldn't be necessary, but as a last resort
-               * try looking in the globals even though the psymtab
-               * claimed the symbol was static. It's possible that
-               * the psymtab gets it wrong in some cases.
-               */
-             block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-             sym = lookup_block_symbol (block, name, namespace);
-              if (!sym)
-                error ("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\
+  {
+    if (!ps->readin && lookup_partial_symbol (ps, name, 0, namespace))
+      {
+       s = PSYMTAB_TO_SYMTAB (ps);
+       bv = BLOCKVECTOR (s);
+       block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+       sym = lookup_block_symbol (block, name, namespace);
+       if (!sym)
+         {
+           /* This shouldn't be necessary, but as a last resort
+            * try looking in the globals even though the psymtab
+            * claimed the symbol was static. It's possible that
+            * the psymtab gets it wrong in some cases.
+            */
+           block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+           sym = lookup_block_symbol (block, name, namespace);
+           if (!sym)
+             error ("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\
 %s may be an inlined function, or may be a template function\n\
 (if a template, try specifying an instantiation: %s<type>).",
-                       name, ps->filename, name, name);
-            }
-         if (symtab != NULL)
-           *symtab = s;
-         return fixup_symbol_section (sym, objfile);
-       }
-    }
+                    name, ps->filename, name, name);
+         }
+       if (symtab != NULL)
+         *symtab = s;
+       return fixup_symbol_section (sym, objfile);
+      }
+  }
 
 #ifdef HPUXHPPA
 
@@ -875,28 +874,28 @@ found:
      though... is it saying we need to do the "minsym" check before
      the static check in this case? 
    */
-  
+
   if (namespace == VAR_NAMESPACE)
     {
       msymbol = lookup_minimal_symbol (name, NULL, NULL);
       if (msymbol != NULL)
        {
-          /* OK, we found a minimal symbol in spite of not
-           * finding any symbol. There are various possible
-           * explanations for this. One possibility is the symbol
-           * exists in code not compiled -g. Another possibility
-           * is that the 'psymtab' isn't doing its job.
-           * A third possibility, related to #2, is that we were confused 
-           * by name-mangling. For instance, maybe the psymtab isn't
-           * doing its job because it only know about demangled
-           * names, but we were given a mangled name...
-           */
-
-          /* We first use the address in the msymbol to try to
-           * locate the appropriate symtab. Note that find_pc_symtab()
-           * has a side-effect of doing psymtab-to-symtab expansion,
-           * for the found symtab.
-           */
+         /* OK, we found a minimal symbol in spite of not
+          * finding any symbol. There are various possible
+          * explanations for this. One possibility is the symbol
+          * exists in code not compiled -g. Another possibility
+          * is that the 'psymtab' isn't doing its job.
+          * A third possibility, related to #2, is that we were confused 
+          * by name-mangling. For instance, maybe the psymtab isn't
+          * doing its job because it only know about demangled
+          * names, but we were given a mangled name...
+          */
+
+         /* We first use the address in the msymbol to try to
+          * locate the appropriate symtab. Note that find_pc_symtab()
+          * has a side-effect of doing psymtab-to-symtab expansion,
+          * for the found symtab.
+          */
          s = find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol));
          if (s != NULL)
            {
@@ -904,44 +903,45 @@ found:
              block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
              sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
                                         namespace);
-              /* We kept static functions in minimal symbol table as well as
-                in static scope. We want to find them in the symbol table. */
-             if (!sym) 
-                {
+             /* We kept static functions in minimal symbol table as well as
+                in static scope. We want to find them in the symbol table. */
+             if (!sym)
+               {
                  block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
                  sym = lookup_block_symbol (block, SYMBOL_NAME (msymbol),
                                             namespace);
                }
-              /* If we found one, return it */
-              if (sym) {
-               if (symtab != NULL)
-                 *symtab = s;
-               return sym;
-              }
+             /* If we found one, return it */
+             if (sym)
+               {
+                 if (symtab != NULL)
+                   *symtab = s;
+                 return sym;
+               }
 
              /* If we get here with sym == 0, the symbol was 
-                 found in the minimal symbol table
-                but not in the symtab.
-                Fall through and return 0 to use the msymbol 
-                 definition of "foo_".
-                 (Note that outer code generally follows up a call
-                  to this routine with a call to lookup_minimal_symbol(),
-                  so a 0 return means we'll just flow into that other routine).
-
-                This happens for Fortran  "foo_" symbols,
-                which are "foo" in the symtab.
-
-                This can also happen if "asm" is used to make a
-                regular symbol but not a debugging symbol, e.g.
-                asm(".globl _main");
-                asm("_main:");
-                */
+                found in the minimal symbol table
+                but not in the symtab.
+                Fall through and return 0 to use the msymbol 
+                definition of "foo_".
+                (Note that outer code generally follows up a call
+                to this routine with a call to lookup_minimal_symbol(),
+                so a 0 return means we'll just flow into that other routine).
+
+                This happens for Fortran  "foo_" symbols,
+                which are "foo" in the symtab.
+
+                This can also happen if "asm" is used to make a
+                regular symbol but not a debugging symbol, e.g.
+                asm(".globl _main");
+                asm("_main:");
+              */
            }
 
-          /* If the lookup-by-address fails, try repeating the
-           * entire lookup process with the symbol name from
-           * the msymbol (if different from the original symbol name).
-           */
+         /* If the lookup-by-address fails, try repeating the
+          * entire lookup process with the symbol name from
+          * the msymbol (if different from the original symbol name).
+          */
          else if (MSYMBOL_TYPE (msymbol) != mst_text
                   && MSYMBOL_TYPE (msymbol) != mst_file_text
                   && !STREQ (name, SYMBOL_NAME (msymbol)))
@@ -978,19 +978,19 @@ lookup_partial_symbol (pst, name, global, namespace)
     {
       return (NULL);
     }
-  
+
   start = (global ?
           pst->objfile->global_psymbols.list + pst->globals_offset :
-          pst->objfile->static_psymbols.list + pst->statics_offset  );
+          pst->objfile->static_psymbols.list + pst->statics_offset);
 
-  if (global)          /* This means we can use a binary search. */
+  if (global)                  /* This means we can use a binary search. */
     {
       do_linear_search = 0;
 
       /* Binary search.  This search is guaranteed to end with center
          pointing at the earliest partial symbol with the correct
-        name.  At that point *all* partial symbols with that name
-        will be checked against the correct namespace. */
+         name.  At that point *all* partial symbols with that name
+         will be checked against the correct namespace. */
 
       bottom = start;
       top = start + length - 1;
@@ -1002,7 +1002,7 @@ lookup_partial_symbol (pst, name, global, namespace)
          if (!do_linear_search
              && (SYMBOL_LANGUAGE (*center) == language_cplus
                  || SYMBOL_LANGUAGE (*center) == language_java
-                 ))
+             ))
            {
              do_linear_search = 1;
            }
@@ -1023,7 +1023,7 @@ lookup_partial_symbol (pst, name, global, namespace)
            {
              return (*top);
            }
-         top ++;
+         top++;
        }
     }
 
@@ -1065,51 +1065,50 @@ lookup_transparent_type (name)
   struct blockvector *bv;
   register struct objfile *objfile;
   register struct block *block;
-  register struct minimal_symbol *msymbol;
 
   /* Now search all the global symbols.  Do the symtab's first, then
      check the psymtab's. If a psymtab indicates the existence
      of the desired name as a global, then do psymtab-to-symtab
      conversion on the fly and return the found symbol.  */
-  
+
   ALL_SYMTABS (objfile, s)
-    {
-      bv = BLOCKVECTOR (s);
-      block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-      sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
-      if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
-       {
-         return SYMBOL_TYPE (sym);
-       }
-    }
+  {
+    bv = BLOCKVECTOR (s);
+    block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+    sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
+    if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
+      {
+       return SYMBOL_TYPE (sym);
+      }
+  }
 
   ALL_PSYMTABS (objfile, ps)
-    {
-      if (!ps->readin && lookup_partial_symbol (ps, name, 1, STRUCT_NAMESPACE))
-       {
-         s = PSYMTAB_TO_SYMTAB(ps);
-         bv = BLOCKVECTOR (s);
-         block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-         sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
-         if (!sym) 
-            {
-              /* This shouldn't be necessary, but as a last resort
-               * try looking in the statics even though the psymtab
-               * claimed the symbol was global. It's possible that
-               * the psymtab gets it wrong in some cases.
-               */
-             block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-             sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
-              if (!sym)
-                error ("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\
+  {
+    if (!ps->readin && lookup_partial_symbol (ps, name, 1, STRUCT_NAMESPACE))
+      {
+       s = PSYMTAB_TO_SYMTAB (ps);
+       bv = BLOCKVECTOR (s);
+       block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+       sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
+       if (!sym)
+         {
+           /* This shouldn't be necessary, but as a last resort
+            * try looking in the statics even though the psymtab
+            * claimed the symbol was global. It's possible that
+            * the psymtab gets it wrong in some cases.
+            */
+           block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+           sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
+           if (!sym)
+             error ("Internal: global symbol `%s' found in %s psymtab but not in symtab.\n\
 %s may be an inlined function, or may be a template function\n\
 (if a template, try specifying an instantiation: %s<type>).",
-                       name, ps->filename, name, name);
-            }
-          if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
-            return SYMBOL_TYPE (sym);
-       }
-    }
+                    name, ps->filename, name, name);
+         }
+       if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
+         return SYMBOL_TYPE (sym);
+      }
+  }
 
   /* Now search the static file-level symbols.
      Not strictly correct, but more useful than an error.
@@ -1120,43 +1119,43 @@ lookup_transparent_type (name)
    */
 
   ALL_SYMTABS (objfile, s)
-    {
-      bv = BLOCKVECTOR (s);
-      block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-      sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
-      if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
-       {
-         return SYMBOL_TYPE (sym);
-       }
-    }
+  {
+    bv = BLOCKVECTOR (s);
+    block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+    sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
+    if (sym && !TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
+      {
+       return SYMBOL_TYPE (sym);
+      }
+  }
 
   ALL_PSYMTABS (objfile, ps)
-    {
-      if (!ps->readin && lookup_partial_symbol (ps, name, 0, STRUCT_NAMESPACE))
-       {
-         s = PSYMTAB_TO_SYMTAB(ps);
-         bv = BLOCKVECTOR (s);
-         block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
-         sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
-         if (!sym)
-            {
-              /* This shouldn't be necessary, but as a last resort
-               * try looking in the globals even though the psymtab
-               * claimed the symbol was static. It's possible that
-               * the psymtab gets it wrong in some cases.
-               */
-             block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
-             sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
-              if (!sym)
-               error ("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\
+  {
+    if (!ps->readin && lookup_partial_symbol (ps, name, 0, STRUCT_NAMESPACE))
+      {
+       s = PSYMTAB_TO_SYMTAB (ps);
+       bv = BLOCKVECTOR (s);
+       block = BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK);
+       sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
+       if (!sym)
+         {
+           /* This shouldn't be necessary, but as a last resort
+            * try looking in the globals even though the psymtab
+            * claimed the symbol was static. It's possible that
+            * the psymtab gets it wrong in some cases.
+            */
+           block = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+           sym = lookup_block_symbol (block, name, STRUCT_NAMESPACE);
+           if (!sym)
+             error ("Internal: static symbol `%s' found in %s psymtab but not in symtab.\n\
 %s may be an inlined function, or may be a template function\n\
 (if a template, try specifying an instantiation: %s<type>).",
-                       name, ps->filename, name, name);
-            }
-          if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
-            return SYMBOL_TYPE (sym);
-       }
-    }
+                    name, ps->filename, name, name);
+         }
+       if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
+         return SYMBOL_TYPE (sym);
+      }
+  }
   return (struct type *) 0;
 }
 
@@ -1172,12 +1171,12 @@ find_main_psymtab ()
   register struct objfile *objfile;
 
   ALL_PSYMTABS (objfile, pst)
-    {
-      if (lookup_partial_symbol (pst, "main", 1, VAR_NAMESPACE))
-       {
-         return (pst);
-       }
-    }
+  {
+    if (lookup_partial_symbol (pst, "main", 1, VAR_NAMESPACE))
+      {
+       return (pst);
+      }
+  }
   return (NULL);
 }
 
@@ -1208,10 +1207,10 @@ lookup_block_symbol (block, name, namespace)
   if (BLOCK_SHOULD_SORT (block))
     {
       /* Reset the linear search flag so if the binary search fails, we
-        won't do the linear search once unless we find some reason to
-        do so, such as finding a C++ symbol during the binary search.
-        Note that for C++ modules, ALL the symbols in a block should
-        end up marked as C++ symbols. */
+         won't do the linear search once unless we find some reason to
+         do so, such as finding a C++ symbol during the binary search.
+         Note that for C++ modules, ALL the symbols in a block should
+         end up marked as C++ symbols. */
 
       do_linear_search = 0;
       top = BLOCK_NSYMS (block);
@@ -1232,7 +1231,7 @@ lookup_block_symbol (block, name, namespace)
          if (!do_linear_search
              && (SYMBOL_LANGUAGE (sym) == language_cplus
                  || SYMBOL_LANGUAGE (sym) == language_java
-                 ))
+             ))
            {
              do_linear_search = 1;
            }
@@ -1255,12 +1254,12 @@ lookup_block_symbol (block, name, namespace)
        }
 
       /* Now scan forward until we run out of symbols, find one whose
-        name is greater than NAME, or find one we want.  If there is
-        more than one symbol with the right name and namespace, we
-        return the first one; I believe it is now impossible for us
-        to encounter two symbols with the same name and namespace
-        here, because blocks containing argument symbols are no
-        longer sorted.  */
+         name is greater than NAME, or find one we want.  If there is
+         more than one symbol with the right name and namespace, we
+         return the first one; I believe it is now impossible for us
+         to encounter two symbols with the same name and namespace
+         here, because blocks containing argument symbols are no
+         longer sorted.  */
 
       top = BLOCK_NSYMS (block);
       while (bot < top)
@@ -1307,13 +1306,27 @@ lookup_block_symbol (block, name, namespace)
              SYMBOL_MATCHES_NAME (sym, name))
            {
              /* If SYM has aliases, then use any alias that is active
-                at the current PC.  If no alias is active at the current
-                PC, then use the main symbol.
+                at the current PC.  If no alias is active at the current
+                PC, then use the main symbol.
+
+                ?!? Is checking the current pc correct?  Is this routine
+                ever called to look up a symbol from another context?
+
+                FIXME: No, it's not correct.  If someone sets a
+                conditional breakpoint at an address, then the
+                breakpoint's `struct expression' should refer to the
+                `struct symbol' appropriate for the breakpoint's
+                address, which may not be the PC.
+
+                Even if it were never called from another context,
+                it's totally bizarre for lookup_symbol's behavior to
+                depend on the value of the inferior's current PC.  We
+                should pass in the appropriate PC as well as the
+                block.  The interface to lookup_symbol should change
+                to require the caller to provide a PC.  */
 
-                ?!? Is checking the current pc correct?  Is this routine
-                ever called to look up a symbol from another context?  */
-              if (SYMBOL_ALIASES (sym))
-                sym = find_active_alias (sym, read_pc ());
+             if (SYMBOL_ALIASES (sym))
+               sym = find_active_alias (sym, read_pc ());
 
              sym_found = sym;
              if (SYMBOL_CLASS (sym) != LOC_ARG &&
@@ -1340,8 +1353,8 @@ lookup_block_symbol (block, name, namespace)
 
 static struct symbol *
 find_active_alias (sym, addr)
-  struct symbol *sym;
-  CORE_ADDR addr;
+     struct symbol *sym;
+     CORE_ADDR addr;
 {
   struct range_list *r;
   struct alias_list *aliases;
@@ -1352,7 +1365,7 @@ find_active_alias (sym, addr)
   while (aliases)
     {
       if (!SYMBOL_RANGES (aliases->sym))
-        return aliases->sym;
+       return aliases->sym;
       for (r = SYMBOL_RANGES (aliases->sym); r; r = r->next)
        {
          if (r->start <= addr && r->end > addr)
@@ -1364,8 +1377,8 @@ find_active_alias (sym, addr)
   /* Nothing found, return the main symbol.  */
   return sym;
 }
-
 \f
+
 /* Return the symbol for the function which contains a specified
    lexical block, described by a struct block BL.  */
 
@@ -1411,51 +1424,47 @@ find_pc_sect_symtab (pc, section)
      For these, the symtab we are looking for is not necessarily read in.  */
 
   ALL_SYMTABS (objfile, s)
-    {
-      bv = BLOCKVECTOR (s);
-      b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+  {
+    bv = BLOCKVECTOR (s);
+    b = BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
 
-      if (BLOCK_START (b) <= pc
-#if defined(HPUXHPPA)
-         && BLOCK_END (b) >= pc
-#else
-         && BLOCK_END (b) > pc
-#endif
-         && (distance == 0
-             || BLOCK_END (b) - BLOCK_START (b) < distance))
-       {
-         /* For an objfile that has its functions reordered,
-            find_pc_psymtab will find the proper partial symbol table
-            and we simply return its corresponding symtab.  */
-         /* In order to better support objfiles that contain both
-            stabs and coff debugging info, we continue on if a psymtab
-            can't be found. */
-         if ((objfile->flags & OBJF_REORDERED) && objfile->psymtabs)
-           {
-             ps = find_pc_sect_psymtab (pc, section);
-             if (ps)
-               return PSYMTAB_TO_SYMTAB (ps);
-           }
-         if (section != 0)
-           {
-             int i;
+    if (BLOCK_START (b) <= pc
+       && BLOCK_END (b) > pc
+       && (distance == 0
+           || BLOCK_END (b) - BLOCK_START (b) < distance))
+      {
+       /* For an objfile that has its functions reordered,
+          find_pc_psymtab will find the proper partial symbol table
+          and we simply return its corresponding symtab.  */
+       /* In order to better support objfiles that contain both
+          stabs and coff debugging info, we continue on if a psymtab
+          can't be found. */
+       if ((objfile->flags & OBJF_REORDERED) && objfile->psymtabs)
+         {
+           ps = find_pc_sect_psymtab (pc, section);
+           if (ps)
+             return PSYMTAB_TO_SYMTAB (ps);
+         }
+       if (section != 0)
+         {
+           int i;
 
-             for (i = 0; i < b->nsyms; i++)
-               {
-                 fixup_symbol_section (b->sym[i], objfile);
-                 if (section == SYMBOL_BFD_SECTION (b->sym[i]))
-                   break;
-               }
-             if (i >= b->nsyms)
-               continue;       /* no symbol in this symtab matches section */
-           }
-         distance = BLOCK_END (b) - BLOCK_START (b);
-         best_s = s;
-       }
-    }
+           for (i = 0; i < b->nsyms; i++)
+             {
+               fixup_symbol_section (b->sym[i], objfile);
+               if (section == SYMBOL_BFD_SECTION (b->sym[i]))
+                 break;
+             }
+           if (i >= b->nsyms)
+             continue;         /* no symbol in this symtab matches section */
+         }
+       distance = BLOCK_END (b) - BLOCK_START (b);
+       best_s = s;
+      }
+  }
 
   if (best_s != NULL)
-    return(best_s);
+    return (best_s);
 
   s = NULL;
   ps = find_pc_sect_psymtab (pc, section);
@@ -1468,7 +1477,7 @@ find_pc_sect_symtab (pc, section)
        /* FIXME-32x64: assumes pc fits in a long */
        warning ("\
 (Internal error: pc 0x%lx in read in psymtab, but not in symtab.)\n",
-                (unsigned long) pc);
+                (unsigned long) pc);
       s = PSYMTAB_TO_SYMTAB (ps);
     }
   return (s);
@@ -1483,8 +1492,8 @@ find_pc_symtab (pc)
 {
   return find_pc_sect_symtab (pc, find_pc_mapped_section (pc));
 }
-
 \f
+
 #if 0
 
 /* Find the closest symbol value (of any sort -- function or variable)
@@ -1515,61 +1524,61 @@ find_addr_symbol (addr, symtabp, symaddrp)
 
   /* FIXME -- we should pull in all the psymtabs, too!  */
   ALL_SYMTABS (objfile, symtab)
-    {
-      /* Search the global and static blocks in this symtab for
-        the closest symbol-address to the desired address.  */
+  {
+    /* Search the global and static blocks in this symtab for
+       the closest symbol-address to the desired address.  */
 
-      for (blocknum = GLOBAL_BLOCK; blocknum <= STATIC_BLOCK; blocknum++)
-       {
-         QUIT;
-         block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), blocknum);
-         top = BLOCK_NSYMS (block);
-         for (bot = 0; bot < top; bot++)
-           {
-             sym = BLOCK_SYM (block, bot);
-             switch (SYMBOL_CLASS (sym))
-               {
-               case LOC_STATIC:        
-               case LOC_LABEL: 
-                 sym_addr = SYMBOL_VALUE_ADDRESS (sym);
-                 break;
+    for (blocknum = GLOBAL_BLOCK; blocknum <= STATIC_BLOCK; blocknum++)
+      {
+       QUIT;
+       block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), blocknum);
+       top = BLOCK_NSYMS (block);
+       for (bot = 0; bot < top; bot++)
+         {
+           sym = BLOCK_SYM (block, bot);
+           switch (SYMBOL_CLASS (sym))
+             {
+             case LOC_STATIC:
+             case LOC_LABEL:
+               sym_addr = SYMBOL_VALUE_ADDRESS (sym);
+               break;
+
+             case LOC_INDIRECT:
+               sym_addr = SYMBOL_VALUE_ADDRESS (sym);
+               /* An indirect symbol really lives at *sym_addr,
+                * so an indirection needs to be done.
+                * However, I am leaving this commented out because it's
+                * expensive, and it's possible that symbolization
+                * could be done without an active process (in
+                * case this read_memory will fail). RT
+                sym_addr = read_memory_unsigned_integer
+                (sym_addr, TARGET_PTR_BIT / TARGET_CHAR_BIT);
+                */
+               break;
 
-                case LOC_INDIRECT:
-                 sym_addr = SYMBOL_VALUE_ADDRESS (sym);
-                  /* An indirect symbol really lives at *sym_addr,
-                   * so an indirection needs to be done.
-                   * However, I am leaving this commented out because it's
-                   * expensive, and it's possible that symbolization
-                   * could be done without an active process (in
-                   * case this read_memory will fail). RT
-                  sym_addr = read_memory_unsigned_integer
-                      (sym_addr, TARGET_PTR_BIT / TARGET_CHAR_BIT);
-                   */
-                  break;
-
-               case LOC_BLOCK:
-                 sym_addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
-                 break;
+             case LOC_BLOCK:
+               sym_addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
+               break;
 
-               default:
-                 continue;
-               }
+             default:
+               continue;
+             }
 
-               if (sym_addr <= addr)
-                 if (sym_addr > best_sym_addr)
-                   {
-                     /* Quit if we found an exact match.  */
-                     best_sym = sym;
-                     best_sym_addr = sym_addr;
-                     best_symtab = symtab;
-                     if (sym_addr == addr)
-                       goto done;
-                   }
-           }
-       }
-    }
+           if (sym_addr <= addr)
+             if (sym_addr > best_sym_addr)
+               {
+                 /* Quit if we found an exact match.  */
+                 best_sym = sym;
+                 best_sym_addr = sym_addr;
+                 best_symtab = symtab;
+                 if (sym_addr == addr)
+                   goto done;
+               }
+         }
+      }
+  }
 
- done:
+done:
   if (symtabp)
     *symtabp = best_symtab;
   if (symaddrp)
@@ -1635,19 +1644,19 @@ find_pc_sect_line (pc, section, notcurrent)
      But what we want is the statement containing the instruction.
      Fudge the pc to make sure we get that.  */
 
-  INIT_SAL (&val);     /* initialize to zeroes */
+  INIT_SAL (&val);             /* initialize to zeroes */
 
   if (notcurrent)
     pc -= 1;
 
- /* elz: added this because this function returned the wrong
 /* elz: added this because this function returned the wrong
      information if the pc belongs to a stub (import/export)
      to call a shlib function. This stub would be anywhere between
      two functions in the target, and the line info was erroneously 
      taken to be the one of the line before the pc. 
-  */
+   */
   /* RT: Further explanation:
-   *
+
    * We have stubs (trampolines) inserted between procedures.
    *
    * Example: "shr1" exists in a shared library, and a "shr1" stub also
@@ -1684,31 +1693,31 @@ find_pc_sect_line (pc, section, notcurrent)
    *      check for the address being the same, to avoid an
    *      infinite recursion.
    */
-  msymbol = lookup_minimal_symbol_by_pc(pc);
-  if (msymbol != NULL) 
+  msymbol = lookup_minimal_symbol_by_pc (pc);
+  if (msymbol != NULL)
     if (MSYMBOL_TYPE (msymbol) == mst_solib_trampoline)
-    {
-     mfunsym = lookup_minimal_symbol_text (SYMBOL_NAME (msymbol), NULL, NULL);
-     if (mfunsym == NULL) 
-        /* I eliminated this warning since it is coming out
-         * in the following situation:
-         * gdb shmain // test program with shared libraries
-         * (gdb) break shr1  // function in shared lib
-         * Warning: In stub for ...
-         * In the above situation, the shared lib is not loaded yet, 
-         * so of course we can't find the real func/line info,
-         * but the "break" still works, and the warning is annoying.
-         * So I commented out the warning. RT */
-        /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */;
-        /* fall through */
-     else if (SYMBOL_VALUE(mfunsym) == SYMBOL_VALUE(msymbol))
-        /* Avoid infinite recursion */
-        /* See above comment about why warning is commented out */
-        /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */;
-        /* fall through */
-     else
-       return find_pc_line( SYMBOL_VALUE (mfunsym), 0);
-    }
+      {
+       mfunsym = lookup_minimal_symbol_text (SYMBOL_NAME (msymbol), NULL, NULL);
+       if (mfunsym == NULL)
+         /* I eliminated this warning since it is coming out
+          * in the following situation:
+          * gdb shmain // test program with shared libraries
+          * (gdb) break shr1  // function in shared lib
+          * Warning: In stub for ...
+          * In the above situation, the shared lib is not loaded yet, 
+          * so of course we can't find the real func/line info,
+          * but the "break" still works, and the warning is annoying.
+          * So I commented out the warning. RT */
+         /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */ ;
+       /* fall through */
+       else if (SYMBOL_VALUE (mfunsym) == SYMBOL_VALUE (msymbol))
+         /* Avoid infinite recursion */
+         /* See above comment about why warning is commented out */
+         /* warning ("In stub for %s; unable to find real function/line info", SYMBOL_NAME(msymbol)) */ ;
+       /* fall through */
+       else
+         return find_pc_line (SYMBOL_VALUE (mfunsym), 0);
+      }
 
 
   s = find_pc_sect_symtab (pc, section);
@@ -1732,7 +1741,7 @@ find_pc_sect_line (pc, section, notcurrent)
       /* Find the best line in this symtab.  */
       l = LINETABLE (s);
       if (!l)
-        continue;
+       continue;
       len = l->nitems;
       if (len <= 0)
        {
@@ -1747,7 +1756,7 @@ find_pc_sect_line (pc, section, notcurrent)
       item = l->item;          /* Get first line info */
 
       /* Is this file's first line closer than the first lines of other files?
-        If so, record this file, and its first line, as best alternate.  */
+         If so, record this file, and its first line, as best alternate.  */
       if (item->pc > pc && (!alt || item->pc < alt->pc))
        {
          alt = item;
@@ -1765,12 +1774,12 @@ find_pc_sect_line (pc, section, notcurrent)
        }
 
       /* At this point, prev points at the line whose start addr is <= pc, and
-        item points at the next line.  If we ran off the end of the linetable
-        (pc >= start of the last line), then prev == item.  If pc < start of
-        the first line, prev will not be set.  */
+         item points at the next line.  If we ran off the end of the linetable
+         (pc >= start of the last line), then prev == item.  If pc < start of
+         the first line, prev will not be set.  */
 
       /* Is this file's best line closer than the best in the other files?
-        If so, record this file, and its best line, as best so far.  */
+         If so, record this file, and its best line, as best so far.  */
 
       if (prev && (!best || prev->pc > best->pc))
        {
@@ -1796,7 +1805,8 @@ find_pc_sect_line (pc, section, notcurrent)
          val.line = alt->line - 1;
 
          /* Don't return line 0, that means that we didn't find the line.  */
-         if (val.line == 0) ++val.line;
+         if (val.line == 0)
+           ++val.line;
 
          val.pc = BLOCK_END (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK));
          val.end = alt->pc;
@@ -1825,16 +1835,16 @@ find_pc_line (pc, notcurrent)
      CORE_ADDR pc;
      int notcurrent;
 {
-  asection     *section;
+  asection *section;
 
   section = find_pc_overlay (pc);
   if (pc_in_unmapped_range (pc, section))
     pc = overlay_mapped_address (pc, section);
   return find_pc_sect_line (pc, section, notcurrent);
 }
-
 \f
-static struct symtab* find_line_symtab PARAMS ((struct symtab *, int,
+
+static struct symtab *find_line_symtab PARAMS ((struct symtab *, int,
                                                int *, int *));
 
 /* Find line number LINE in any symtab whose name is the same as
@@ -1847,7 +1857,7 @@ static struct symtab* find_line_symtab PARAMS ((struct symtab *, int,
 
    If not found, return NULL.  */
 
-static struct symtab*
+static struct symtab *
 find_line_symtab (symtab, line, index, exact_match)
      struct symtab *symtab;
      int line;
@@ -1870,15 +1880,15 @@ find_line_symtab (symtab, line, index, exact_match)
   if (best_index < 0 || !exact)
     {
       /* Didn't find an exact match.  So we better keep looking for
-        another symtab with the same name.  In the case of xcoff,
-        multiple csects for one source file (produced by IBM's FORTRAN
-        compiler) produce multiple symtabs (this is unavoidable
-        assuming csects can be at arbitrary places in memory and that
-        the GLOBAL_BLOCK of a symtab has a begin and end address).  */
+         another symtab with the same name.  In the case of xcoff,
+         multiple csects for one source file (produced by IBM's FORTRAN
+         compiler) produce multiple symtabs (this is unavoidable
+         assuming csects can be at arbitrary places in memory and that
+         the GLOBAL_BLOCK of a symtab has a begin and end address).  */
 
       /* BEST is the smallest linenumber > LINE so far seen,
-        or 0 if none has been seen so far.
-        BEST_INDEX and BEST_LINETABLE identify the item for it.  */
+         or 0 if none has been seen so far.
+         BEST_INDEX and BEST_LINETABLE identify the item for it.  */
       int best;
 
       struct objfile *objfile;
@@ -1890,34 +1900,34 @@ find_line_symtab (symtab, line, index, exact_match)
        best = 0;
 
       ALL_SYMTABS (objfile, s)
-       {
-         struct linetable *l;
-         int ind;
+      {
+       struct linetable *l;
+       int ind;
 
-         if (!STREQ (symtab->filename, s->filename))
-           continue;
-         l = LINETABLE (s);
-         ind = find_line_common (l, line, &exact);
-         if (ind >= 0)
-           {
-             if (exact)
-               {
-                 best_index = ind;
-                 best_linetable = l;
-                 best_symtab = s;
-                 goto done;
-               }
-             if (best == 0 || l->item[ind].line < best)
-               {
-                 best = l->item[ind].line;
-                 best_index = ind;
-                 best_linetable = l;
-                 best_symtab = s;
-               }
-           }
-       }
+       if (!STREQ (symtab->filename, s->filename))
+         continue;
+       l = LINETABLE (s);
+       ind = find_line_common (l, line, &exact);
+       if (ind >= 0)
+         {
+           if (exact)
+             {
+               best_index = ind;
+               best_linetable = l;
+               best_symtab = s;
+               goto done;
+             }
+           if (best == 0 || l->item[ind].line < best)
+             {
+               best = l->item[ind].line;
+               best_index = ind;
+               best_linetable = l;
+               best_symtab = s;
+             }
+         }
+      }
     }
- done:
+done:
   if (best_index < 0)
     return NULL;
 
@@ -1972,7 +1982,7 @@ find_line_pc_range (sal, startptr, endptr)
   struct symtab_and_line found_sal;
 
   startaddr = sal.pc;
-  if (startaddr==0 && !find_line_pc (sal.symtab, sal.line, &startaddr))
+  if (startaddr == 0 && !find_line_pc (sal.symtab, sal.line, &startaddr))
     return 0;
 
   /* This whole function is based on address.  For example, if line 10 has
@@ -2067,7 +2077,7 @@ find_pc_line_pc_range (pc, startptr, endptr)
    of real code inside the function.  */
 
 static struct symtab_and_line
-find_function_start_sal PARAMS ((struct symbol *sym, int));
+find_function_start_sal PARAMS ((struct symbol * sym, int));
 
 static struct symtab_and_line
 find_function_start_sal (sym, funfirstline)
@@ -2080,16 +2090,16 @@ find_function_start_sal (sym, funfirstline)
   pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
   fixup_symbol_section (sym, NULL);
   if (funfirstline)
-    { /* skip "first line" of function (which is actually its prologue) */
+    {                          /* skip "first line" of function (which is actually its prologue) */
       asection *section = SYMBOL_BFD_SECTION (sym);
       /* If function is in an unmapped overlay, use its unmapped LMA
-        address, so that SKIP_PROLOGUE has something unique to work on */
+         address, so that SKIP_PROLOGUE has something unique to work on */
       if (section_is_overlay (section) &&
          !section_is_mapped (section))
        pc = overlay_unmapped_address (pc, section);
 
       pc += FUNCTION_START_OFFSET;
-      SKIP_PROLOGUE (pc);
+      pc = SKIP_PROLOGUE (pc);
 
       /* For overlays, map pc back into its mapped VMA range */
       pc = overlay_mapped_address (pc, section);
@@ -2133,7 +2143,7 @@ operator_chars (p, end)
 
   /* Don't get faked out by `operator' being part of a longer
      identifier.  */
-  if (isalpha(*p) || *p == '_' || *p == '$' || *p == '\0')
+  if (isalpha (*p) || *p == '_' || *p == '$' || *p == '\0')
     return *end;
 
   /* Allow some whitespace between `operator' and the operator symbol.  */
@@ -2142,10 +2152,10 @@ operator_chars (p, end)
 
   /* Recognize 'operator TYPENAME'. */
 
-  if (isalpha(*p) || *p == '_' || *p == '$')
+  if (isalpha (*p) || *p == '_' || *p == '$')
     {
-      register char *q = p+1;
-      while (isalnum(*q) || *q == '_' || *q == '$')
+      register char *q = p + 1;
+      while (isalnum (*q) || *q == '_' || *q == '$')
        q++;
       *end = q;
       return p;
@@ -2160,9 +2170,9 @@ operator_chars (p, end)
     case '%':
     case '^':
       if (p[1] == '=')
-       *end = p+2;
+       *end = p + 2;
       else
-       *end = p+1;
+       *end = p + 1;
       return p;
     case '<':
     case '>':
@@ -2171,28 +2181,28 @@ operator_chars (p, end)
     case '&':
     case '|':
       if (p[1] == '=' || p[1] == p[0])
-       *end = p+2;
+       *end = p + 2;
       else
-       *end = p+1;
+       *end = p + 1;
       return p;
     case '~':
     case ',':
-      *end = p+1;
+      *end = p + 1;
       return p;
     case '(':
       if (p[1] != ')')
        error ("`operator ()' must be specified without whitespace in `()'");
-      *end = p+2;
+      *end = p + 2;
       return p;
     case '?':
       if (p[1] != ':')
        error ("`operator ?:' must be specified without whitespace in `?:'");
-      *end = p+2;
+      *end = p + 2;
       return p;
     case '[':
       if (p[1] != ']')
        error ("`operator []' must be specified without whitespace in `[]'");
-      *end = p+2;
+      *end = p + 2;
       return p;
     default:
       error ("`operator %s' not supported", p);
@@ -2207,7 +2217,7 @@ operator_chars (p, end)
    reader because the type of the baseclass might still be stubbed
    when the definition of the derived class is parsed.  */
 
-static int total_number_of_methods PARAMS ((struct type *type));
+static int total_number_of_methods PARAMS ((struct type * type));
 
 static int
 total_number_of_methods (type)
@@ -2250,10 +2260,10 @@ find_methods (t, name, sym_arr)
      the class, then the loop can't do any good.  */
   if (class_name
       && (sym_class = lookup_symbol (class_name,
-                                    (struct block *)NULL,
+                                    (struct block *) NULL,
                                     STRUCT_NAMESPACE,
-                                    (int *)NULL,
-                                    (struct symtab **)NULL)))
+                                    (int *) NULL,
+                                    (struct symtab **) NULL)))
     {
       int method_counter;
 
@@ -2261,8 +2271,8 @@ find_methods (t, name, sym_arr)
       t = SYMBOL_TYPE (sym_class);
 
       /* Loop over each method name.  At this level, all overloads of a name
-        are counted as a single name.  There is an inner loop which loops over
-        each overload.  */
+         are counted as a single name.  There is an inner loop which loops over
+         each overload.  */
 
       for (method_counter = TYPE_NFN_FIELDS (t) - 1;
           method_counter >= 0;
@@ -2272,15 +2282,15 @@ find_methods (t, name, sym_arr)
          char *method_name = TYPE_FN_FIELDLIST_NAME (t, method_counter);
          char dem_opname[64];
 
-          if (strncmp (method_name, "__", 2) == 0 ||
+         if (strncmp (method_name, "__", 2) == 0 ||
              strncmp (method_name, "op", 2) == 0 ||
              strncmp (method_name, "type", 4) == 0)
-            {
+           {
              if (cplus_demangle_opname (method_name, dem_opname, DMGL_ANSI))
-               method_name = dem_opname;
+               method_name = dem_opname;
              else if (cplus_demangle_opname (method_name, dem_opname, 0))
-               method_name = dem_opname; 
-            }
+               method_name = dem_opname;
+           }
 
          if (STREQ (name, method_name))
            /* Find all the overloaded methods with that name.  */
@@ -2298,8 +2308,8 @@ find_methods (t, name, sym_arr)
                    char *tmp_name;
 
                    tmp_name = gdb_mangle_name (t,
-                                                method_counter,
-                                                field_counter);
+                                               method_counter,
+                                               field_counter);
                    phys_name = alloca (strlen (tmp_name) + 1);
                    strcpy (phys_name, tmp_name);
                    free (tmp_name);
@@ -2326,7 +2336,7 @@ find_methods (t, name, sym_arr)
                       language_cplus,
                       DMGL_PARAMS | DMGL_ANSI);
                       fputs_filtered(" - possibly inlined.)\n", gdb_stdout);
-                      */
+                    */
                  }
              }
        }
@@ -2368,11 +2378,11 @@ build_canonical_line_spec (sal, symname, canonical)
   char *filename;
   struct symtab *s = sal->symtab;
 
-  if (s == (struct symtab *)NULL
-      || s->filename == (char *)NULL
-      || canonical == (char ***)NULL)
+  if (s == (struct symtab *) NULL
+      || s->filename == (char *) NULL
+      || canonical == (char ***) NULL)
     return;
+
   canonical_arr = (char **) xmalloc (sizeof (char *));
   *canonical = canonical_arr;
 
@@ -2390,6 +2400,43 @@ build_canonical_line_spec (sal, symname, canonical)
   canonical_arr[0] = canonical_name;
 }
 
+
+
+/* Find an instance of the character C in the string S that is outside
+   of all parenthesis pairs, single-quoted strings, and double-quoted
+   strings.  */
+static char *
+find_toplevel_char (char *s, char c)
+{
+  int quoted = 0;              /* zero if we're not in quotes;
+                                  '"' if we're in a double-quoted string;
+                                  '\'' if we're in a single-quoted string.  */
+  int depth = 0;               /* number of unclosed parens we've seen */
+  char *scan;
+
+  for (scan = s; *scan; scan++)
+    {
+      if (quoted)
+       {
+         if (*scan == quoted)
+           quoted = 0;
+         else if (*scan == '\\' && *(scan + 1))
+           scan++;
+       }
+      else if (*scan == c && ! quoted && depth == 0)
+       return scan;
+      else if (*scan == '"' || *scan == '\'')
+       quoted = *scan;
+      else if (*scan == '(')
+       depth++;
+      else if (*scan == ')' && depth > 0)
+       depth--;
+    }
+
+  return 0;
+}
+
+
 /* Parse a string that specifies a line number.
    Pass the address of a char * variable; that variable will be
    advanced over the characters actually parsed.
@@ -2399,12 +2446,14 @@ build_canonical_line_spec (sal, symname, canonical)
    LINENUM -- that line number in current file.  PC returned is 0.
    FILE:LINENUM -- that line in that file.  PC returned is 0.
    FUNCTION -- line number of openbrace of that function.
-      PC returned is the start of the function.
+   PC returned is the start of the function.
    VARIABLE -- line number of definition of that variable.
-      PC returned is 0.
+   PC returned is 0.
    FILE:FUNCTION -- likewise, but prefer functions in that file.
    *EXPR -- line in which address EXPR appears.
 
+   This may all be followed by an "if EXPR", which we ignore.
+
    FUNCTION may be an undebuggable function found in minimal symbol table.
 
    If the argument FUNFIRSTLINE is nonzero, we want the first line
@@ -2465,7 +2514,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
      will have been defined away in defs.h.  */
 #undef volatile
   volatile struct symtab_and_line val;
-#define volatile /*nothing*/
+#define volatile               /*nothing */
 #else
   struct symtab_and_line val;
 #endif
@@ -2486,14 +2535,16 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
   struct symbol *sym_class;
   int i1;
   int is_quoted;
-  int has_parens;  
+  int is_quote_enclosed;
+  int has_parens;
   int has_if = 0;
+  int has_comma = 0;
   struct symbol **sym_arr;
   struct type *t;
   char *saved_arg = *argptr;
   extern char *gdb_completer_quote_characters;
-  
-  INIT_SAL (&val);     /* initialize to zeroes */
+
+  INIT_SAL (&val);             /* initialize to zeroes */
 
   /* Defaults have defaults.  */
 
@@ -2524,20 +2575,21 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
   /* 'has_if' is for the syntax:
    *     (gdb) break foo if (a==b)
    */
-  if ((ii = strstr(*argptr, " if ")) != NULL ||
-      (ii = strstr(*argptr, "\tif ")) != NULL ||
-      (ii = strstr(*argptr, " if\t")) != NULL ||
-      (ii = strstr(*argptr, "\tif\t")) != NULL ||
-      (ii = strstr(*argptr, " if(")) != NULL ||
-      (ii = strstr(*argptr, "\tif( ")) != NULL) 
+  if ((ii = strstr (*argptr, " if ")) != NULL ||
+      (ii = strstr (*argptr, "\tif ")) != NULL ||
+      (ii = strstr (*argptr, " if\t")) != NULL ||
+      (ii = strstr (*argptr, "\tif\t")) != NULL ||
+      (ii = strstr (*argptr, " if(")) != NULL ||
+      (ii = strstr (*argptr, "\tif( ")) != NULL)
     has_if = 1;
   /* Temporarily zap out "if (condition)" to not
    * confuse the parenthesis-checking code below.
    * This is undone below. Do not change ii!!
    */
-  if (has_if) {
-    *ii = '\0';
-  }
+  if (has_if)
+    {
+      *ii = '\0';
+    }
 
   /* Set various flags.
    * 'has_parens' is important for overload checking, where
@@ -2551,7 +2603,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
               && strchr (gdb_completer_quote_characters, **argptr) != NULL);
 
   has_parens = ((pp = strchr (*argptr, '(')) != NULL
-                && (pp = strchr (pp, ')')) != NULL);
+               && (pp = strrchr (pp, ')')) != NULL);
 
   /* Now that we're safely past the has_parens check,
    * put back " if (condition)" so outer layers can see it 
@@ -2559,26 +2611,60 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
   if (has_if)
     *ii = ' ';
 
+  /* Maybe we were called with a line range FILENAME:LINENUM,FILENAME:LINENUM
+     and we must isolate the first half.  Outer layers will call again later
+     for the second half.
+
+     Don't count commas that appear in argument lists of overloaded
+     functions, or in quoted strings.  It's stupid to go to this much
+     trouble when the rest of the function is such an obvious roach hotel.  */
+  ii = find_toplevel_char (*argptr, ',');
+  has_comma = (ii != 0);
+
+  /* Temporarily zap out second half to not
+   * confuse the code below.
+   * This is undone below. Do not change ii!!
+   */
+  if (has_comma)
+    {
+      *ii = '\0';
+    }
+
   /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
   /* May also be CLASS::MEMBER, or NAMESPACE::NAME */
   /* Look for ':', but ignore inside of <> */
 
   s = NULL;
-  for (p = *argptr; *p; p++)
+  p = *argptr;
+  if (p[0] == '"')
     {
-      if (p[0] == '<') 
+      is_quote_enclosed = 1;
+      p++;
+    }
+  else
+    is_quote_enclosed = 0;
+  for (; *p; p++)
+    {
+      if (p[0] == '<')
        {
-          char * temp_end = find_template_name_end (p);
-          if (!temp_end)
-            error ("malformed template specification in command");
-          p = temp_end;
+         char *temp_end = find_template_name_end (p);
+         if (!temp_end)
+           error ("malformed template specification in command");
+         p = temp_end;
        }
-      if (p[0] == ':' || p[0] == ' ' || p[0] == '\t' || !*p)
+      /* Check for the end of the first half of the linespec.  End of line,
+         a tab, a double colon or the last single colon, or a space.  But
+         if enclosed in double quotes we do not break on enclosed spaces */
+      if (!*p
+         || p[0] == '\t'
+         || ((p[0] == ':')
+             && ((p[1] == ':') || (strchr (p + 1, ':') == NULL)))
+         || ((p[0] == ' ') && !is_quote_enclosed))
        break;
-      if (p[0] == '.' && strchr (p, ':') == NULL) /* Java qualified method. */
+      if (p[0] == '.' && strchr (p, ':') == NULL)      /* Java qualified method. */
        {
          /* Find the *last* '.', since the others are package qualifiers. */
-         for (p1 = p;  *p1;  p1++)
+         for (p1 = p; *p1; p1++)
            {
              if (*p1 == '.')
                p = p1;
@@ -2586,257 +2672,291 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
          break;
        }
     }
-  while (p[0] == ' ' || p[0] == '\t') p++;
+  while (p[0] == ' ' || p[0] == '\t')
+    p++;
+
+  /* if the closing double quote was left at the end, remove it */
+  if (is_quote_enclosed)
+    {
+      char *closing_quote = strchr (p, '"');
+      if (closing_quote && closing_quote[1] == '\0')
+       *closing_quote = '\0';
+    }
+
+  /* Now that we've safely parsed the first half,
+   * put back ',' so outer layers can see it 
+   */
+  if (has_comma)
+    *ii = ',';
 
   if ((p[0] == ':' || p[0] == '.') && !has_parens)
     {
       /*  C++ */
       /*  ... or Java */
-      if (is_quoted) *argptr = *argptr+1;
-      if (p[0] == '.' || p[1] ==':')
+      if (is_quoted)
+       *argptr = *argptr + 1;
+      if (p[0] == '.' || p[1] == ':')
        {
-          int ix;
-          char * saved_arg2 = *argptr;
-          char * temp_end;
-          /* First check for "global" namespace specification,
-             of the form "::foo". If found, skip over the colons
-             and jump to normal symbol processing */
-          if ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t'))
-            saved_arg2 += 2;
-
-          /* We have what looks like a class or namespace
-             scope specification (A::B), possibly with many
-             levels of namespaces or classes (A::B::C::D).
-
-             Some versions of the HP ANSI C++ compiler (as also possibly
-             other compilers) generate class/function/member names with
-             embedded double-colons if they are inside namespaces. To
-             handle this, we loop a few times, considering larger and
-             larger prefixes of the string as though they were single
-             symbols.  So, if the initially supplied string is
-             A::B::C::D::foo, we have to look up "A", then "A::B",
-             then "A::B::C", then "A::B::C::D", and finally
-             "A::B::C::D::foo" as single, monolithic symbols, because
-             A, B, C or D may be namespaces.
-
-             Note that namespaces can nest only inside other
-             namespaces, and not inside classes.  So we need only
-             consider *prefixes* of the string; there is no need to look up
-             "B::C" separately as a symbol in the previous example. */
-          
-          p2 = p; /* save for restart */
-          while (1)
-            {
-            /* Extract the class name.  */
-            p1 = p;
-            while (p != *argptr && p[-1] == ' ') --p;
-            copy = (char *) alloca (p - *argptr + 1);
-            memcpy (copy, *argptr, p - *argptr);
-            copy[p - *argptr] = 0;
-
-            /* Discard the class name from the arg.  */
-            p = p1 + (p1[0] == ':' ? 2 : 1);
-            while (*p == ' ' || *p == '\t') p++;
-            *argptr = p;
-
-            sym_class = lookup_symbol (copy, 0, STRUCT_NAMESPACE, 0, 
-                                       (struct symtab **)NULL);
-       
-            if (sym_class &&
-                (t = check_typedef (SYMBOL_TYPE (sym_class)),
-                 (TYPE_CODE (t) == TYPE_CODE_STRUCT
-                  || TYPE_CODE (t) == TYPE_CODE_UNION)))
-              {
-                /* Arg token is not digits => try it as a function name
-                   Find the next token(everything up to end or next blank). */
-                if (**argptr
-                    && strchr (gdb_completer_quote_characters, **argptr) != NULL)
-                  {
-                    p = skip_quoted(*argptr);
-                    *argptr = *argptr + 1;
-                  }
-                else
-                  {
-                    p = *argptr;
-                    while (*p && *p!=' ' && *p!='\t' && *p!=',' && *p!=':') p++;
-                  }
-/*
-             q = operator_chars (*argptr, &q1);
-             if (q1 - q)
+         char *saved_arg2 = *argptr;
+         char *temp_end;
+         /* First check for "global" namespace specification,
+            of the form "::foo". If found, skip over the colons
+            and jump to normal symbol processing */
+         if ((*argptr == p) || (p[-1] == ' ') || (p[-1] == '\t'))
+           saved_arg2 += 2;
+
+         /* We have what looks like a class or namespace
+            scope specification (A::B), possibly with many
+            levels of namespaces or classes (A::B::C::D).
+
+            Some versions of the HP ANSI C++ compiler (as also possibly
+            other compilers) generate class/function/member names with
+            embedded double-colons if they are inside namespaces. To
+            handle this, we loop a few times, considering larger and
+            larger prefixes of the string as though they were single
+            symbols.  So, if the initially supplied string is
+            A::B::C::D::foo, we have to look up "A", then "A::B",
+            then "A::B::C", then "A::B::C::D", and finally
+            "A::B::C::D::foo" as single, monolithic symbols, because
+            A, B, C or D may be namespaces.
+
+            Note that namespaces can nest only inside other
+            namespaces, and not inside classes.  So we need only
+            consider *prefixes* of the string; there is no need to look up
+            "B::C" separately as a symbol in the previous example. */
+
+         p2 = p;               /* save for restart */
+         while (1)
+           {
+             /* Extract the class name.  */
+             p1 = p;
+             while (p != *argptr && p[-1] == ' ')
+               --p;
+             copy = (char *) alloca (p - *argptr + 1);
+             memcpy (copy, *argptr, p - *argptr);
+             copy[p - *argptr] = 0;
+
+             /* Discard the class name from the arg.  */
+             p = p1 + (p1[0] == ':' ? 2 : 1);
+             while (*p == ' ' || *p == '\t')
+               p++;
+             *argptr = p;
+
+             sym_class = lookup_symbol (copy, 0, STRUCT_NAMESPACE, 0,
+                                        (struct symtab **) NULL);
+
+             if (sym_class &&
+                 (t = check_typedef (SYMBOL_TYPE (sym_class)),
+                  (TYPE_CODE (t) == TYPE_CODE_STRUCT
+                   || TYPE_CODE (t) == TYPE_CODE_UNION)))
                {
-                 char *opname;
-                 char *tmp = alloca (q1 - q + 1);
-                 memcpy (tmp, q, q1 - q);
-                 tmp[q1 - q] = '\0';
-                 opname = cplus_mangle_opname (tmp, DMGL_ANSI);
-                 if (opname == NULL)
+                 /* Arg token is not digits => try it as a function name
+                    Find the next token(everything up to end or next blank). */
+                 if (**argptr
+                     && strchr (gdb_completer_quote_characters, **argptr) != NULL)
                    {
+                     p = skip_quoted (*argptr);
+                     *argptr = *argptr + 1;
+                   }
+                 else
+                   {
+                     p = *argptr;
+                     while (*p && *p != ' ' && *p != '\t' && *p != ',' && *p != ':')
+                       p++;
+                   }
+/*
+   q = operator_chars (*argptr, &q1);
+   if (q1 - q)
+   {
+   char *opname;
+   char *tmp = alloca (q1 - q + 1);
+   memcpy (tmp, q, q1 - q);
+   tmp[q1 - q] = '\0';
+   opname = cplus_mangle_opname (tmp, DMGL_ANSI);
+   if (opname == NULL)
+   {
+   error_begin ();
+   printf_filtered ("no mangling for \"%s\"\n", tmp);
+   cplusplus_hint (saved_arg);
+   return_to_top_level (RETURN_ERROR);
+   }
+   copy = (char*) alloca (3 + strlen(opname));
+   sprintf (copy, "__%s", opname);
+   p = q1;
+   }
+   else
+ */
+                 {
+                   copy = (char *) alloca (p - *argptr + 1);
+                   memcpy (copy, *argptr, p - *argptr);
+                   copy[p - *argptr] = '\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 */
+                 while (*p == ' ' || *p == '\t')
+                   p++;
+                 *argptr = p;
+
+                 sym = 0;
+                 i1 = 0;       /*  counter for the symbol array */
+                 sym_arr = (struct symbol **) alloca (total_number_of_methods (t)
+                                               * sizeof (struct symbol *));
+
+                 if (destructor_name_p (copy, t))
+                   {
+                     /* Destructors are a special case.  */
+                     int m_index, f_index;
+
+                     if (get_destructor_fn_field (t, &m_index, &f_index))
+                       {
+                         struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
+
+                         sym_arr[i1] =
+                           lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
+                                          NULL, VAR_NAMESPACE, (int *) NULL,
+                                          (struct symtab **) NULL);
+                         if (sym_arr[i1])
+                           i1++;
+                       }
+                   }
+                 else
+                   i1 = find_methods (t, copy, sym_arr);
+                 if (i1 == 1)
+                   {
+                     /* There is exactly one field with that name.  */
+                     sym = sym_arr[0];
+
+                     if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
+                       {
+                         values.sals = (struct symtab_and_line *)
+                           xmalloc (sizeof (struct symtab_and_line));
+                         values.nelts = 1;
+                         values.sals[0] = find_function_start_sal (sym,
+                                                             funfirstline);
+                       }
+                     else
+                       {
+                         values.nelts = 0;
+                       }
+                     return values;
+                   }
+                 if (i1 > 0)
+                   {
+                     /* There is more than one field with that name
+                        (overloaded).  Ask the user which one to use.  */
+                     return decode_line_2 (sym_arr, i1, funfirstline, canonical);
+                   }
+                 else
+                   {
+                     char *tmp;
+
+                     if (OPNAME_PREFIX_P (copy))
+                       {
+                         tmp = (char *) alloca (strlen (copy + 3) + 9);
+                         strcpy (tmp, "operator ");
+                         strcat (tmp, copy + 3);
+                       }
+                     else
+                       tmp = copy;
                      error_begin ();
-                     printf_filtered ("no mangling for \"%s\"\n", tmp);
+                     if (tmp[0] == '~')
+                       printf_filtered
+                         ("the class `%s' does not have destructor defined\n",
+                          SYMBOL_SOURCE_NAME (sym_class));
+                     else
+                       printf_filtered
+                         ("the class %s does not have any method named %s\n",
+                          SYMBOL_SOURCE_NAME (sym_class), tmp);
                      cplusplus_hint (saved_arg);
                      return_to_top_level (RETURN_ERROR);
                    }
-                 copy = (char*) alloca (3 + strlen(opname));
-                 sprintf (copy, "__%s", opname);
-                 p = q1;
                }
-             else
-*/
-                  {
-                    copy = (char *) alloca (p - *argptr + 1 );
-                    memcpy (copy, *argptr, p - *argptr);
-                    copy[p - *argptr] = '\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 */
-                while (*p == ' ' || *p == '\t') p++;
-                *argptr = p;
-
-                sym = 0;
-                i1 = 0;                /*  counter for the symbol array */
-                sym_arr = (struct symbol **) alloca(total_number_of_methods (t)
-                                                    * sizeof(struct symbol *));
-
-                if (destructor_name_p (copy, t))
-                  {
-                    /* Destructors are a special case.  */
-                    int m_index, f_index;
-
-                    if (get_destructor_fn_field (t, &m_index, &f_index))
-                      {
-                        struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
-
-                        sym_arr[i1] =
-                          lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
-                                         NULL, VAR_NAMESPACE, (int *) NULL,
-                                         (struct symtab **)NULL);
-                        if (sym_arr[i1])
-                          i1++;
-                      }
-                  }
-                else
-                  i1 = find_methods (t, copy, sym_arr);
-                if (i1 == 1)
-                  {
-                    /* There is exactly one field with that name.  */
-                    sym = sym_arr[0];
-
-                    if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
-                      {
-                        values.sals = (struct symtab_and_line *)
-                          xmalloc (sizeof (struct symtab_and_line));
-                        values.nelts = 1;
-                        values.sals[0] = find_function_start_sal (sym,
-                                                                  funfirstline);
-                      }
-                    else
-                      {
-                        values.nelts = 0;
-                      }
-                    return values;
-                  }
-                if (i1 > 0)
-                  {
-                    /* There is more than one field with that name
-                       (overloaded).  Ask the user which one to use.  */
-                    return decode_line_2 (sym_arr, i1, funfirstline, canonical);
-                  }
-                else
-                  {
-                    char *tmp;
-
-                    if (OPNAME_PREFIX_P (copy))
-                      {
-                        tmp = (char *)alloca (strlen (copy+3) + 9);
-                        strcpy (tmp, "operator ");
-                        strcat (tmp, copy+3);
-                      }
-                    else
-                      tmp = copy;
-                    error_begin ();
-                    if (tmp[0] == '~')
-                      printf_filtered
-                        ("the class `%s' does not have destructor defined\n",
-                         SYMBOL_SOURCE_NAME(sym_class));
-                    else
-                      printf_filtered
-                        ("the class %s does not have any method named %s\n",
-                         SYMBOL_SOURCE_NAME(sym_class), tmp);
-                    cplusplus_hint (saved_arg);
-                    return_to_top_level (RETURN_ERROR);
-                  }
-              }
-
-             /* Move pointer up to next possible class/namespace token */
-              p = p2 + 1; /* restart with old value +1 */
-              /* Move pointer ahead to next double-colon */
-              while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\'')) {
-                if (p[0] == '<') {
-                  temp_end = find_template_name_end (p);
-                  if (!temp_end)
-                    error ("malformed template specification in command");
-                  p = temp_end;
-                }
-                else if ((p[0] == ':') && (p[1] == ':'))
-                  break; /* found double-colon */
-                else
-                  p++;
-              }
-              
-              if (*p != ':')
-                break; /* out of the while (1) */
-
-              p2 = p; /* save restart for next time around */
-              *argptr = saved_arg2; /* restore argptr */
-            } /* while (1) */
-
-          /* Last chance attempt -- check entire name as a symbol */
-          /* Use "copy" in preparation for jumping out of this block,
-             to be consistent with usage following the jump target */
-          copy = (char *) alloca (p - saved_arg2 + 1);
-          memcpy (copy, saved_arg2, p - saved_arg2);
-          /* Note: if is_quoted should be true, we snuff out quote here anyway */
-          copy[p-saved_arg2] = '\000'; 
-          /* Set argptr to skip over the name */
-          *argptr = (*p == '\'') ? p + 1 : p;
-          /* Look up entire name */
-          sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
-          s = (struct symtab *) 0;
-          /* Prepare to jump: restore the " if (condition)" so outer layers see it */
-          if (has_if)
-            *ii = ' ';
-          /* Symbol was found --> jump to normal symbol processing.
-             Code following "symbol_found" expects "copy" to have the
-             symbol name, "sym" to have the symbol pointer, "s" to be
-             a specified file's symtab, and sym_symtab to be the symbol's
-             symtab. */
-          /* By jumping there we avoid falling through the FILE:LINE and
-             FILE:FUNC processing stuff below */
-          if (sym)
-            goto symbol_found;
-
-          /* Couldn't find any interpretation as classes/namespaces, so give up */
-          error_begin ();
-          /* The quotes are important if copy is empty.  */
-          printf_filtered
-            ("Can't find member of namespace, class, struct, or union named \"%s\"\n", copy);
-          cplusplus_hint (saved_arg);
-          return_to_top_level (RETURN_ERROR);
-        }
+
+             /* Move pointer up to next possible class/namespace token */
+             p = p2 + 1;       /* restart with old value +1 */
+             /* Move pointer ahead to next double-colon */
+             while (*p && (p[0] != ' ') && (p[0] != '\t') && (p[0] != '\''))
+               {
+                 if (p[0] == '<')
+                   {
+                     temp_end = find_template_name_end (p);
+                     if (!temp_end)
+                       error ("malformed template specification in command");
+                     p = temp_end;
+                   }
+                 else if ((p[0] == ':') && (p[1] == ':'))
+                   break;      /* found double-colon */
+                 else
+                   p++;
+               }
+
+             if (*p != ':')
+               break;          /* out of the while (1) */
+
+             p2 = p;           /* save restart for next time around */
+             *argptr = saved_arg2;     /* restore argptr */
+           }                   /* while (1) */
+
+         /* Last chance attempt -- check entire name as a symbol */
+         /* Use "copy" in preparation for jumping out of this block,
+            to be consistent with usage following the jump target */
+         copy = (char *) alloca (p - saved_arg2 + 1);
+         memcpy (copy, saved_arg2, p - saved_arg2);
+         /* Note: if is_quoted should be true, we snuff out quote here anyway */
+         copy[p - saved_arg2] = '\000';
+         /* Set argptr to skip over the name */
+         *argptr = (*p == '\'') ? p + 1 : p;
+         /* Look up entire name */
+         sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
+         s = (struct symtab *) 0;
+         /* Prepare to jump: restore the " if (condition)" so outer layers see it */
+         /* Symbol was found --> jump to normal symbol processing.
+            Code following "symbol_found" expects "copy" to have the
+            symbol name, "sym" to have the symbol pointer, "s" to be
+            a specified file's symtab, and sym_symtab to be the symbol's
+            symtab. */
+         /* By jumping there we avoid falling through the FILE:LINE and
+            FILE:FUNC processing stuff below */
+         if (sym)
+           goto symbol_found;
+
+         /* Couldn't find any interpretation as classes/namespaces, so give up */
+         error_begin ();
+         /* The quotes are important if copy is empty.  */
+         printf_filtered
+           ("Can't find member of namespace, class, struct, or union named \"%s\"\n", copy);
+         cplusplus_hint (saved_arg);
+         return_to_top_level (RETURN_ERROR);
+       }
       /*  end of C++  */
 
 
       /* Extract the file name.  */
       p1 = p;
-      while (p != *argptr && p[-1] == ' ') --p;
+      while (p != *argptr && p[-1] == ' ')
+       --p;
+      if ((*p == '"') && is_quote_enclosed)
+       --p;
       copy = (char *) alloca (p - *argptr + 1);
-      memcpy (copy, *argptr, p - *argptr);
-      copy[p - *argptr] = 0;
+      if ((**argptr == '"') && is_quote_enclosed)
+       {
+         memcpy (copy, *argptr + 1, p - *argptr - 1);
+         /* It may have the ending quote right after the file name */
+         if (copy[p - *argptr - 2] == '"')
+           copy[p - *argptr - 2] = 0;
+         else
+           copy[p - *argptr - 1] = 0;
+       }
+      else
+       {
+         memcpy (copy, *argptr, p - *argptr);
+         copy[p - *argptr] = 0;
+       }
 
       /* Find that file's data.  */
       s = lookup_symtab (copy);
@@ -2849,37 +2969,47 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
 
       /* Discard the file name from the arg.  */
       p = p1 + 1;
-      while (*p == ' ' || *p == '\t') p++;
+      while (*p == ' ' || *p == '\t')
+       p++;
       *argptr = p;
     }
-  else {
-    /* Check if what we have till now is a symbol name */
-
-    /* We may be looking at a template instantiation such
-       as "foo<int>".  Check here whether we know about it,
-       instead of falling through to the code below which
-       handles ordinary function names, because that code
-       doesn't like seeing '<' and '>' in a name -- the
-       skip_quoted call doesn't go past them.  So see if we
-       can figure it out right now. */ 
-
-    copy = (char *) alloca (p - *argptr + 1);
-    memcpy (copy, *argptr, p - *argptr);
-    copy[p - *argptr] = '\000';
-    sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
-    if (sym) {
-      /* Yes, we have a symbol; jump to symbol processing */
-      /* Code after symbol_found expects S, SYM_SYMTAB, SYM, 
-         and COPY to be set correctly */ 
-      if (has_if)
-        *ii = ' ';
-      *argptr = (*p == '\'') ? p + 1 : p;
-      s = (struct symtab *) 0;
-      goto symbol_found;
+#if 0
+  /* No one really seems to know why this was added. It certainly
+     breaks the command line, though, whenever the passed
+     name is of the form ClassName::Method. This bit of code
+     singles out the class name, and if funfirstline is set (for
+     example, you are setting a breakpoint at this function),
+     you get an error. This did not occur with earlier
+     verions, so I am ifdef'ing this out. 3/29/99 */
+  else
+    {
+      /* Check if what we have till now is a symbol name */
+
+      /* We may be looking at a template instantiation such
+         as "foo<int>".  Check here whether we know about it,
+         instead of falling through to the code below which
+         handles ordinary function names, because that code
+         doesn't like seeing '<' and '>' in a name -- the
+         skip_quoted call doesn't go past them.  So see if we
+         can figure it out right now. */
+
+      copy = (char *) alloca (p - *argptr + 1);
+      memcpy (copy, *argptr, p - *argptr);
+      copy[p - *argptr] = '\000';
+      sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
+      if (sym)
+       {
+         /* Yes, we have a symbol; jump to symbol processing */
+         /* Code after symbol_found expects S, SYM_SYMTAB, SYM, 
+            and COPY to be set correctly */
+         *argptr = (*p == '\'') ? p + 1 : p;
+         s = (struct symtab *) 0;
+         goto symbol_found;
+       }
+      /* Otherwise fall out from here and go to file/line spec
+         processing, etc. */
     }
-    /* Otherwise fall out from here and go to file/line spec
-       processing, etc. */ 
-  }
+#endif
 
   /* S is specified file's symtab, or 0 if no file specified.
      arg no longer contains the file name.  */
@@ -2887,22 +3017,27 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
   /* Check whether arg is all digits (and sign) */
 
   q = *argptr;
-  if (*q == '-' || *q == '+') q++;
+  if (*q == '-' || *q == '+')
+    q++;
   while (*q >= '0' && *q <= '9')
     q++;
 
   if (q != *argptr && (*q == 0 || *q == ' ' || *q == '\t' || *q == ','))
     {
       /* We found a token consisting of all digits -- at least one digit.  */
-      enum sign {none, plus, minus} sign = none;
+      enum sign
+       {
+         none, plus, minus
+       }
+      sign = none;
 
       /* We might need a canonical line spec if no file was specified.  */
       int need_canonical = (s == 0) ? 1 : 0;
 
       /* This is where we need to make sure that we have good defaults.
-        We must guarantee that this section of code is never executed
-        when we are called with just a function name, since
-        select_source_symtab calls us with such an argument  */
+         We must guarantee that this section of code is never executed
+         when we are called with just a function name, since
+         select_source_symtab calls us with such an argument  */
 
       if (s == 0 && default_symtab == 0)
        {
@@ -2933,21 +3068,22 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
            val.line = 1;
          break;
        case none:
-         break;        /* No need to adjust val.line.  */
+         break;                /* No need to adjust val.line.  */
        }
 
-      while (*q == ' ' || *q == '\t') q++;
+      while (*q == ' ' || *q == '\t')
+       q++;
       *argptr = q;
       if (s == 0)
        s = default_symtab;
 
       /* It is possible that this source file has more than one symtab, 
-        and that the new line number specification has moved us from the
-        default (in s) to a new one.  */
+         and that the new line number specification has moved us from the
+         default (in s) to a new one.  */
       val.symtab = find_line_symtab (s, val.line, NULL, NULL);
       if (val.symtab == 0)
        val.symtab = s;
-     
+
       val.pc = 0;
       values.sals = (struct symtab_and_line *)
        xmalloc (sizeof (struct symtab_and_line));
@@ -2962,39 +3098,43 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
      Find the next token (everything up to end or next whitespace).  */
 
   if (**argptr == '$')         /* May be a convenience variable */
-    p = skip_quoted (*argptr + (((*argptr)[1] == '$') ? 2 : 1));  /* One or two $ chars possible */
+    p = skip_quoted (*argptr + (((*argptr)[1] == '$') ? 2 : 1));       /* One or two $ chars possible */
   else if (is_quoted)
     {
       p = skip_quoted (*argptr);
       if (p[-1] != '\'')
-        error ("Unmatched single quote.");
+       error ("Unmatched single quote.");
     }
   else if (has_parens)
     {
-      p = pp+1;
+      p = pp + 1;
     }
-  else 
+  else
     {
-      p = skip_quoted(*argptr);
+      p = skip_quoted (*argptr);
     }
 
+  if (is_quote_enclosed && **argptr == '"')
+    (*argptr)++;
+
   copy = (char *) alloca (p - *argptr + 1);
   memcpy (copy, *argptr, p - *argptr);
   copy[p - *argptr] = '\0';
   if (p != *argptr
       && copy[0]
-      && copy[0] == copy [p - *argptr - 1]
+      && copy[0] == copy[p - *argptr - 1]
       && strchr (gdb_completer_quote_characters, copy[0]) != NULL)
     {
-      copy [p - *argptr - 1] = '\0';
+      copy[p - *argptr - 1] = '\0';
       copy++;
     }
-  while (*p == ' ' || *p == '\t') p++;
+  while (*p == ' ' || *p == '\t')
+    p++;
   *argptr = p;
 
   /* If it starts with $: may be a legitimate variable or routine name
      (e.g. HP-UX millicode routines such as $$dyncall), or it may
-     be history value, or it may be a convenience variable */ 
+     be history value, or it may be a convenience variable */
 
   if (*copy == '$')
     {
@@ -3004,51 +3144,51 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
 
       p = (copy[1] == '$') ? copy + 2 : copy + 1;
       while (*p >= '0' && *p <= '9')
-        p++;
-      if (!*p) /* reached end of token without hitting non-digit */
-        {
-          /* We have a value history reference */
-          sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index);
-          valx = access_value_history ((copy[1] == '$') ? -index : index);
-          if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
-            error ("History values used in line specs must have integer values.");
-        }
-      else 
-        {
-          /* Not all digits -- may be user variable/function or a
-              convenience variable */
-          
-          /* Look up entire name as a symbol first */
-          sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab); 
-          s = (struct symtab *) 0;
-          need_canonical = 1;
-          /* Symbol was found --> jump to normal symbol processing.
-             Code following "symbol_found" expects "copy" to have the
-             symbol name, "sym" to have the symbol pointer, "s" to be
-             a specified file's symtab, and sym_symtab to be the symbol's
-             symtab. */
-          if (sym)
-            goto symbol_found;
-
-          /* If symbol was not found, look in minimal symbol tables */ 
-          msymbol = lookup_minimal_symbol (copy, 0, 0);
-          /* Min symbol was found --> jump to minsym processing. */ 
-          if (msymbol)
-            goto minimal_symbol_found;
-          
-          /* Not a user variable or function -- must be convenience variable */
-          need_canonical = (s == 0) ? 1 : 0;
-          valx = value_of_internalvar (lookup_internalvar (copy + 1));
-          if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
-            error ("Convenience variables used in line specs must have integer values.");
-        }
-
-      /* Either history value or convenience value from above, in valx */ 
+       p++;
+      if (!*p)                 /* reached end of token without hitting non-digit */
+       {
+         /* We have a value history reference */
+         sscanf ((copy[1] == '$') ? copy + 2 : copy + 1, "%d", &index);
+         valx = access_value_history ((copy[1] == '$') ? -index : index);
+         if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
+           error ("History values used in line specs must have integer values.");
+       }
+      else
+       {
+         /* Not all digits -- may be user variable/function or a
+            convenience variable */
+
+         /* Look up entire name as a symbol first */
+         sym = lookup_symbol (copy, 0, VAR_NAMESPACE, 0, &sym_symtab);
+         s = (struct symtab *) 0;
+         need_canonical = 1;
+         /* Symbol was found --> jump to normal symbol processing.
+            Code following "symbol_found" expects "copy" to have the
+            symbol name, "sym" to have the symbol pointer, "s" to be
+            a specified file's symtab, and sym_symtab to be the symbol's
+            symtab. */
+         if (sym)
+           goto symbol_found;
+
+         /* If symbol was not found, look in minimal symbol tables */
+         msymbol = lookup_minimal_symbol (copy, 0, 0);
+         /* Min symbol was found --> jump to minsym processing. */
+         if (msymbol)
+           goto minimal_symbol_found;
+
+         /* Not a user variable or function -- must be convenience variable */
+         need_canonical = (s == 0) ? 1 : 0;
+         valx = value_of_internalvar (lookup_internalvar (copy + 1));
+         if (TYPE_CODE (VALUE_TYPE (valx)) != TYPE_CODE_INT)
+           error ("Convenience variables used in line specs must have integer values.");
+       }
+
+      /* Either history value or convenience value from above, in valx */
       val.symtab = s ? s : default_symtab;
       val.line = value_as_long (valx);
       val.pc = 0;
 
-      values.sals = (struct symtab_and_line *)xmalloc (sizeof val);
+      values.sals = (struct symtab_and_line *) xmalloc (sizeof val);
       values.sals[0] = val;
       values.nelts = 1;
 
@@ -3066,9 +3206,9 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
                       (s ? BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
                        : get_selected_block ()),
                       VAR_NAMESPACE, 0, &sym_symtab);
-  
-symbol_found:   /* We also jump here from inside the C++ class/namespace 
-                   code on finding a symbol of the form "A::B::C" */
+
+symbol_found:                  /* We also jump here from inside the C++ class/namespace 
+                                  code on finding a symbol of the form "A::B::C" */
 
   if (sym != NULL)
     {
@@ -3122,20 +3262,20 @@ symbol_found:   /* We also jump here from inside the C++ class/namespace
 
   msymbol = lookup_minimal_symbol (copy, NULL, NULL);
 
-minimal_symbol_found: /* We also jump here from the case for variables
-                         that begin with '$' */
-  
+minimal_symbol_found:          /* We also jump here from the case for variables
+                                  that begin with '$' */
+
   if (msymbol != NULL)
     {
       values.sals = (struct symtab_and_line *)
        xmalloc (sizeof (struct symtab_and_line));
-      values.sals[0] = find_pc_sect_line ( SYMBOL_VALUE_ADDRESS (msymbol), 
-                                          (struct sec *)0,0 );
+      values.sals[0] = find_pc_sect_line (SYMBOL_VALUE_ADDRESS (msymbol),
+                                         (struct sec *) 0, 0);
       values.sals[0].section = SYMBOL_BFD_SECTION (msymbol);
       if (funfirstline)
        {
          values.sals[0].pc += FUNCTION_START_OFFSET;
-         SKIP_PROLOGUE (values.sals[0].pc);
+         values.sals[0].pc = SKIP_PROLOGUE (values.sals[0].pc);
        }
       values.nelts = 1;
       return values;
@@ -3146,7 +3286,7 @@ minimal_symbol_found: /* We also jump here from the case for variables
     error (no_symtab_msg);
 
   error ("Function \"%s\" not defined.", copy);
-  return values;       /* for lint */
+  return values;               /* for lint */
 }
 
 struct symtabs_and_lines
@@ -3159,7 +3299,7 @@ decode_line_spec (string, funfirstline)
     error ("Empty line specification.");
   sals = decode_line_1 (&string, funfirstline,
                        current_source_symtab, current_source_line,
-                       (char ***)NULL);
+                       (char ***) NULL);
   if (*string)
     error ("Junk at end of line specification: %s", string);
   return sals;
@@ -3183,12 +3323,12 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
   char *prompt;
   char *symname;
   struct cleanup *old_chain;
-  char **canonical_arr = (char **)NULL;
+  char **canonical_arr = (char **) NULL;
 
-  values.sals = (struct symtab_and_line *) 
-    alloca (nelts * sizeof(struct symtab_and_line));
-  return_values.sals = (struct symtab_and_line *) 
-    xmalloc (nelts * sizeof(struct symtab_and_line));
+  values.sals = (struct symtab_and_line *)
+    alloca (nelts * sizeof (struct symtab_and_line));
+  return_values.sals = (struct symtab_and_line *)
+    xmalloc (nelts * sizeof (struct symtab_and_line));
   old_chain = make_cleanup (free, return_values.sals);
 
   if (canonical)
@@ -3200,7 +3340,7 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
     }
 
   i = 0;
-  printf_unfiltered("[0] cancel\n[1] all\n");
+  printf_unfiltered ("[0] cancel\n[1] all\n");
   while (i < nelts)
     {
       INIT_SAL (&return_values.sals[i]);       /* initialize to zeroes */
@@ -3209,7 +3349,7 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
        {
          values.sals[i] = find_function_start_sal (sym_arr[i], funfirstline);
          printf_unfiltered ("[%d] %s at %s:%d\n",
-                            (i+2),
+                            (i + 2),
                             SYMBOL_SOURCE_NAME (sym_arr[i]),
                             values.sals[i].symtab->filename,
                             values.sals[i].line);
@@ -3218,13 +3358,13 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
        printf_unfiltered ("?HERE\n");
       i++;
     }
-  
+
   if ((prompt = getenv ("PS2")) == NULL)
     {
       prompt = "> ";
     }
   args = command_line_input (prompt, 0, "overload-choice");
-  
+
   if (args == 0 || *args == 0)
     error_no_arg ("one or more choice numbers");
 
@@ -3234,7 +3374,8 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
       int num;
 
       arg1 = args;
-      while (*arg1 >= '0' && *arg1 <= '9') arg1++;
+      while (*arg1 >= '0' && *arg1 <= '9')
+       arg1++;
       if (*arg1 && *arg1 != ' ' && *arg1 != '\t')
        error ("Arguments must be choice numbers.");
 
@@ -3248,15 +3389,15 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
            {
              for (i = 0; i < nelts; i++)
                {
-                 if (canonical_arr[i] == NULL)
+                 if (canonical_arr[i] == NULL)
                    {
                      symname = SYMBOL_NAME (sym_arr[i]);
-                     canonical_arr[i] = savestring (symname, strlen (symname));
+                     canonical_arr[i] = savestring (symname, strlen (symname));
                    }
                }
            }
          memcpy (return_values.sals, values.sals,
-                 (nelts * sizeof(struct symtab_and_line)));
+                 (nelts * sizeof (struct symtab_and_line)));
          return_values.nelts = nelts;
          discard_cleanups (old_chain);
          return return_values;
@@ -3287,14 +3428,15 @@ decode_line_2 (sym_arr, nelts, funfirstline, canonical)
        }
 
       args = arg1;
-      while (*args == ' ' || *args == '\t') args++;
+      while (*args == ' ' || *args == '\t')
+       args++;
     }
   return_values.nelts = i;
   discard_cleanups (old_chain);
   return return_values;
 }
-
 \f
+
 /* Slave routine for sources_info.  Force line breaks at ,'s.
    NAME is the name to print and *FIRST is nonzero if this is the first
    name printed.  Set *FIRST to zero.  */
@@ -3352,7 +3494,7 @@ output_source_filename (name, first)
 
   wrap_here ("");
   fputs_filtered (name, gdb_stdout);
-}  
+}
 
 static void
 sources_info (ignore, from_tty)
@@ -3363,31 +3505,31 @@ sources_info (ignore, from_tty)
   register struct partial_symtab *ps;
   register struct objfile *objfile;
   int first;
-  
+
   if (!have_full_symbols () && !have_partial_symbols ())
     {
       error (no_symtab_msg);
     }
-  
+
   printf_filtered ("Source files for which symbols have been read in:\n\n");
 
   first = 1;
   ALL_SYMTABS (objfile, s)
-    {
-      output_source_filename (s -> filename, &first);
-    }
+  {
+    output_source_filename (s->filename, &first);
+  }
   printf_filtered ("\n\n");
-  
+
   printf_filtered ("Source files for which symbols will be read in on demand:\n\n");
 
   first = 1;
   ALL_PSYMTABS (objfile, ps)
-    {
-      if (!ps->readin)
-       {
-         output_source_filename (ps -> filename, &first);
-       }
-    }
+  {
+    if (!ps->readin)
+      {
+       output_source_filename (ps->filename, &first);
+      }
+  }
   printf_filtered ("\n");
 }
 
@@ -3402,10 +3544,10 @@ file_matches (file, files, nfiles)
   if (file != NULL && nfiles != 0)
     {
       for (i = 0; i < nfiles; i++)
-        {
-          if (strcmp (files[i], basename (file)) == 0)
-            return 1;
-        }
+       {
+         if (strcmp (files[i], basename (file)) == 0)
+           return 1;
+       }
     }
   else if (nfiles == 0)
     return 1;
@@ -3431,14 +3573,14 @@ free_search_symbols (symbols)
    returning the results in *MATCHES.
 
    Only symbols of KIND are searched:
-     FUNCTIONS_NAMESPACE - search all functions
-     TYPES_NAMESPACE     - search all type names
-     METHODS_NAMESPACE   - search all methods NOT IMPLEMENTED
-     VARIABLES_NAMESPACE - search all symbols, excluding functions, type names,
-                         and constants (enums)
+   FUNCTIONS_NAMESPACE - search all functions
+   TYPES_NAMESPACE     - search all type names
+   METHODS_NAMESPACE   - search all methods NOT IMPLEMENTED
+   VARIABLES_NAMESPACE - search all symbols, excluding functions, type names,
+   and constants (enums)
 
    free_search_symbols should be called when *MATCHES is no longer needed.
-*/
+ */
 void
 search_symbols (regexp, kind, nfiles, files, matches)
      char *regexp;
@@ -3446,7 +3588,7 @@ search_symbols (regexp, kind, nfiles, files, matches)
      int nfiles;
      char *files[];
      struct symbol_search **matches;
-     
+
 {
   register struct symtab *s;
   register struct partial_symtab *ps;
@@ -3462,13 +3604,17 @@ search_symbols (regexp, kind, nfiles, files, matches)
   char *val;
   int found_misc = 0;
   static enum minimal_symbol_type types[]
-    = {mst_data, mst_text, mst_abs, mst_unknown};
+  =
+  {mst_data, mst_text, mst_abs, mst_unknown};
   static enum minimal_symbol_type types2[]
-    = {mst_bss,  mst_file_text, mst_abs, mst_unknown};
+  =
+  {mst_bss, mst_file_text, mst_abs, mst_unknown};
   static enum minimal_symbol_type types3[]
-    = {mst_file_data,  mst_solib_trampoline, mst_abs, mst_unknown};
+  =
+  {mst_file_data, mst_solib_trampoline, mst_abs, mst_unknown};
   static enum minimal_symbol_type types4[]
-    = {mst_file_bss,   mst_text, mst_abs, mst_unknown};
+  =
+  {mst_file_bss, mst_text, mst_abs, mst_unknown};
   enum minimal_symbol_type ourtype;
   enum minimal_symbol_type ourtype2;
   enum minimal_symbol_type ourtype3;
@@ -3498,31 +3644,31 @@ search_symbols (regexp, kind, nfiles, files, matches)
       char *opend;
       char *opname = operator_chars (regexp, &opend);
       if (*opname)
-        {
-          int fix = -1; /* -1 means ok; otherwise number of spaces needed. */
-          if (isalpha(*opname) || *opname == '_' || *opname == '$')
-            {
-              /* There should 1 space between 'operator' and 'TYPENAME'. */
-              if (opname[-1] != ' ' || opname[-2] == ' ')
-                fix = 1;
-            }
-          else
-            {
-              /* There should 0 spaces between 'operator' and 'OPERATOR'. */
-              if (opname[-1] == ' ')
-                fix = 0;
-            }
-          /* If wrong number of spaces, fix it. */
-          if (fix >= 0)
-            {
-              char *tmp = (char*) alloca(opend-opname+10);
-              sprintf(tmp, "operator%.*s%s", fix, " ", opname);
-              regexp = tmp;
-            }
-        }
-      
+       {
+         int fix = -1;         /* -1 means ok; otherwise number of spaces needed. */
+         if (isalpha (*opname) || *opname == '_' || *opname == '$')
+           {
+             /* There should 1 space between 'operator' and 'TYPENAME'. */
+             if (opname[-1] != ' ' || opname[-2] == ' ')
+               fix = 1;
+           }
+         else
+           {
+             /* There should 0 spaces between 'operator' and 'OPERATOR'. */
+             if (opname[-1] == ' ')
+               fix = 0;
+           }
+         /* If wrong number of spaces, fix it. */
+         if (fix >= 0)
+           {
+             char *tmp = (char *) alloca (opend - opname + 10);
+             sprintf (tmp, "operator%.*s%s", fix, " ", opname);
+             regexp = tmp;
+           }
+       }
+
       if (0 != (val = re_comp (regexp)))
-        error ("Invalid regexp (%s): %s", val, regexp);
+       error ("Invalid regexp (%s): %s", val, regexp);
     }
 
   /* Search through the partial symtabs *first* for all symbols
@@ -3530,53 +3676,54 @@ search_symbols (regexp, kind, nfiles, files, matches)
      the machinery below. */
 
   ALL_PSYMTABS (objfile, ps)
-    {
-      struct partial_symbol **bound, **gbound, **sbound;
-      int keep_going = 1;
-
-      if (ps->readin) continue;
-
-      gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
-      sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
-      bound = gbound;
-      
-      /* Go through all of the symbols stored in a partial
-         symtab in one loop. */
-      psym = objfile->global_psymbols.list + ps->globals_offset;
-      while (keep_going)
-        {
-          if (psym >= bound)
-            {
-              if (bound == gbound && ps->n_static_syms != 0)
-                {
-                  psym = objfile->static_psymbols.list + ps->statics_offset;
-                  bound = sbound;
-                }
-              else
-                keep_going = 0;
-              continue;
-            }
-          else
-            {
-              QUIT;
-
-              /* If it would match (logic taken from loop below)
-                 load the file and go on to the next one */
-              if (file_matches (ps->filename, files, nfiles)
-                  && ((regexp == NULL || SYMBOL_MATCHES_REGEXP (*psym))
-                      && ((kind == VARIABLES_NAMESPACE && SYMBOL_CLASS (*psym) != LOC_TYPEDEF
-                           && SYMBOL_CLASS (*psym) != LOC_BLOCK)
-                          || (kind == FUNCTIONS_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_BLOCK)
-                          || (kind == TYPES_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)
-                          || (kind == METHODS_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_BLOCK))))
-                {
-                  PSYMTAB_TO_SYMTAB(ps);
-                  keep_going = 0;
-                }
-            }
-          psym++;
-        }
-    }
+  {
+    struct partial_symbol **bound, **gbound, **sbound;
+    int keep_going = 1;
+
+    if (ps->readin)
+      continue;
+
+    gbound = objfile->global_psymbols.list + ps->globals_offset + ps->n_global_syms;
+    sbound = objfile->static_psymbols.list + ps->statics_offset + ps->n_static_syms;
+    bound = gbound;
+
+    /* Go through all of the symbols stored in a partial
+       symtab in one loop. */
+    psym = objfile->global_psymbols.list + ps->globals_offset;
+    while (keep_going)
+      {
+       if (psym >= bound)
+         {
+           if (bound == gbound && ps->n_static_syms != 0)
+             {
+               psym = objfile->static_psymbols.list + ps->statics_offset;
+               bound = sbound;
+             }
+           else
+             keep_going = 0;
+           continue;
+         }
+       else
+         {
+           QUIT;
+
+           /* If it would match (logic taken from loop below)
+              load the file and go on to the next one */
+           if (file_matches (ps->filename, files, nfiles)
+               && ((regexp == NULL || SYMBOL_MATCHES_REGEXP (*psym))
+                   && ((kind == VARIABLES_NAMESPACE && SYMBOL_CLASS (*psym) != LOC_TYPEDEF
+                        && SYMBOL_CLASS (*psym) != LOC_BLOCK)
+                       || (kind == FUNCTIONS_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_BLOCK)
+                       || (kind == TYPES_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_TYPEDEF)
+                       || (kind == METHODS_NAMESPACE && SYMBOL_CLASS (*psym) == LOC_BLOCK))))
+             {
+               PSYMTAB_TO_SYMTAB (ps);
+               keep_going = 0;
+             }
+         }
+       psym++;
+      }
+  }
 
   /* Here, we search through the minimal symbol tables for functions
      and variables that match, and force their symbols to be read.
@@ -3589,82 +3736,82 @@ search_symbols (regexp, kind, nfiles, files, matches)
      to determine if the variable has debug info.
      If the lookup fails, set found_misc so that we will rescan to print
      any matching symbols without debug info.
-  */
+   */
 
   if (nfiles == 0 && (kind == VARIABLES_NAMESPACE || kind == FUNCTIONS_NAMESPACE))
     {
       ALL_MSYMBOLS (objfile, msymbol)
-        {
-          if (MSYMBOL_TYPE (msymbol) == ourtype ||
-              MSYMBOL_TYPE (msymbol) == ourtype2 ||
-              MSYMBOL_TYPE (msymbol) == ourtype3 ||
-              MSYMBOL_TYPE (msymbol) == ourtype4)
-            {
-              if (regexp == NULL || SYMBOL_MATCHES_REGEXP (msymbol))
-                {
-                  if (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol)))
-                    {
-                      if (kind == FUNCTIONS_NAMESPACE
-                          || lookup_symbol (SYMBOL_NAME (msymbol), 
-                                            (struct block *) NULL,
-                                            VAR_NAMESPACE,
-                                            0, (struct symtab **) NULL) == NULL)
-                        found_misc = 1;
-                    }
-                }
-            }
-        }
+      {
+       if (MSYMBOL_TYPE (msymbol) == ourtype ||
+           MSYMBOL_TYPE (msymbol) == ourtype2 ||
+           MSYMBOL_TYPE (msymbol) == ourtype3 ||
+           MSYMBOL_TYPE (msymbol) == ourtype4)
+         {
+           if (regexp == NULL || SYMBOL_MATCHES_REGEXP (msymbol))
+             {
+               if (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol)))
+                 {
+                   if (kind == FUNCTIONS_NAMESPACE
+                       || lookup_symbol (SYMBOL_NAME (msymbol),
+                                         (struct block *) NULL,
+                                         VAR_NAMESPACE,
+                                       0, (struct symtab **) NULL) == NULL)
+                     found_misc = 1;
+                 }
+             }
+         }
+      }
     }
 
   ALL_SYMTABS (objfile, s)
-    {
-      bv = BLOCKVECTOR (s);
-      /* Often many files share a blockvector.
-         Scan each blockvector only once so that
-         we don't get every symbol many times.
-         It happens that the first symtab in the list
-         for any given blockvector is the main file.  */
-      if (bv != prev_bv)
-        for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
-          {
-            b = BLOCKVECTOR_BLOCK (bv, i);
-            /* Skip the sort if this block is always sorted.  */
-            if (!BLOCK_SHOULD_SORT (b))
-              sort_block_syms (b);
-            for (j = 0; j < BLOCK_NSYMS (b); j++)
-              {
-                QUIT;
-                sym = BLOCK_SYM (b, j);
-                if (file_matches (s->filename, files, nfiles)
-                    && ((regexp == NULL || SYMBOL_MATCHES_REGEXP (sym))
-                        && ((kind == VARIABLES_NAMESPACE && SYMBOL_CLASS (sym) != LOC_TYPEDEF
-                             && SYMBOL_CLASS (sym) != LOC_BLOCK
-                             && SYMBOL_CLASS (sym) != LOC_CONST)
-                            || (kind == FUNCTIONS_NAMESPACE && SYMBOL_CLASS (sym) == LOC_BLOCK)
-                            || (kind == TYPES_NAMESPACE && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
-                            || (kind == METHODS_NAMESPACE && SYMBOL_CLASS (sym) == LOC_BLOCK))))
-                  {
-                    /* match */
-                    psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
-                    psr->block = i;
-                    psr->symtab = s;
-                    psr->symbol = sym;
-                    psr->msymbol = NULL;
-                    psr->next = NULL;
-                    if (tail == NULL)
-                      {
-                        sr = psr;
-                        old_chain = make_cleanup ((make_cleanup_func) 
-                                                  free_search_symbols, sr);
-                      }
-                    else
-                      tail->next = psr;
-                    tail = psr;
-                  }
-              }
-          }
-      prev_bv = bv;
-    }
+  {
+    bv = BLOCKVECTOR (s);
+    /* Often many files share a blockvector.
+       Scan each blockvector only once so that
+       we don't get every symbol many times.
+       It happens that the first symtab in the list
+       for any given blockvector is the main file.  */
+    if (bv != prev_bv)
+      for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
+       {
+         b = BLOCKVECTOR_BLOCK (bv, i);
+         /* Skip the sort if this block is always sorted.  */
+         if (!BLOCK_SHOULD_SORT (b))
+           sort_block_syms (b);
+         for (j = 0; j < BLOCK_NSYMS (b); j++)
+           {
+             QUIT;
+             sym = BLOCK_SYM (b, j);
+             if (file_matches (s->filename, files, nfiles)
+                 && ((regexp == NULL || SYMBOL_MATCHES_REGEXP (sym))
+                     && ((kind == VARIABLES_NAMESPACE && SYMBOL_CLASS (sym) != LOC_TYPEDEF
+                          && SYMBOL_CLASS (sym) != LOC_BLOCK
+                          && SYMBOL_CLASS (sym) != LOC_CONST)
+                         || (kind == FUNCTIONS_NAMESPACE && SYMBOL_CLASS (sym) == LOC_BLOCK)
+                         || (kind == TYPES_NAMESPACE && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+                         || (kind == METHODS_NAMESPACE && SYMBOL_CLASS (sym) == LOC_BLOCK))))
+               {
+                 /* match */
+                 psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
+                 psr->block = i;
+                 psr->symtab = s;
+                 psr->symbol = sym;
+                 psr->msymbol = NULL;
+                 psr->next = NULL;
+                 if (tail == NULL)
+                   {
+                     sr = psr;
+                     old_chain = make_cleanup ((make_cleanup_func)
+                                               free_search_symbols, sr);
+                   }
+                 else
+                   tail->next = psr;
+                 tail = psr;
+               }
+           }
+       }
+    prev_bv = bv;
+  }
 
   /* If there are no eyes, avoid all contact.  I mean, if there are
      no debug symbols, then print directly from the msymbol_vector.  */
@@ -3672,44 +3819,44 @@ search_symbols (regexp, kind, nfiles, files, matches)
   if (found_misc || kind != FUNCTIONS_NAMESPACE)
     {
       ALL_MSYMBOLS (objfile, msymbol)
-        {
-          if (MSYMBOL_TYPE (msymbol) == ourtype ||
-              MSYMBOL_TYPE (msymbol) == ourtype2 ||
-              MSYMBOL_TYPE (msymbol) == ourtype3 ||
-              MSYMBOL_TYPE (msymbol) == ourtype4)
-            {
-              if (regexp == NULL || SYMBOL_MATCHES_REGEXP (msymbol))
-                {
-                  /* Functions:  Look up by address. */
-                  if (kind != FUNCTIONS_NAMESPACE ||
-                      (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol))))
-                    {
-                      /* Variables/Absolutes:  Look up by name */
-                      if (lookup_symbol (SYMBOL_NAME (msymbol), 
-                                         (struct block *) NULL, VAR_NAMESPACE,
-                                         0, (struct symtab **) NULL) == NULL)
-                        {
-                          /* match */
-                          psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
-                          psr->block = i;
-                          psr->msymbol = msymbol;
-                          psr->symtab  = NULL;
-                          psr->symbol  = NULL;
-                          psr->next = NULL;
-                          if (tail == NULL)
-                            {
-                              sr = psr;
-                              old_chain = make_cleanup ((make_cleanup_func) 
-                                                      free_search_symbols, &sr);
-                            }
-                          else
-                            tail->next = psr;
-                          tail = psr;
-                        }
-                    }
-                }
-            }
-        }
+      {
+       if (MSYMBOL_TYPE (msymbol) == ourtype ||
+           MSYMBOL_TYPE (msymbol) == ourtype2 ||
+           MSYMBOL_TYPE (msymbol) == ourtype3 ||
+           MSYMBOL_TYPE (msymbol) == ourtype4)
+         {
+           if (regexp == NULL || SYMBOL_MATCHES_REGEXP (msymbol))
+             {
+               /* Functions:  Look up by address. */
+               if (kind != FUNCTIONS_NAMESPACE ||
+                   (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol))))
+                 {
+                   /* Variables/Absolutes:  Look up by name */
+                   if (lookup_symbol (SYMBOL_NAME (msymbol),
+                                      (struct block *) NULL, VAR_NAMESPACE,
+                                      0, (struct symtab **) NULL) == NULL)
+                     {
+                       /* match */
+                       psr = (struct symbol_search *) xmalloc (sizeof (struct symbol_search));
+                       psr->block = i;
+                       psr->msymbol = msymbol;
+                       psr->symtab = NULL;
+                       psr->symbol = NULL;
+                       psr->next = NULL;
+                       if (tail == NULL)
+                         {
+                           sr = psr;
+                           old_chain = make_cleanup ((make_cleanup_func)
+                                                 free_search_symbols, &sr);
+                         }
+                       else
+                         tail->next = psr;
+                       tail = psr;
+                     }
+                 }
+             }
+         }
+      }
     }
 
   *matches = sr;
@@ -3720,7 +3867,7 @@ search_symbols (regexp, kind, nfiles, files, matches)
 /* Helper function for symtab_symbol_info, this function uses
    the data returned from search_symbols() to print information
    regarding the match to gdb_stdout.
-*/
+ */
 static void
 print_symbol_info (kind, s, sym, block, last)
      namespace_enum kind;
@@ -3738,74 +3885,75 @@ print_symbol_info (kind, s, sym, block, last)
 
   if (kind != TYPES_NAMESPACE && block == STATIC_BLOCK)
     printf_filtered ("static ");
-           
+
   /* Typedef that is not a C++ class */
   if (kind == TYPES_NAMESPACE
       && SYMBOL_NAMESPACE (sym) != STRUCT_NAMESPACE)
-    c_typedef_print (SYMBOL_TYPE(sym), sym, gdb_stdout);
+    c_typedef_print (SYMBOL_TYPE (sym), sym, gdb_stdout);
   /* variable, func, or typedef-that-is-c++-class */
-  else if (kind < TYPES_NAMESPACE || 
-           (kind == TYPES_NAMESPACE && 
-            SYMBOL_NAMESPACE(sym) == STRUCT_NAMESPACE))
+  else if (kind < TYPES_NAMESPACE ||
+          (kind == TYPES_NAMESPACE &&
+           SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE))
     {
       type_print (SYMBOL_TYPE (sym),
-                  (SYMBOL_CLASS (sym) == LOC_TYPEDEF
-                   ? "" : SYMBOL_SOURCE_NAME (sym)),
-                  gdb_stdout, 0);
+                 (SYMBOL_CLASS (sym) == LOC_TYPEDEF
+                  ? "" : SYMBOL_SOURCE_NAME (sym)),
+                 gdb_stdout, 0);
 
       printf_filtered (";\n");
     }
   else
     {
-# if 0
+#if 0
       /* Tiemann says: "info methods was never implemented."  */
       char *demangled_name;
-      c_type_print_base (TYPE_FN_FIELD_TYPE(t, block),
-                         gdb_stdout, 0, 0); 
-      c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE(t, block),
-                                   gdb_stdout, 0); 
+      c_type_print_base (TYPE_FN_FIELD_TYPE (t, block),
+                        gdb_stdout, 0, 0);
+      c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (t, block),
+                                  gdb_stdout, 0);
       if (TYPE_FN_FIELD_STUB (t, block))
-        check_stub_method (TYPE_DOMAIN_TYPE (type), j, block);
+       check_stub_method (TYPE_DOMAIN_TYPE (type), j, block);
       demangled_name =
-        cplus_demangle (TYPE_FN_FIELD_PHYSNAME (t, block),
-                        DMGL_ANSI | DMGL_PARAMS);
+       cplus_demangle (TYPE_FN_FIELD_PHYSNAME (t, block),
+                       DMGL_ANSI | DMGL_PARAMS);
       if (demangled_name == NULL)
-        fprintf_filtered (stream, "<badly mangled name %s>",
-                          TYPE_FN_FIELD_PHYSNAME (t, block));
+       fprintf_filtered (stream, "<badly mangled name %s>",
+                         TYPE_FN_FIELD_PHYSNAME (t, block));
       else
-        {
-          fputs_filtered (demangled_name, stream);
-          free (demangled_name);
-        }
-# endif
+       {
+         fputs_filtered (demangled_name, stream);
+         free (demangled_name);
+       }
+#endif
     }
 }
 
 /* This help function for symtab_symbol_info() prints information
    for non-debugging symbols to gdb_stdout.
-*/
+ */
 static void
 print_msymbol_info (msymbol)
      struct minimal_symbol *msymbol;
 {
   printf_filtered ("   %08lx  %s\n",
-                   (unsigned long) SYMBOL_VALUE_ADDRESS (msymbol),
-                   SYMBOL_SOURCE_NAME (msymbol));
+                  (unsigned long) SYMBOL_VALUE_ADDRESS (msymbol),
+                  SYMBOL_SOURCE_NAME (msymbol));
 }
 
 /* This is the guts of the commands "info functions", "info types", and
    "info variables". It calls search_symbols to find all matches and then
    print_[m]symbol_info to print out some useful information about the
    matches.
-*/
+ */
 static void
 symtab_symbol_info (regexp, kind, from_tty)
      char *regexp;
      namespace_enum kind;
-     int   from_tty;
+     int from_tty;
 {
   static char *classnames[]
-    = {"variable", "function", "type", "method"};
+  =
+  {"variable", "function", "type", "method"};
   struct symbol_search *symbols;
   struct symbol_search *p;
   struct cleanup *old_chain;
@@ -3817,32 +3965,32 @@ symtab_symbol_info (regexp, kind, from_tty)
   old_chain = make_cleanup ((make_cleanup_func) free_search_symbols, symbols);
 
   printf_filtered (regexp
-                   ? "All %ss matching regular expression \"%s\":\n"
-                   : "All defined %ss:\n",
-                   classnames[(int) (kind - LABEL_NAMESPACE - 1)], regexp);
+                  ? "All %ss matching regular expression \"%s\":\n"
+                  : "All defined %ss:\n",
+                  classnames[(int) (kind - LABEL_NAMESPACE - 1)], regexp);
 
   for (p = symbols; p != NULL; p = p->next)
     {
       QUIT;
 
       if (p->msymbol != NULL)
-        {
-          if (first)
-            {
-              printf_filtered ("\nNon-debugging symbols:\n");
-              first = 0;
-            }
-          print_msymbol_info (p->msymbol);
-        }
+       {
+         if (first)
+           {
+             printf_filtered ("\nNon-debugging symbols:\n");
+             first = 0;
+           }
+         print_msymbol_info (p->msymbol);
+       }
       else
-        {
-          print_symbol_info (kind,
-                             p->symtab,
-                             p->symbol,
-                             p->block,
-                             last_filename);
-          last_filename = p->symtab->filename;
-        }
+       {
+         print_symbol_info (kind,
+                            p->symtab,
+                            p->symbol,
+                            p->block,
+                            last_filename);
+         last_filename = p->symtab->filename;
+       }
     }
 
   do_cleanups (old_chain);
@@ -3883,6 +4031,15 @@ methods_info (regexp)
 #endif /* 0 */
 
 /* Breakpoint all functions matching regular expression. */
+#ifdef UI_OUT
+void
+rbreak_command_wrapper (regexp, from_tty)
+     char *regexp;
+     int from_tty;
+{
+  rbreak_command (regexp, from_tty);
+}
+#endif
 static void
 rbreak_command (regexp, from_tty)
      char *regexp;
@@ -3898,33 +4055,33 @@ rbreak_command (regexp, from_tty)
   for (p = ss; p != NULL; p = p->next)
     {
       if (p->msymbol == NULL)
-        {
-          char *string = (char *) alloca (strlen (p->symtab->filename)
-                                          + strlen (SYMBOL_NAME (p->symbol))
-                                          + 4);
-          strcpy (string, p->symtab->filename);
-          strcat (string, ":'");
-          strcat (string, SYMBOL_NAME (p->symbol));
-          strcat (string, "'");
-          break_command (string, from_tty);
-          print_symbol_info (FUNCTIONS_NAMESPACE,
-                             p->symtab,
-                             p->symbol,
-                             p->block,
-                             p->symtab->filename);
-        }
+       {
+         char *string = (char *) alloca (strlen (p->symtab->filename)
+                                         + strlen (SYMBOL_NAME (p->symbol))
+                                         + 4);
+         strcpy (string, p->symtab->filename);
+         strcat (string, ":'");
+         strcat (string, SYMBOL_NAME (p->symbol));
+         strcat (string, "'");
+         break_command (string, from_tty);
+         print_symbol_info (FUNCTIONS_NAMESPACE,
+                            p->symtab,
+                            p->symbol,
+                            p->block,
+                            p->symtab->filename);
+       }
       else
-        {
-          break_command (SYMBOL_NAME (p->msymbol), from_tty);
-          printf_filtered ("<function, no debug info> %s;\n",
-                           SYMBOL_SOURCE_NAME (p->msymbol));
-        }
+       {
+         break_command (SYMBOL_NAME (p->msymbol), from_tty);
+         printf_filtered ("<function, no debug info> %s;\n",
+                          SYMBOL_SOURCE_NAME (p->msymbol));
+       }
     }
 
   do_cleanups (old_chain);
 }
-
 \f
+
 /* Return Nonzero if block a is lexically nested within block b,
    or if a and b have the same pc range.
    Return zero otherwise. */
@@ -3935,10 +4092,10 @@ contained_in (a, b)
   if (!a || !b)
     return 0;
   return BLOCK_START (a) >= BLOCK_START (b)
-      && BLOCK_END (a)   <= BLOCK_END (b);
+    && BLOCK_END (a) <= BLOCK_END (b);
 }
-
 \f
+
 /* Helper routine for make_symbol_completion_list.  */
 
 static int return_val_size;
@@ -3959,8 +4116,8 @@ static char **return_val;
   } while (0)
 
 /*  Test to see if the symbol specified by SYMNAME (which is already
-    demangled for C++ symbols) matches SYM_TEXT in the first SYM_TEXT_LEN
-    characters.  If so, add it to the current completion list. */
+   demangled for C++ symbols) matches SYM_TEXT in the first SYM_TEXT_LEN
+   characters.  If so, add it to the current completion list. */
 
 static void
 completion_list_add_name (symname, sym_text, sym_text_len, text, word)
@@ -3990,7 +4147,7 @@ completion_list_add_name (symname, sym_text, sym_text_len, text, word)
          return;
        }
     }
-  
+
   /* We have a match for a completion, so add SYMNAME to the current list
      of matches. Note that the name is moved to freshly malloc'd space. */
 
@@ -4082,7 +4239,7 @@ make_symbol_completion_list (text, word)
              quote_found = '\0';
            else if (*p == '\\' && p[1] == quote_found)
              /* A backslash followed by the quote character
-                doesn't end the string.  */
+                doesn't end the string.  */
              ++p;
          }
        else if (*p == '\'' || *p == '"')
@@ -4096,7 +4253,7 @@ make_symbol_completion_list (text, word)
       sym_text = quote_pos + 1;
     else if (quote_found == '"')
       /* A double-quoted string is never a symbol, nor does it make sense
-        to complete it any other way.  */
+         to complete it any other way.  */
       return NULL;
     else
       {
@@ -4124,30 +4281,31 @@ make_symbol_completion_list (text, word)
      by matching SYM_TEXT.  Add each one that you find to the list.  */
 
   ALL_PSYMTABS (objfile, ps)
-    {
-      /* If the psymtab's been read in we'll get it when we search
-        through the blockvector.  */
-      if (ps->readin) continue;
-      
-      for (psym = objfile->global_psymbols.list + ps->globals_offset;
-          psym < (objfile->global_psymbols.list + ps->globals_offset
-                  + ps->n_global_syms);
-          psym++)
-       {
-         /* If interrupted, then quit. */
-         QUIT;
-         COMPLETION_LIST_ADD_SYMBOL (*psym, sym_text, sym_text_len, text, word);
-       }
-      
-      for (psym = objfile->static_psymbols.list + ps->statics_offset;
-          psym < (objfile->static_psymbols.list + ps->statics_offset
-                  + ps->n_static_syms);
-          psym++)
-       {
-         QUIT;
-         COMPLETION_LIST_ADD_SYMBOL (*psym, sym_text, sym_text_len, text, word);
-       }
-    }
+  {
+    /* If the psymtab's been read in we'll get it when we search
+       through the blockvector.  */
+    if (ps->readin)
+      continue;
+
+    for (psym = objfile->global_psymbols.list + ps->globals_offset;
+        psym < (objfile->global_psymbols.list + ps->globals_offset
+                + ps->n_global_syms);
+        psym++)
+      {
+       /* If interrupted, then quit. */
+       QUIT;
+       COMPLETION_LIST_ADD_SYMBOL (*psym, sym_text, sym_text_len, text, word);
+      }
+
+    for (psym = objfile->static_psymbols.list + ps->statics_offset;
+        psym < (objfile->static_psymbols.list + ps->statics_offset
+                + ps->n_static_syms);
+        psym++)
+      {
+       QUIT;
+       COMPLETION_LIST_ADD_SYMBOL (*psym, sym_text, sym_text_len, text, word);
+      }
+  }
 
   /* At this point scan through the misc symbol vectors and add each
      symbol you find to the list.  Eventually we want to ignore
@@ -4155,10 +4313,10 @@ make_symbol_completion_list (text, word)
      handled by the psymtab code above).  */
 
   ALL_MSYMBOLS (objfile, msymbol)
-    {
-      QUIT;
-      COMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text, word);
-    }
+  {
+    QUIT;
+    COMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text, word);
+  }
 
   /* Search upwards from currently selected frame (so that we can
      complete on local vars.  */
@@ -4167,11 +4325,11 @@ make_symbol_completion_list (text, word)
     {
       if (!BLOCK_SUPERBLOCK (b))
        {
-         surrounding_static_block = b;         /* For elmin of dups */
+         surrounding_static_block = b;         /* For elmin of dups */
        }
-      
+
       /* Also catch fields of types defined in this places which match our
-        text string.  Only complete on types visible from current context. */
+         text string.  Only complete on types visible from current context. */
 
       for (i = 0; i < BLOCK_NSYMS (b); i++)
        {
@@ -4189,7 +4347,7 @@ make_symbol_completion_list (text, word)
                      if (TYPE_FIELD_NAME (t, j))
                        {
                          completion_list_add_name (TYPE_FIELD_NAME (t, j),
-                                                     sym_text, sym_text_len, text, word);
+                                       sym_text, sym_text_len, text, word);
                        }
                    }
                }
@@ -4201,28 +4359,29 @@ make_symbol_completion_list (text, word)
      symbols which match.  */
 
   ALL_SYMTABS (objfile, s)
-    {
-      QUIT;
-      b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
-      for (i = 0; i < BLOCK_NSYMS (b); i++)
-       {
-         sym = BLOCK_SYM (b, i);
-         COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
-       }
-    }
+  {
+    QUIT;
+    b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+    for (i = 0; i < BLOCK_NSYMS (b); i++)
+      {
+       sym = BLOCK_SYM (b, i);
+       COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
+      }
+  }
 
   ALL_SYMTABS (objfile, s)
-    {
-      QUIT;
-      b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
-      /* Don't do this block twice.  */
-      if (b == surrounding_static_block) continue;
-      for (i = 0; i < BLOCK_NSYMS (b); i++)
-       {
-         sym = BLOCK_SYM (b, i);
-         COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
-       }
-    }
+  {
+    QUIT;
+    b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+    /* Don't do this block twice.  */
+    if (b == surrounding_static_block)
+      continue;
+    for (i = 0; i < BLOCK_NSYMS (b); i++)
+      {
+       sym = BLOCK_SYM (b, i);
+       COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
+      }
+  }
 
   return (return_val);
 }
@@ -4265,18 +4424,19 @@ in_prologue (pc, func_start)
    likely that the user has stepped into a library function w/o symbols, or
    is doing a stepi/nexti through code without symbols.  */
 
- nosyms:
+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;
+  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.  */
 
-  SKIP_PROLOGUE (func_start);
+  func_start = SKIP_PROLOGUE (func_start);
 
   return pc < func_start;
 }
@@ -4290,19 +4450,19 @@ static int sym_return_val_index;
 static struct symbol **sym_return_val;
 
 /*  Test to see if the symbol specified by SYMNAME (which is already
-    demangled for C++ symbols) matches SYM_TEXT in the first SYM_TEXT_LEN
-    characters.  If so, add it to the current completion list. */
+   demangled for C++ symbols) matches SYM_TEXT in the first SYM_TEXT_LEN
+   characters.  If so, add it to the current completion list. */
 
 static void
 overload_list_add_symbol (sym, oload_name)
-  struct symbol * sym;
-  char * oload_name;
+     struct symbol *sym;
+     char *oload_name;
 {
   int newsize;
   int i;
 
   /* Get the demangled name without parameters */
-  char * sym_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ARM | DMGL_ANSI);
+  char *sym_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ARM | DMGL_ANSI);
   if (!sym_name)
     {
       sym_name = (char *) xmalloc (strlen (SYMBOL_NAME (sym)) + 1);
@@ -4311,7 +4471,10 @@ overload_list_add_symbol (sym, oload_name)
 
   /* skip symbols that cannot match */
   if (strcmp (sym_name, oload_name) != 0)
-    return;
+    {
+      free (sym_name);
+      return;
+    }
 
   /* If there is no type information, we can't do anything, so skip */
   if (SYMBOL_TYPE (sym) == NULL)
@@ -4331,7 +4494,7 @@ overload_list_add_symbol (sym, oload_name)
     }
   sym_return_val[sym_return_val_index++] = sym;
   sym_return_val[sym_return_val_index] = NULL;
-  
+
   free (sym_name);
 }
 
@@ -4343,16 +4506,14 @@ overload_list_add_symbol (sym, oload_name)
 
 struct symbol **
 make_symbol_overload_list (fsym)
-  struct symbol * fsym;
+     struct symbol *fsym;
 {
   register struct symbol *sym;
   register struct symtab *s;
   register struct partial_symtab *ps;
-  register struct minimal_symbol *msymbol;
   register struct objfile *objfile;
   register struct block *b, *surrounding_static_block = 0;
-  register int i, j;
-  struct partial_symbol **psym;
+  register int i;
   /* The name we are completing on. */
   char *oload_name = NULL;
   /* Length of name.  */
@@ -4375,44 +4536,38 @@ make_symbol_overload_list (fsym)
   sym_return_val[0] = NULL;
 
   /* Look through the partial symtabs for all symbols which begin
-     by matching OLOAD_NAME.  Add each one that you find to the list.  */
+     by matching OLOAD_NAME.  Make sure we read that symbol table in. */
 
   ALL_PSYMTABS (objfile, ps)
-    {
-      /* If the psymtab's been read in we'll get it when we search
-        through the blockvector.  */
-      if (ps->readin) continue;
-      
-      for (psym = objfile->global_psymbols.list + ps->globals_offset;
-          psym < (objfile->global_psymbols.list + ps->globals_offset
-                  + ps->n_global_syms);
-          psym++)
-       {
-         /* If interrupted, then quit. */
-         QUIT;
-         overload_list_add_symbol (*psym, oload_name);
-       }
-      
-      for (psym = objfile->static_psymbols.list + ps->statics_offset;
-          psym < (objfile->static_psymbols.list + ps->statics_offset
-                  + ps->n_static_syms);
-          psym++)
-       {
-         QUIT;
-         overload_list_add_symbol (*psym, oload_name);
-       }
-    }
+  {
+    struct partial_symbol **psym;
 
-  /* At this point scan through the misc symbol vectors and add each
-     symbol you find to the list.  Eventually we want to ignore
-     anything that isn't a text symbol (everything else will be
-     handled by the psymtab code above).  */
+    /* If the psymtab's been read in we'll get it when we search
+       through the blockvector.  */
+    if (ps->readin)
+      continue;
 
-  ALL_MSYMBOLS (objfile, msymbol)
-    {
-      QUIT;
-      overload_list_add_symbol (msymbol, oload_name);
-    }
+    for (psym = objfile->global_psymbols.list + ps->globals_offset;
+        psym < (objfile->global_psymbols.list + ps->globals_offset
+                + ps->n_global_syms);
+        psym++)
+      {
+       /* If interrupted, then quit. */
+       QUIT;
+        /* This will cause the symbol table to be read if it has not yet been */
+        s = PSYMTAB_TO_SYMTAB (ps);
+      }
+
+    for (psym = objfile->static_psymbols.list + ps->statics_offset;
+        psym < (objfile->static_psymbols.list + ps->statics_offset
+                + ps->n_static_syms);
+        psym++)
+      {
+       QUIT;
+        /* This will cause the symbol table to be read if it has not yet been */
+        s = PSYMTAB_TO_SYMTAB (ps);
+      }
+  }
 
   /* Search upwards from currently selected frame (so that we can
      complete on local vars.  */
@@ -4421,11 +4576,11 @@ make_symbol_overload_list (fsym)
     {
       if (!BLOCK_SUPERBLOCK (b))
        {
-         surrounding_static_block = b;         /* For elimination of dups */
+         surrounding_static_block = b;         /* For elimination of dups */
        }
-      
+
       /* Also catch fields of types defined in this places which match our
-        text string.  Only complete on types visible from current context. */
+         text string.  Only complete on types visible from current context. */
 
       for (i = 0; i < BLOCK_NSYMS (b); i++)
        {
@@ -4438,28 +4593,29 @@ make_symbol_overload_list (fsym)
      symbols which match.  */
 
   ALL_SYMTABS (objfile, s)
-    {
-      QUIT;
-      b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
-      for (i = 0; i < BLOCK_NSYMS (b); i++)
-       {
-         sym = BLOCK_SYM (b, i);
-         overload_list_add_symbol (sym, oload_name);
-       }
-    }
+  {
+    QUIT;
+    b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+    for (i = 0; i < BLOCK_NSYMS (b); i++)
+      {
+       sym = BLOCK_SYM (b, i);
+       overload_list_add_symbol (sym, oload_name);
+      }
+  }
 
   ALL_SYMTABS (objfile, s)
-    {
-      QUIT;
-      b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
-      /* Don't do this block twice.  */
-      if (b == surrounding_static_block) continue;
-      for (i = 0; i < BLOCK_NSYMS (b); i++)
-       {
-         sym = BLOCK_SYM (b, i);
-         overload_list_add_symbol (sym, oload_name);
-       }
-    }
+  {
+    QUIT;
+    b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK);
+    /* Don't do this block twice.  */
+    if (b == surrounding_static_block)
+      continue;
+    for (i = 0; i < BLOCK_NSYMS (b); i++)
+      {
+       sym = BLOCK_SYM (b, i);
+       overload_list_add_symbol (sym, oload_name);
+      }
+  }
 
   free (oload_name);
 
@@ -4467,16 +4623,16 @@ make_symbol_overload_list (fsym)
 }
 
 /* End of overload resolution functions */
-
 \f
+
 void
 _initialize_symtab ()
 {
   add_info ("variables", variables_info,
-           "All global and static variable names, or those matching REGEXP.");
+        "All global and static variable names, or those matching REGEXP.");
   if (dbx_commands)
-    add_com("whereis", class_info, variables_info, 
-           "All global and static variable names, or those matching REGEXP.");
+    add_com ("whereis", class_info, variables_info,
+        "All global and static variable names, or those matching REGEXP.");
 
   add_info ("functions", functions_info,
            "All function names, or those matching REGEXP.");
@@ -4484,9 +4640,9 @@ _initialize_symtab ()
   /* FIXME:  This command has at least the following problems:
      1.  It prints builtin types (in a very strange and confusing fashion).
      2.  It doesn't print right, e.g. with
-         typedef struct foo *FOO
-        type_print prints "FOO" when we want to make it (in this situation)
-        print "struct foo *".
+     typedef struct foo *FOO
+     type_print prints "FOO" when we want to make it (in this situation)
+     print "struct foo *".
      I also think "ptype" or "whatis" is more likely to be useful (but if
      there is much disagreement "info types" can be fixed).  */
   add_info ("types", types_info,
@@ -4503,13 +4659,13 @@ are listed.");
            "Source files in the program.");
 
   add_com ("rbreak", class_breakpoint, rbreak_command,
-           "Set a breakpoint for all functions matching REGEXP.");
+          "Set a breakpoint for all functions matching REGEXP.");
 
   if (xdb_commands)
     {
       add_com ("lf", class_info, sources_info, "Source files in the program");
       add_com ("lg", class_info, variables_info,
-           "All global and static variable names, or those matching REGEXP.");
+        "All global and static variable names, or those matching REGEXP.");
     }
 
   /* Initialize the one built-in type that isn't language dependent... */
index b09da9b..e141479 100644 (file)
@@ -1,22 +1,23 @@
 /* Print values for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1998
-             Free Software Foundation, Inc.
+   Copyright 1986, 1988, 1989, 1991-1994, 1998, 2000
+   Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "gdb_string.h"
@@ -36,8 +37,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* Prototypes for local functions */
 
-static void print_hex_chars PARAMS ((GDB_FILE *, unsigned char *, 
-                                     unsigned int));
+static int partial_memory_read (CORE_ADDR memaddr, char *myaddr,
+                               int len, int *errnoptr);
+
+static void print_hex_chars (struct ui_file *, unsigned char *,
+                            unsigned int);
 
 static void show_print PARAMS ((char *, int));
 
@@ -97,8 +101,8 @@ int unionprint;                      /* Controls printing of nested unions.  */
 /* If nonzero, causes machine addresses to be printed in certain contexts. */
 
 int addressprint;              /* Controls printing of machine addresses */
-
 \f
+
 /* Print data of type TYPE located at VALADDR (within GDB), which came from
    the inferior at address ADDRESS, onto stdio stream STREAM according to
    FORMAT (a letter, or 0 for natural format using TYPE).
@@ -121,12 +125,12 @@ int addressprint;         /* Controls printing of machine addresses */
 
 int
 val_print (type, valaddr, embedded_offset, address,
-           stream, format, deref_ref, recurse, pretty)
+          stream, format, deref_ref, recurse, pretty)
      struct type *type;
      char *valaddr;
      int embedded_offset;
      CORE_ADDR address;
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int format;
      int deref_ref;
      int recurse;
@@ -137,7 +141,7 @@ val_print (type, valaddr, embedded_offset, address,
     {
       pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
     }
-  
+
   QUIT;
 
   /* Ensure that the type is complete and not just a stub.  If the type is
@@ -150,9 +154,9 @@ val_print (type, valaddr, embedded_offset, address,
       gdb_flush (stream);
       return (0);
     }
-  
+
   return (LA_VAL_PRINT (type, valaddr, embedded_offset, address,
-                        stream, format, deref_ref, recurse, pretty));
+                       stream, format, deref_ref, recurse, pretty));
 }
 
 /* Print the value VAL in C-ish syntax on stream STREAM.
@@ -163,7 +167,7 @@ val_print (type, valaddr, embedded_offset, address,
 int
 value_print (val, stream, format, pretty)
      value_ptr val;
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int format;
      enum val_prettyprint pretty;
 {
@@ -188,7 +192,7 @@ void
 val_print_type_code_int (type, valaddr, stream)
      struct type *type;
      char *valaddr;
-     GDB_FILE *stream;
+     struct ui_file *stream;
 {
   if (TYPE_LENGTH (type) > sizeof (LONGEST))
     {
@@ -233,12 +237,14 @@ val_print_type_code_int (type, valaddr, stream)
    format it according to the current language (this should be used for most
    integers which GDB prints, the exception is things like protocols where
    the format of the integer is a protocol thing, not a user-visible thing).
  */
+ */
 
 #if defined (CC_HAS_LONG_LONG) && !defined (PRINTF_HAS_LONG_LONG)
+static void print_decimal (struct ui_file * stream, char *sign,
+                          int use_local, ULONGEST val_ulong);
 static void
 print_decimal (stream, sign, use_local, val_ulong)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      char *sign;
      int use_local;
      ULONGEST val_ulong;
@@ -275,7 +281,7 @@ print_decimal (stream, sign, use_local, val_ulong)
 
 void
 print_longest (stream, format, use_local, val_long)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int format;
      int use_local;
      LONGEST val_long;
@@ -342,7 +348,7 @@ print_longest (stream, format, use_local, val_long)
     case 'd':
       fprintf_filtered (stream,
                        use_local ? local_decimal_format_custom ("ll")
-                                 : "%lld",
+                       : "%lld",
                        val_long);
       break;
     case 'u':
@@ -351,13 +357,13 @@ print_longest (stream, format, use_local, val_long)
     case 'x':
       fprintf_filtered (stream,
                        use_local ? local_hex_format_custom ("ll")
-                                 : "%llx",
+                       : "%llx",
                        val_long);
       break;
     case 'o':
       fprintf_filtered (stream,
                        use_local ? local_octal_format_custom ("ll")
-                                 : "%llo",
+                       : "%llo",
                        val_long);
       break;
     case 'b':
@@ -375,7 +381,7 @@ print_longest (stream, format, use_local, val_long)
     default:
       abort ();
     }
-#else /* !CC_HAS_LONG_LONG || !PRINTF_HAS_LONG_LONG*/
+#else /* !CC_HAS_LONG_LONG || !PRINTF_HAS_LONG_LONG */
   /* In the following it is important to coerce (val_long) to a long. It does
      nothing if !LONG_LONG, but it will chop off the top half (which we know
      we can ignore) if the host supports long longs.  */
@@ -385,7 +391,7 @@ print_longest (stream, format, use_local, val_long)
     case 'd':
       fprintf_filtered (stream,
                        use_local ? local_decimal_format_custom ("l")
-                                 : "%ld",
+                       : "%ld",
                        (long) val_long);
       break;
     case 'u':
@@ -394,13 +400,13 @@ print_longest (stream, format, use_local, val_long)
     case 'x':
       fprintf_filtered (stream,
                        use_local ? local_hex_format_custom ("l")
-                                 : "%lx",
+                       : "%lx",
                        (unsigned long) val_long);
       break;
     case 'o':
       fprintf_filtered (stream,
                        use_local ? local_octal_format_custom ("l")
-                                 : "%lo",
+                       : "%lo",
                        (unsigned long) val_long);
       break;
     case 'b':
@@ -425,6 +431,7 @@ print_longest (stream, format, use_local, val_long)
 #endif /* CC_HAS_LONG_LONG || PRINTF_HAS_LONG_LONG */
 }
 
+#if 0
 void
 strcat_longest (format, use_local, val_long, buf, buflen)
      int format;
@@ -440,7 +447,7 @@ strcat_longest (format, use_local, val_long, buf, buflen)
   vbot = (long) val_long;
 
   if ((format == 'd' && (val_long < INT_MIN || val_long > INT_MAX))
-      || ((format == 'u' || format == 'x') && (unsigned long long)val_long > UINT_MAX))
+      || ((format == 'u' || format == 'x') && (unsigned long long) val_long > UINT_MAX))
     {
       sprintf (buf, "0x%lx%08lx", vtop, vbot);
       return;
@@ -452,34 +459,34 @@ strcat_longest (format, use_local, val_long, buf, buflen)
     {
     case 'd':
       sprintf (buf,
-              (use_local ? local_decimal_format_custom ("ll") : "%lld"), 
+              (use_local ? local_decimal_format_custom ("ll") : "%lld"),
               val_long);
       break;
     case 'u':
-      sprintf (buf, "%llu",  val_long);
+      sprintf (buf, "%llu", val_long);
       break;
     case 'x':
       sprintf (buf,
-              (use_local ? local_hex_format_custom ("ll") : "%llx"), 
-                       
+              (use_local ? local_hex_format_custom ("ll") : "%llx"),
+
               val_long);
       break;
     case 'o':
       sprintf (buf,
-              (use_local ? local_octal_format_custom ("ll") : "%llo"), 
+              (use_local ? local_octal_format_custom ("ll") : "%llo"),
               val_long);
       break;
     case 'b':
-      sprintf (buf, local_hex_format_custom ("02ll"),  val_long);
+      sprintf (buf, local_hex_format_custom ("02ll"), val_long);
       break;
     case 'h':
-      sprintf (buf, local_hex_format_custom ("04ll"),  val_long);
+      sprintf (buf, local_hex_format_custom ("04ll"), val_long);
       break;
     case 'w':
-      sprintf (buf, local_hex_format_custom ("08ll"),  val_long);
+      sprintf (buf, local_hex_format_custom ("08ll"), val_long);
       break;
     case 'g':
-      sprintf (buf, local_hex_format_custom ("016ll"),  val_long);
+      sprintf (buf, local_hex_format_custom ("016ll"), val_long);
       break;
     default:
       abort ();
@@ -492,30 +499,30 @@ strcat_longest (format, use_local, val_long, buf, buflen)
   switch (format)
     {
     case 'd':
-      sprintf (buf, (use_local ? local_decimal_format_custom ("l") : "%ld"), 
-                                                                ((long) val_long));
+      sprintf (buf, (use_local ? local_decimal_format_custom ("l") : "%ld"),
+              ((long) val_long));
       break;
     case 'u':
-      sprintf (buf, "%lu",  ((unsigned long) val_long));
+      sprintf (buf, "%lu", ((unsigned long) val_long));
       break;
     case 'x':
-      sprintf (buf, (use_local ? local_hex_format_custom ("l") : "%lx"), 
+      sprintf (buf, (use_local ? local_hex_format_custom ("l") : "%lx"),
               ((long) val_long));
       break;
     case 'o':
-      sprintf (buf, (use_local ? local_octal_format_custom ("l") : "%lo"), 
+      sprintf (buf, (use_local ? local_octal_format_custom ("l") : "%lo"),
               ((long) val_long));
       break;
     case 'b':
-      sprintf (buf, local_hex_format_custom ("02l"), 
+      sprintf (buf, local_hex_format_custom ("02l"),
               ((long) val_long));
       break;
     case 'h':
-      sprintf (buf, local_hex_format_custom ("04l"), 
+      sprintf (buf, local_hex_format_custom ("04l"),
               ((long) val_long));
       break;
     case 'w':
-      sprintf (buf, local_hex_format_custom ("08l"), 
+      sprintf (buf, local_hex_format_custom ("08l"),
               ((long) val_long));
       break;
     case 'g':
@@ -525,9 +532,10 @@ strcat_longest (format, use_local, val_long, buf, buflen)
     default:
       abort ();
     }
-    
+
 #endif /* !PRINTF_HAS_LONG_LONG */
 }
+#endif
 
 /* This used to be a macro, but I don't think it is called often enough
    to merit such treatment.  */
@@ -560,12 +568,12 @@ void
 print_floating (valaddr, type, stream)
      char *valaddr;
      struct type *type;
-     GDB_FILE *stream;
+     struct ui_file *stream;
 {
   DOUBLEST doub;
   int inv;
   unsigned len = TYPE_LENGTH (type);
-  
+
 #if defined (IEEE_FLOAT)
 
   /* Check for NaN's.  Note that this code does not depend on us being
@@ -592,7 +600,7 @@ print_floating (valaddr, type, stream)
           integer byte order.  */
        low = extract_unsigned_integer (valaddr, 4);
        nonnegative = ((low & 0x80000000) == 0);
-       is_nan = ((((low >> 23) & 0xFF) == 0xFF) 
+       is_nan = ((((low >> 23) & 0xFF) == 0xFF)
                  && 0 != (low & 0x7FFFFF));
        low &= 0x7fffff;
        high = 0;
@@ -615,14 +623,20 @@ print_floating (valaddr, type, stream)
          }
        nonnegative = ((high & 0x80000000) == 0);
        is_nan = (((high >> 20) & 0x7ff) == 0x7ff
-                 && ! ((((high & 0xfffff) == 0)) && (low == 0)));
+                 && !((((high & 0xfffff) == 0)) && (low == 0)));
        high &= 0xfffff;
       }
     else
-      /* Extended.  We can't detect NaNs for extendeds yet.  Also note
-        that currently extendeds get nuked to double in
-        REGISTER_CONVERTIBLE.  */
-      is_nan = 0;
+      {
+#ifdef TARGET_ANALYZE_FLOATING
+       TARGET_ANALYZE_FLOATING;
+#else
+       /* Extended.  We can't detect extended NaNs for this target.
+          Also note that currently extendeds get nuked to double in
+          REGISTER_CONVERTIBLE.  */
+       is_nan = 0;
+#endif 
+      }
 
     if (is_nan)
       {
@@ -631,7 +645,7 @@ print_floating (valaddr, type, stream)
           (in an implementation-defined manner) distinguish between
           signaling and quiet NaN's.  */
        if (high)
-         fprintf_filtered (stream, "-NaN(0x%lx%.8lx)" + nonnegative,
+         fprintf_filtered (stream, "-NaN(0x%lx%.8lx)" + !!nonnegative,
                            high, low);
        else
          fprintf_filtered (stream, "-NaN(0x%lx)" + nonnegative, low);
@@ -648,9 +662,9 @@ print_floating (valaddr, type, stream)
     }
 
   if (len < sizeof (double))
-    fprintf_filtered (stream, "%.9g", (double) doub);
+      fprintf_filtered (stream, "%.9g", (double) doub);
   else if (len == sizeof (double))
-    fprintf_filtered (stream, "%.17g", (double) doub);
+      fprintf_filtered (stream, "%.17g", (double) doub);
   else
 #ifdef PRINTF_HAS_LONG_DOUBLE
     fprintf_filtered (stream, "%.35Lg", doub);
@@ -660,9 +674,9 @@ print_floating (valaddr, type, stream)
 #endif
 }
 
-void 
+void
 print_binary_chars (stream, valaddr, len)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      unsigned char *valaddr;
      unsigned len;
 {
@@ -670,13 +684,13 @@ print_binary_chars (stream, valaddr, len)
 #define BITS_IN_BYTES 8
 
   unsigned char *p;
-  int            i;
-  int            b;
+  unsigned int i;
+  int b;
 
   /* Declared "int" so it will be signed.
    * This ensures that right shift will shift in zeros.
    */
-  const int      mask = 0x080;
+  const int mask = 0x080;
 
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
@@ -687,17 +701,18 @@ print_binary_chars (stream, valaddr, len)
           p < valaddr + len;
           p++)
        {
-          /* Every byte has 8 binary characters; peel off
-           * and print from the MSB end.
-           */
-          for( i = 0; i < (BITS_IN_BYTES * sizeof( *p )); i++ ) {
-              if( *p & ( mask >> i ))
-                  b = 1;
-              else
-                  b = 0;
-
-             fprintf_filtered (stream, "%1d", b);
-          }
+         /* Every byte has 8 binary characters; peel off
+          * and print from the MSB end.
+          */
+         for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
+           {
+             if (*p & (mask >> i))
+               b = 1;
+             else
+               b = 0;
+
+             fprintf_filtered (stream, "%1d", b);
+           }
        }
     }
   else
@@ -706,14 +721,15 @@ print_binary_chars (stream, valaddr, len)
           p >= valaddr;
           p--)
        {
-          for( i = 0; i < (BITS_IN_BYTES * sizeof( *p )); i++ ) {
-              if( *p & ( mask >> i ))
-                  b = 1;
-              else
-                  b = 0;
-
-             fprintf_filtered (stream, "%1d", b);
-          }
+         for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
+           {
+             if (*p & (mask >> i))
+               b = 1;
+             else
+               b = 0;
+
+             fprintf_filtered (stream, "%1d", b);
+           }
        }
     }
   fprintf_filtered (stream, local_binary_format_suffix ());
@@ -724,14 +740,14 @@ print_binary_chars (stream, valaddr, len)
  */
 void
 print_octal_chars (stream, valaddr, len)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      unsigned char *valaddr;
      unsigned len;
 {
   unsigned char *p;
   unsigned char octa1, octa2, octa3, carry;
-  int           cycle;
-  
+  int cycle;
+
   /* FIXME: We should be not printing leading zeroes in most cases.  */
 
 
@@ -767,7 +783,7 @@ print_octal_chars (stream, valaddr, len)
    */
   cycle = (len * BITS_IN_BYTES) % BITS_IN_OCTAL;
   carry = 0;
-  
+
   fprintf_filtered (stream, local_octal_format_prefix ());
   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
     {
@@ -775,47 +791,48 @@ print_octal_chars (stream, valaddr, len)
           p < valaddr + len;
           p++)
        {
-          switch (cycle) {
-              case 0:
-                 /* No carry in, carry out two bits.
-                  */
-                 octa1 = (HIGH_ZERO  & *p) >> 5;
-                 octa2 = (LOW_ZERO   & *p) >> 2;
-                 carry = (CARRY_ZERO & *p);
-                fprintf_filtered (stream, "%o", octa1);
-                fprintf_filtered (stream, "%o", octa2);
-                 break;
-
-              case 1:
-                 /* Carry in two bits, carry out one bit.
-                  */
-                 octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7);
-                 octa2 = (MID_ONE   & *p) >> 4;
-                 octa3 = (LOW_ONE   & *p) >> 1;
-                 carry = (CARRY_ONE & *p);
-                fprintf_filtered (stream, "%o", octa1);
-                fprintf_filtered (stream, "%o", octa2);
-                fprintf_filtered (stream, "%o", octa3);
-                 break;
-
-              case 2:
-                 /* Carry in one bit, no carry out.
-                  */
-                 octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6);
-                 octa2 = (MID_TWO & *p) >> 3;
-                 octa3 = (LOW_TWO & *p);
-                 carry = 0;
-                fprintf_filtered (stream, "%o", octa1);
-                fprintf_filtered (stream, "%o", octa2);
-                fprintf_filtered (stream, "%o", octa3);
-                 break;
-                 
-              default:
-                 error( "Internal error in octal conversion;" );
-          }
-
-          cycle++;
-          cycle = cycle % BITS_IN_OCTAL;
+         switch (cycle)
+           {
+           case 0:
+             /* No carry in, carry out two bits.
+              */
+             octa1 = (HIGH_ZERO & *p) >> 5;
+             octa2 = (LOW_ZERO & *p) >> 2;
+             carry = (CARRY_ZERO & *p);
+             fprintf_filtered (stream, "%o", octa1);
+             fprintf_filtered (stream, "%o", octa2);
+             break;
+
+           case 1:
+             /* Carry in two bits, carry out one bit.
+              */
+             octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7);
+             octa2 = (MID_ONE & *p) >> 4;
+             octa3 = (LOW_ONE & *p) >> 1;
+             carry = (CARRY_ONE & *p);
+             fprintf_filtered (stream, "%o", octa1);
+             fprintf_filtered (stream, "%o", octa2);
+             fprintf_filtered (stream, "%o", octa3);
+             break;
+
+           case 2:
+             /* Carry in one bit, no carry out.
+              */
+             octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6);
+             octa2 = (MID_TWO & *p) >> 3;
+             octa3 = (LOW_TWO & *p);
+             carry = 0;
+             fprintf_filtered (stream, "%o", octa1);
+             fprintf_filtered (stream, "%o", octa2);
+             fprintf_filtered (stream, "%o", octa3);
+             break;
+
+           default:
+             error ("Internal error in octal conversion;");
+           }
+
+         cycle++;
+         cycle = cycle % BITS_IN_OCTAL;
        }
     }
   else
@@ -824,44 +841,45 @@ print_octal_chars (stream, valaddr, len)
           p >= valaddr;
           p--)
        {
-          switch (cycle) {
-              case 0:
-                 /* Carry out, no carry in */
-                 octa1 = (HIGH_ZERO  & *p) >> 5;
-                 octa2 = (LOW_ZERO   & *p) >> 2;
-                 carry = (CARRY_ZERO & *p);
-                fprintf_filtered (stream, "%o", octa1);
-                fprintf_filtered (stream, "%o", octa2);
-                 break;
-
-              case 1:
-                 /* Carry in, carry out */
-                 octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7);
-                 octa2 = (MID_ONE   & *p) >> 4;
-                 octa3 = (LOW_ONE   & *p) >> 1;
-                 carry = (CARRY_ONE & *p);
-                fprintf_filtered (stream, "%o", octa1);
-                fprintf_filtered (stream, "%o", octa2);
-                fprintf_filtered (stream, "%o", octa3);
-                 break;
-
-              case 2:
-                 /* Carry in, no carry out */
-                 octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6);
-                 octa2 = (MID_TWO & *p) >> 3;
-                 octa3 = (LOW_TWO & *p);
-                 carry = 0;
-                fprintf_filtered (stream, "%o", octa1);
-                fprintf_filtered (stream, "%o", octa2);
-                fprintf_filtered (stream, "%o", octa3);
-                 break;
-                 
-              default:
-                 error( "Internal error in octal conversion;" );
-          }
-
-          cycle++;
-          cycle = cycle % BITS_IN_OCTAL;
+         switch (cycle)
+           {
+           case 0:
+             /* Carry out, no carry in */
+             octa1 = (HIGH_ZERO & *p) >> 5;
+             octa2 = (LOW_ZERO & *p) >> 2;
+             carry = (CARRY_ZERO & *p);
+             fprintf_filtered (stream, "%o", octa1);
+             fprintf_filtered (stream, "%o", octa2);
+             break;
+
+           case 1:
+             /* Carry in, carry out */
+             octa1 = (carry << 1) | ((HIGH_ONE & *p) >> 7);
+             octa2 = (MID_ONE & *p) >> 4;
+             octa3 = (LOW_ONE & *p) >> 1;
+             carry = (CARRY_ONE & *p);
+             fprintf_filtered (stream, "%o", octa1);
+             fprintf_filtered (stream, "%o", octa2);
+             fprintf_filtered (stream, "%o", octa3);
+             break;
+
+           case 2:
+             /* Carry in, no carry out */
+             octa1 = (carry << 2) | ((HIGH_TWO & *p) >> 6);
+             octa2 = (MID_TWO & *p) >> 3;
+             octa3 = (LOW_TWO & *p);
+             carry = 0;
+             fprintf_filtered (stream, "%o", octa1);
+             fprintf_filtered (stream, "%o", octa2);
+             fprintf_filtered (stream, "%o", octa3);
+             break;
+
+           default:
+             error ("Internal error in octal conversion;");
+           }
+
+         cycle++;
+         cycle = cycle % BITS_IN_OCTAL;
        }
     }
 
@@ -873,13 +891,13 @@ print_octal_chars (stream, valaddr, len)
  */
 void
 print_decimal_chars (stream, valaddr, len)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      unsigned char *valaddr;
      unsigned len;
 {
 #define TEN             10
 #define TWO_TO_FOURTH   16
-#define CARRY_OUT(  x ) ((x) / TEN)  /* extend char to int */
+#define CARRY_OUT(  x ) ((x) / TEN)    /* extend char to int */
 #define CARRY_LEFT( x ) ((x) % TEN)
 #define SHIFT( x )      ((x) << 4)
 #define START_P \
@@ -893,23 +911,24 @@ print_decimal_chars (stream, valaddr, len)
 
   unsigned char *p;
   unsigned char *digits;
-  int            carry;
-  int            decimal_len;
-  int            i, j, decimal_digits;
-  int            dummy;
-  int            flip;
-  
+  int carry;
+  int decimal_len;
+  int i, j, decimal_digits;
+  int dummy;
+  int flip;
+
   /* Base-ten number is less than twice as many digits
    * as the base 16 number, which is 2 digits per byte.
    */
   decimal_len = len * 2 * 2;
-  digits = (unsigned char *) malloc( decimal_len );
-  if( digits == NULL )
-      error( "Can't allocate memory for conversion to decimal." );
+  digits = (unsigned char *) malloc (decimal_len);
+  if (digits == NULL)
+    error ("Can't allocate memory for conversion to decimal.");
 
-  for( i = 0; i < decimal_len; i++ ) {
+  for (i = 0; i < decimal_len; i++)
+    {
       digits[i] = 0;
-  }
+    }
 
   fprintf_filtered (stream, local_decimal_format_prefix ());
 
@@ -926,38 +945,42 @@ print_decimal_chars (stream, valaddr, len)
    * Outer loop is per nibble (hex digit) of input, from MSD end to
    * LSD end.
    */
-  decimal_digits = 0;  /* Number of decimal digits so far */
+  decimal_digits = 0;          /* Number of decimal digits so far */
   p = START_P;
   flip = 0;
-  while( NOT_END_P ) {
+  while (NOT_END_P)
+    {
       /*
        * Multiply current base-ten number by 16 in place.
        * Each digit was between 0 and 9, now is between
        * 0 and 144.
        */
-      for( j = 0; j < decimal_digits; j++ ) {
-           digits[j] = SHIFT( digits[j] );
-      }
-    
+      for (j = 0; j < decimal_digits; j++)
+       {
+         digits[j] = SHIFT (digits[j]);
+       }
+
       /* Take the next nibble off the input and add it to what
        * we've got in the LSB position.  Bottom 'digit' is now
        * between 0 and 159.
        *
        * "flip" is used to run this loop twice for each byte.
        */
-      if( flip == 0 ) {
-          /* Take top nibble.
-           */
-          digits[0] += HIGH_NIBBLE( *p );
-          flip = 1;
-      }
-      else {
-          /* Take low nibble and bump our pointer "p".
-           */
-          digits[0] += LOW_NIBBLE( *p );
-          NEXT_P;
-          flip = 0;
-      }
+      if (flip == 0)
+       {
+         /* Take top nibble.
+          */
+         digits[0] += HIGH_NIBBLE (*p);
+         flip = 1;
+       }
+      else
+       {
+         /* Take low nibble and bump our pointer "p".
+          */
+         digits[0] += LOW_NIBBLE (*p);
+         NEXT_P;
+         flip = 0;
+       }
 
       /* Re-decimalize.  We have to do this often enough
        * that we don't overflow, but once per nibble is
@@ -968,39 +991,42 @@ print_decimal_chars (stream, valaddr, len)
        * the carrying beyond the last current digit.
        */
       carry = 0;
-      for( j = 0; j < decimal_len - 1; j++ ) {
-          digits[j] += carry;
-
-          /* "/" won't handle an unsigned char with
-           * a value that if signed would be negative.
-           * So extend to longword int via "dummy".
-           */
-          dummy     = digits[j];
-          carry     = CARRY_OUT(  dummy );
-          digits[j] = CARRY_LEFT( dummy );
-
-          if( j >= decimal_digits && carry == 0 ) {
-              /*
-               * All higher digits are 0 and we
-               * no longer have a carry.
-               *
-               * Note: "j" is 0-based, "decimal_digits" is
-               *       1-based.
-               */
-              decimal_digits = j + 1;
-              break;
-          }
-      }
-  }
+      for (j = 0; j < decimal_len - 1; j++)
+       {
+         digits[j] += carry;
+
+         /* "/" won't handle an unsigned char with
+          * a value that if signed would be negative.
+          * So extend to longword int via "dummy".
+          */
+         dummy = digits[j];
+         carry = CARRY_OUT (dummy);
+         digits[j] = CARRY_LEFT (dummy);
+
+         if (j >= decimal_digits && carry == 0)
+           {
+             /*
+              * All higher digits are 0 and we
+              * no longer have a carry.
+              *
+              * Note: "j" is 0-based, "decimal_digits" is
+              *       1-based.
+              */
+             decimal_digits = j + 1;
+             break;
+           }
+       }
+    }
 
   /* Ok, now "digits" is the decimal representation, with
    * the "decimal_digits" actual digits.  Print!
    */
-  for( i = decimal_digits - 1; i >= 0; i-- ) {
-      fprintf_filtered( stream, "%1d", digits[i] );
-  }
-  free( digits );
-  
+  for (i = decimal_digits - 1; i >= 0; i--)
+    {
+      fprintf_filtered (stream, "%1d", digits[i]);
+    }
+  free (digits);
+
   fprintf_filtered (stream, local_decimal_format_suffix ());
 }
 
@@ -1008,7 +1034,7 @@ print_decimal_chars (stream, valaddr, len)
 
 static void
 print_hex_chars (stream, valaddr, len)
-     GDB_FILE *stream;
+     struct ui_file *stream;
      unsigned char *valaddr;
      unsigned len;
 {
@@ -1039,13 +1065,13 @@ print_hex_chars (stream, valaddr, len)
 }
 
 /*  Called by various <lang>_val_print routines to print elements of an
-    array in the form "<elem1>, <elem2>, <elem3>, ...".
+   array in the form "<elem1>, <elem2>, <elem3>, ...".
 
-    (FIXME?)  Assumes array element separator is a comma, which is correct
-    for all languages currently handled.
-    (FIXME?)  Some languages have a notation for repeated array elements,
-    perhaps we should try to use that notation when appropriate.
   */
+   (FIXME?)  Assumes array element separator is a comma, which is correct
+   for all languages currently handled.
+   (FIXME?)  Some languages have a notation for repeated array elements,
+   perhaps we should try to use that notation when appropriate.
+ */
 
 void
 val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
@@ -1053,7 +1079,7 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
      struct type *type;
      char *valaddr;
      CORE_ADDR address;
-     GDB_FILE *stream;
+     struct ui_file *stream;
      int format;
      int deref_ref;
      int recurse;
@@ -1069,7 +1095,7 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
   unsigned int rep1;
   /* Number of repetitions we have detected so far.  */
   unsigned int reps;
-      
+
   elttype = TYPE_TARGET_TYPE (type);
   eltlen = TYPE_LENGTH (check_typedef (elttype));
   len = TYPE_LENGTH (type) / eltlen;
@@ -1094,7 +1120,7 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
 
       rep1 = i + 1;
       reps = 1;
-      while ((rep1 < len) && 
+      while ((rep1 < len) &&
             !memcmp (valaddr + i * eltlen, valaddr + rep1 * eltlen, eltlen))
        {
          ++reps;
@@ -1127,20 +1153,61 @@ val_print_array_elements (type, valaddr, address, stream, format, deref_ref,
     }
 }
 
+/* Read LEN bytes of target memory at address MEMADDR, placing the
+   results in GDB's memory at MYADDR.  Returns a count of the bytes
+   actually read, and optionally an errno value in the location
+   pointed to by ERRNOPTR if ERRNOPTR is non-null. */
+
+/* FIXME: cagney/1999-10-14: Only used by val_print_string.  Can this
+   function be eliminated.  */
+
+static int
+partial_memory_read (CORE_ADDR memaddr, char *myaddr, int len, int *errnoptr)
+{
+  int nread;                   /* Number of bytes actually read. */
+  int errcode;                 /* Error from last read. */
+
+  /* First try a complete read. */
+  errcode = target_read_memory (memaddr, myaddr, len);
+  if (errcode == 0)
+    {
+      /* Got it all. */
+      nread = len;
+    }
+  else
+    {
+      /* Loop, reading one byte at a time until we get as much as we can. */
+      for (errcode = 0, nread = 0; len > 0 && errcode == 0; nread++, len--)
+       {
+         errcode = target_read_memory (memaddr++, myaddr++, 1);
+       }
+      /* If an error, the last read was unsuccessful, so adjust count. */
+      if (errcode != 0)
+       {
+         nread--;
+       }
+    }
+  if (errnoptr != NULL)
+    {
+      *errnoptr = errcode;
+    }
+  return (nread);
+}
+
 /*  Print a string from the inferior, starting at ADDR and printing up to LEN
-    characters, of WIDTH bytes a piece, to STREAM.  If LEN is -1, printing
-    stops at the first null byte, otherwise printing proceeds (including null
-    bytes) until either print_max or LEN characters have been printed,
-    whichever is smaller. */
+   characters, of WIDTH bytes a piece, to STREAM.  If LEN is -1, printing
+   stops at the first null byte, otherwise printing proceeds (including null
+   bytes) until either print_max or LEN characters have been printed,
+   whichever is smaller. */
 
 /* FIXME: Use target_read_string.  */
 
 int
 val_print_string (addr, len, width, stream)
-    CORE_ADDR addr;
-    int len;
-    int width;
-    GDB_FILE *stream;
+     CORE_ADDR addr;
+     int len;
+     int width;
+     struct ui_file *stream;
 {
   int force_ellipsis = 0;      /* Force ellipsis to be printed if nonzero. */
   int errcode;                 /* Errno returned from bad reads. */
@@ -1150,7 +1217,7 @@ val_print_string (addr, len, width, stream)
   char *buffer = NULL;         /* Dynamically growable fetch buffer. */
   char *bufptr;                        /* Pointer to next available byte in buffer. */
   char *limit;                 /* First location past end of fetch buffer. */
-  struct cleanup *old_chain = NULL; /* Top of the old cleanup chain. */
+  struct cleanup *old_chain = NULL;    /* Top of the old cleanup chain. */
   int found_nul;               /* Non-zero if we found the nul char */
 
   /* First we need to figure out the limit on the number of characters we are
@@ -1186,7 +1253,7 @@ val_print_string (addr, len, width, stream)
       bufptr = buffer;
       old_chain = make_cleanup (free, buffer);
 
-      nfetch = target_read_memory_partial (addr, bufptr, len * width, &errcode)
+      nfetch = partial_memory_read (addr, bufptr, len * width, &errcode)
        / width;
       addr += nfetch * width;
       bufptr += nfetch * width;
@@ -1212,8 +1279,8 @@ val_print_string (addr, len, width, stream)
          bufsize += nfetch;
 
          /* Read as much as we can. */
-         nfetch = target_read_memory_partial (addr, bufptr, nfetch * width, &errcode)
-                  / width;
+         nfetch = partial_memory_read (addr, bufptr, nfetch * width, &errcode)
+           / width;
 
          /* Scan this chunk for the null byte that terminates the string
             to print.  If found, we don't need to fetch any more.  Note
@@ -1239,9 +1306,9 @@ val_print_string (addr, len, width, stream)
                }
            }
        }
-    while (errcode == 0                                      /* no error */
-          && bufptr - buffer < fetchlimit * width   /* no overrun */
-          && !found_nul);                            /* haven't found nul yet */
+      while (errcode == 0      /* no error */
+            && bufptr - buffer < fetchlimit * width    /* no overrun */
+            && !found_nul);    /* haven't found nul yet */
     }
   else
     {                          /* length of string is really 0! */
@@ -1260,8 +1327,8 @@ val_print_string (addr, len, width, stream)
       char *peekbuf;
 
       /* We didn't find a null terminator we were looking for.  Attempt
-        to peek at the next character.  If not successful, or it is not
-        a null byte, then force ellipsis to be printed.  */
+         to peek at the next character.  If not successful, or it is not
+         a null byte, then force ellipsis to be printed.  */
 
       peekbuf = (char *) alloca (width);
 
@@ -1269,11 +1336,11 @@ val_print_string (addr, len, width, stream)
          && extract_unsigned_integer (peekbuf, width) != 0)
        force_ellipsis = 1;
     }
-  else if ((len >= 0 && errcode != 0) || (len > (bufptr - buffer)/width))
+  else if ((len >= 0 && errcode != 0) || (len > (bufptr - buffer) / width))
     {
       /* Getting an error when we have a requested length, or fetching less
-        than the number of characters actually requested, always make us
-        print ellipsis. */
+         than the number of characters actually requested, always make us
+         print ellipsis. */
       force_ellipsis = 1;
     }
 
@@ -1288,7 +1355,7 @@ val_print_string (addr, len, width, stream)
        {
          fputs_filtered (" ", stream);
        }
-      LA_PRINT_STRING (stream, buffer, (bufptr - buffer)/width, width, force_ellipsis);
+      LA_PRINT_STRING (stream, buffer, (bufptr - buffer) / width, width, force_ellipsis);
     }
 
   if (errcode != 0)
@@ -1308,10 +1375,10 @@ val_print_string (addr, len, width, stream)
     }
   gdb_flush (stream);
   do_cleanups (old_chain);
-  return ((bufptr - buffer)/width);
+  return ((bufptr - buffer) / width);
 }
-
 \f
+
 /* Validate an input or output radix setting, and make sure the user
    knows what they really did here.  Radix setting is confusing, e.g.
    setting the input radix to "10" never changes it!  */
@@ -1323,7 +1390,7 @@ set_input_radix (args, from_tty, c)
      int from_tty;
      struct cmd_list_element *c;
 {
-  set_input_radix_1 (from_tty, *(unsigned *)c->var);
+  set_input_radix_1 (from_tty, *(unsigned *) c->var);
 }
 
 /* ARGSUSED */
@@ -1359,7 +1426,7 @@ set_output_radix (args, from_tty, c)
      int from_tty;
      struct cmd_list_element *c;
 {
-  set_output_radix_1 (from_tty, *(unsigned *)c->var);
+  set_output_radix_1 (from_tty, *(unsigned *) c->var);
 }
 
 static void
@@ -1372,13 +1439,13 @@ set_output_radix_1 (from_tty, radix)
   switch (radix)
     {
     case 16:
-      output_format = 'x';             /* hex */
+      output_format = 'x';     /* hex */
       break;
     case 10:
-      output_format = 0;               /* decimal */
+      output_format = 0;       /* decimal */
       break;
     case 8:
-      output_format = 'o';             /* octal */
+      output_format = 'o';     /* octal */
       break;
     default:
       error ("Unsupported output radix ``decimal %u''; output radix unchanged.",
@@ -1419,7 +1486,7 @@ set_radix (arg, from_tty)
 
 /* Show both the input and output radices. */
 
-/*ARGSUSED*/
+/*ARGSUSED */
 static void
 show_radix (arg, from_tty)
      char *arg;
@@ -1441,20 +1508,20 @@ show_radix (arg, from_tty)
        }
     }
 }
-
 \f
-/*ARGSUSED*/
+
+/*ARGSUSED */
 static void
 set_print (arg, from_tty)
      char *arg;
      int from_tty;
 {
   printf_unfiltered (
-"\"set print\" must be followed by the name of a print subcommand.\n");
+     "\"set print\" must be followed by the name of a print subcommand.\n");
   help_list (setprintlist, "set print ", -1, gdb_stdout);
 }
 
-/*ARGSUSED*/
+/*ARGSUSED */
 static void
 show_print (args, from_tty)
      char *args;
@@ -1471,18 +1538,18 @@ _initialize_valprint ()
   add_prefix_cmd ("print", no_class, set_print,
                  "Generic command for setting how things print.",
                  &setprintlist, "set print ", 0, &setlist);
-  add_alias_cmd ("p", "print", no_class, 1, &setlist); 
-  /* prefer set print to set prompt */ 
+  add_alias_cmd ("p", "print", no_class, 1, &setlist);
+  /* prefer set print to set prompt */
   add_alias_cmd ("pr", "print", no_class, 1, &setlist);
 
   add_prefix_cmd ("print", no_class, show_print,
                  "Generic command for showing print settings.",
                  &showprintlist, "show print ", 0, &showlist);
-  add_alias_cmd ("p", "print", no_class, 1, &showlist); 
-  add_alias_cmd ("pr", "print", no_class, 1, &showlist); 
+  add_alias_cmd ("p", "print", no_class, 1, &showlist);
+  add_alias_cmd ("pr", "print", no_class, 1, &showlist);
 
   add_show_from_set
-    (add_set_cmd ("elements", no_class, var_uinteger, (char *)&print_max,
+    (add_set_cmd ("elements", no_class, var_uinteger, (char *) &print_max,
                  "Set limit on string chars or array elements to print.\n\
 \"set print elements 0\" causes there to be no limit.",
                  &setprintlist),
@@ -1490,14 +1557,14 @@ _initialize_valprint ()
 
   add_show_from_set
     (add_set_cmd ("null-stop", no_class, var_boolean,
-                 (char *)&stop_print_at_null,
+                 (char *) &stop_print_at_null,
                  "Set printing of char arrays to stop at first null char.",
                  &setprintlist),
      &showprintlist);
 
   add_show_from_set
     (add_set_cmd ("repeats", no_class, var_uinteger,
-                 (char *)&repeat_count_threshold,
+                 (char *) &repeat_count_threshold,
                  "Set threshold for repeated print elements.\n\
 \"set print repeats 0\" causes all elements to be individually printed.",
                  &setprintlist),
@@ -1505,41 +1572,41 @@ _initialize_valprint ()
 
   add_show_from_set
     (add_set_cmd ("pretty", class_support, var_boolean,
-                 (char *)&prettyprint_structs,
+                 (char *) &prettyprint_structs,
                  "Set prettyprinting of structures.",
                  &setprintlist),
      &showprintlist);
 
   add_show_from_set
-    (add_set_cmd ("union", class_support, var_boolean, (char *)&unionprint,
+    (add_set_cmd ("union", class_support, var_boolean, (char *) &unionprint,
                  "Set printing of unions interior to structures.",
                  &setprintlist),
      &showprintlist);
-  
+
   add_show_from_set
     (add_set_cmd ("array", class_support, var_boolean,
-                 (char *)&prettyprint_arrays,
+                 (char *) &prettyprint_arrays,
                  "Set prettyprinting of arrays.",
                  &setprintlist),
      &showprintlist);
 
   add_show_from_set
-    (add_set_cmd ("address", class_support, var_boolean, (char *)&addressprint,
+    (add_set_cmd ("address", class_support, var_boolean, (char *) &addressprint,
                  "Set printing of addresses.",
                  &setprintlist),
      &showprintlist);
 
   c = add_set_cmd ("input-radix", class_support, var_uinteger,
-                  (char *)&input_radix,
-                 "Set default input radix for entering numbers.",
-                 &setlist);
+                  (char *) &input_radix,
+                  "Set default input radix for entering numbers.",
+                  &setlist);
   add_show_from_set (c, &showlist);
   c->function.sfunc = set_input_radix;
 
   c = add_set_cmd ("output-radix", class_support, var_uinteger,
-                  (char *)&output_radix,
-                 "Set default output radix for printing of values.",
-                 &setlist);
+                  (char *) &output_radix,
+                  "Set default output radix for printing of values.",
+                  &setlist);
   add_show_from_set (c, &showlist);
   c->function.sfunc = set_output_radix;
 
index e6edb15..5bea657 100644 (file)
@@ -1,22 +1,22 @@
 /* Declarations for value printing routines for GDB, the GNU debugger.
-   Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994
-             Free Software Foundation, Inc.
+   Copyright 1986, 1988, 1989, 1991-1994, 2000 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 
 extern int prettyprint_arrays; /* Controls pretty printing of arrays.  */
@@ -31,24 +31,27 @@ extern int objectprint;             /* Controls looking up an object's derived type
 
 extern unsigned int print_max; /* Max # of chars for strings/vectors */
 
+/* Print repeat counts if there are more than this many repetitions of an
+   element in an array.  Referenced by the low level language dependent
+   print routines. */
+extern unsigned int repeat_count_threshold;
+
 extern int output_format;
 
-extern int stop_print_at_null;  /* Stop printing at null char? */
+extern int stop_print_at_null; /* Stop printing at null char? */
+
+extern void val_print_array_elements (struct type *, char *, CORE_ADDR,
+                                     struct ui_file *, int, int, int,
+                                     enum val_prettyprint, unsigned int);
 
-extern void
-val_print_array_elements PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *,
-                                 int, int, int, enum val_prettyprint,
-                                 unsigned int));
+extern void val_print_type_code_int (struct type *, char *,
+                                    struct ui_file *);
 
-extern void
-val_print_type_code_int PARAMS ((struct type *, char *, GDB_FILE *));
+extern void print_binary_chars (struct ui_file *, unsigned char *,
+                               unsigned int);
 
-extern void
-print_binary_chars PARAMS ((GDB_FILE *, unsigned char *, unsigned int));
-extern void
-print_octal_chars PARAMS ((GDB_FILE *, unsigned char *, unsigned int));
-extern void
-print_decimal_chars PARAMS ((GDB_FILE *, unsigned char *, unsigned int));
+extern void print_octal_chars (struct ui_file *, unsigned char *,
+                              unsigned int);
 
+extern void print_decimal_chars (struct ui_file *, unsigned char *,
+                                unsigned int);