aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorPaul Richards <paul@FreeBSD.org>1993-07-26 22:40:41 +0000
committerPaul Richards <paul@FreeBSD.org>1993-07-26 22:40:41 +0000
commitadd6d758b68c58c78ecf2273701db8f60cd5ff19 (patch)
tree91d55f1400729780aed6242018963fa6f38c56fa /gnu
parentb37b9a6d2d8f98fdefaae729547cc6681bdbfcc7 (diff)
downloadsrc-add6d758b68c58c78ecf2273701db8f60cd5ff19.tar.gz
src-add6d758b68c58c78ecf2273701db8f60cd5ff19.zip
Added Charles changes for GCC@ symbols.
Notes
Notes: svn path=/head/; revision=195
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gdb/config/m-i386bsd.h5
-rw-r--r--gnu/usr.bin/gdb/dbxread.c174
-rw-r--r--gnu/usr.bin/gdb/main.c7
3 files changed, 164 insertions, 22 deletions
diff --git a/gnu/usr.bin/gdb/config/m-i386bsd.h b/gnu/usr.bin/gdb/config/m-i386bsd.h
index 15c360829d36..15d97b23d339 100644
--- a/gnu/usr.bin/gdb/config/m-i386bsd.h
+++ b/gnu/usr.bin/gdb/config/m-i386bsd.h
@@ -44,6 +44,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#endif
#define IEEE_FLOAT
+#define LONG_LONG
/* Library stuff: POSIX tty (not supported yet), V7 tty (sigh), vprintf. */
@@ -138,10 +139,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Largest integer type */
-#define LONGEST long
+#define LONGEST long long
/* Name of the builtin type for the LONGEST type above. */
-#define BUILTIN_TYPE_LONGEST builtin_type_long
+#define BUILTIN_TYPE_LONGEST builtin_type_long_long
/* Say how long (ordinary) registers are. */
diff --git a/gnu/usr.bin/gdb/dbxread.c b/gnu/usr.bin/gdb/dbxread.c
index 1e95d965b92f..7a25665536a4 100644
--- a/gnu/usr.bin/gdb/dbxread.c
+++ b/gnu/usr.bin/gdb/dbxread.c
@@ -158,6 +158,7 @@ static struct type *read_enum_type ();
static struct type *read_struct_type ();
static struct type *read_array_type ();
static long read_number ();
+static void read_huge_number ();
static void finish_block ();
static struct blockvector *make_blockvector ();
static struct symbol *define_symbol ();
@@ -5291,11 +5292,12 @@ read_range_type (pp, typenums)
char **pp;
int typenums[2];
{
- char *errp = *pp;
int rangenums[2];
- int n2, n3;
+ long n2, n3;
+ int n2bits, n3bits;
int self_subrange;
struct type *result_type;
+ struct type *index_type;
/* First comes a type we are a subrange of.
In C it is usually 0, 1 or the type being defined. */
@@ -5309,8 +5311,45 @@ read_range_type (pp, typenums)
/* The remaining two operands are usually lower and upper bounds
of the range. But in some special cases they mean something else. */
- n2 = read_number (pp, ';');
- n3 = read_number (pp, ';');
+ read_huge_number (pp, ';', &n2, &n2bits);
+ read_huge_number (pp, ';', &n3, &n3bits);
+
+ if (n2bits == -1 || n3bits == -1)
+ error ("Unrecognized type range %s.", pp);
+
+ if (n2bits != 0 || n3bits != 0)
+#ifdef LONG_LONG
+ {
+ char got_signed = 0;
+ char got_unsigned = 0;
+ /* Number of bits in the type. */
+ int nbits;
+
+ /* Range from 0 to <large number> is an unsigned large integral type. */
+ if ((n2bits == 0 && n2 == 0) && n3bits != 0)
+ {
+ got_unsigned = 1;
+ nbits = n3bits;
+ }
+ /* Range fro <large number> to <large number>-1 is a large signed
+ integral type. */
+ else if (n2bits != 0 && n3bits != 0 && n2bits == n3bits + 1)
+ {
+ got_signed = 1;
+ nbits = n2bits;
+ }
+
+ /* Check for "long long". */
+ if (got_signed && nbits == CHAR_BIT * sizeof (long long))
+ return builtin_type_long_long;
+ if (got_unsigned && nbits == CHAR_BIT * sizeof (long long))
+ return builtin_type_unsigned_long_long;
+
+ error ("Large type isn't a long long.");
+ }
+#else /* LONG_LONG */
+ error ("Type long long not supported on this machine.");
+#endif
/* A type defined as a subrange of itself, with bounds both 0, is void. */
if (self_subrange && n2 == 0 && n3 == 0)
@@ -5354,31 +5393,29 @@ read_range_type (pp, typenums)
*dbx_lookup_type (rangenums) == builtin_type_int))
{
/* an unsigned type */
-#ifdef LONG_LONG
- if (n3 == - sizeof (long long))
- return builtin_type_unsigned_long_long;
-#endif
- if (n3 == (1 << (8 * sizeof (int))) - 1)
+ if (n3 == UINT_MAX)
return builtin_type_unsigned_int;
- if (n3 == (1 << (8 * sizeof (short))) - 1)
+ if (n3 == ULONG_MAX)
+ return builtin_type_unsigned_long;
+ if (n3 == USHRT_MAX)
return builtin_type_unsigned_short;
- if (n3 == (1 << (8 * sizeof (char))) - 1)
+ if (n3 == UCHAR_MAX)
return builtin_type_unsigned_char;
}
#ifdef LONG_LONG
else if (n3 == 0 && n2 == -sizeof (long long))
return builtin_type_long_long;
-#endif
+#endif
else if (n2 == -n3 -1)
{
/* a signed type */
- if (n3 == (1 << (8 * sizeof (int) - 1)) - 1)
+ if (n3 == INT_MAX)
return builtin_type_int;
- if (n3 == (1 << (8 * sizeof (long) - 1)) - 1)
+ if (n3 == LONG_MAX)
return builtin_type_long;
- if (n3 == (1 << (8 * sizeof (short) - 1)) - 1)
+ if (n3 == SHRT_MAX)
return builtin_type_short;
- if (n3 == (1 << (8 * sizeof (char) - 1)) - 1)
+ if (n3 == CHAR_MAX)
return builtin_type_char;
}
@@ -5389,7 +5426,7 @@ read_range_type (pp, typenums)
a self_subrange type; I'm going to assume that this is used
as an idiom, and that all of them are special cases. So . . . */
if (self_subrange)
- error ("Type defined as subrange of itself.");
+ error ("Type defined as subrange of itself: %s.", pp);
result_type = (struct type *) obstack_alloc (symbol_obstack,
sizeof (struct type));
@@ -5470,6 +5507,109 @@ read_number (pp, end)
return n * sign;
}
+static void
+read_huge_number (pp, end, valu, bits)
+ char **pp;
+ int end;
+ long *valu;
+ int *bits;
+{
+ char *p = *pp;
+ int sign = 1;
+ long n = 0;
+ int radix = 10;
+ char overflow = 0;
+ int nbits = 0;
+ int c;
+ long upper_limit;
+
+ /* Handle an optional leading minus sign. */
+
+ if (*p == '-')
+ {
+ sign = -1;
+ p++;
+ }
+
+ /* Leading zero means octal. GCC uses this to output values larger
+ than an int (because that would be hard in decimal). */
+ if (*p == '0')
+ {
+ radix = 8;
+ p++;
+ }
+
+ upper_limit = LONG_MAX / radix;
+ while ((c = *p++) >= '0' && c <= '9')
+ {
+ if (n <= upper_limit)
+ {
+ n *= radix;
+ n += c - '0';
+ }
+ else
+ overflow = 1;
+
+ /* This depends on large values being output in octal, which is
+ what GCC does. */
+ if (radix == 8)
+ {
+ if (nbits == 0)
+ {
+ if (c == '0')
+ /* Ignore leading zeroes. */
+ ;
+ else if (c == '1')
+ nbits = 1;
+ else if (c == '2' || c == '3')
+ nbits = 2;
+ else
+ nbits = 3;
+ }
+ else
+ nbits += 3;
+ }
+ }
+ if (end)
+ {
+ if (c && c != end)
+ {
+ if (bits != NULL)
+ *bits = -1;
+ return;
+ }
+ }
+ else
+ --p;
+
+ *pp = p;
+ if (overflow)
+ {
+ if (nbits == 0)
+ {
+ /* Large decimal constants are an error (because it is hard to
+ count how many bits are in them). */
+ if (bits != NULL)
+ *bits = -1;
+ return;
+ }
+
+ /* -0x7f is the same as 0x80. So deal with it by adding one to
+ the number of bits. */
+ if (sign == -1)
+ ++nbits;
+ if (bits)
+ *bits = nbits;
+ }
+ else
+ {
+ if (valu)
+ *valu = n * sign;
+ if (bits)
+ *bits = 0;
+ }
+}
+
/* Read in an argument list. This is a list of types. It is terminated with
a ':', FYI. Return the list of types read in. */
static struct type **
diff --git a/gnu/usr.bin/gdb/main.c b/gnu/usr.bin/gdb/main.c
index 06e1b9c3e3fb..323de87975ad 100644
--- a/gnu/usr.bin/gdb/main.c
+++ b/gnu/usr.bin/gdb/main.c
@@ -425,14 +425,14 @@ GDB manual (available as on-line info or a printed manual).\n", stderr);
count = 0;
for (i = 1; i < argc; i++)
{
+ extern void exec_file_command (), symbol_file_command ();
+ extern void core_file_command ();
register char *arg = argv[i];
/* Args starting with - say what to do with the following arg
as a filename. */
if (arg[0] == '-')
{
- extern void exec_file_command (), symbol_file_command ();
- extern void core_file_command (), directory_command ();
- extern void tty_command ();
+ extern void tty_command (), directory_command ();
if (!strcmp (arg, "-q") || !strcmp (arg, "-nx")
|| !strcmp (arg, "-quiet") || !strcmp (arg, "-batch")
@@ -1657,6 +1657,7 @@ set_prompt_command (text)
static void
quit_command ()
{
+ extern void exec_file_command ();
if (have_inferior_p ())
{
if (inhibit_confirm || query ("The program is running. Quit anyway? "))