{
if (*p == 'b' || *p == 'h' || *p == 'w' || *p == 'g')
val.size = *p++;
-#ifdef CC_HAS_LONG_LONG
- else if (*p == 'l')
- {
- val.size = 'g';
- p++;
- }
-#endif
else if (*p >= 'a' && *p <= 'z')
val.format = *p++;
else
val_long = unpack_long (type, valaddr);
- /* If value is unsigned, truncate it in case negative. */
+ /* If we are printing it as unsigned, truncate it in case it is actually
+ a negative signed value (e.g. "print/u (short)-1" should print 65535
+ (if shorts are 16 bits) instead of 4294967295). */
if (format != 'd')
{
- if (len == sizeof (char))
- val_long &= (1 << 8 * sizeof(char)) - 1;
- else if (len == sizeof (short))
- val_long &= (1 << 8 * sizeof(short)) - 1;
- else if (len == sizeof (long))
- val_long &= (unsigned long) - 1;
+ if (len < sizeof (LONGEST))
+ val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1;
}
switch (format)
#if 0 && defined (ADDR_BITS_REMOVE)
/* This is wrong for pointer to char, in which we do want to print
the low bits. */
- fprintf_filtered (stream, local_hex_format(), ADDR_BITS_REMOVE(addr));
+ fprintf_filtered (stream, local_hex_format(),
+ (unsigned long) ADDR_BITS_REMOVE(addr));
#else
- fprintf_filtered (stream, local_hex_format(), addr);
+ fprintf_filtered (stream, local_hex_format(), (unsigned long) addr);
#endif
print_address_symbolic (addr, stream, asm_demangle, " ");
}
if (addr == 0) {
fprintf_filtered (stream, "0");
} else if (addressprint) {
- fprintf_filtered (stream, local_hex_format(), addr);
+ fprintf_filtered (stream, local_hex_format(), (unsigned long) addr);
print_address_symbolic (addr, stream, do_demangle, " ");
} else {
print_address_symbolic (addr, stream, do_demangle, "");
register char format = 0;
register char size;
register int count = 1;
- struct type *val_type;
+ struct type *val_type = NULL;
register int i;
register int maxelts;
if (format == 's' || format == 'i')
size = 'b';
+ /* I don't think the TYPE_CODE, TYPE_NAME, or TYPE_FLAGS matter.
+ This is just a (fairly twisted) way of telling print_formatted
+ the right length. */
if (size == 'b')
- val_type = builtin_type_char;
+ val_type = init_type (TYPE_CODE_INT, 1, 0, NULL, NULL);
else if (size == 'h')
- val_type = builtin_type_short;
+ val_type = init_type (TYPE_CODE_INT, 2, 0, NULL, NULL);
else if (size == 'w')
- val_type = builtin_type_long;
+ val_type = init_type (TYPE_CODE_INT, 4, 0, NULL, NULL);
else if (size == 'g')
-#ifndef CC_HAS_LONG_LONG
- val_type = builtin_type_double;
-#else
- val_type = builtin_type_long_long;
-#endif
+ val_type = init_type (TYPE_CODE_INT, 8, 0, NULL, NULL);
maxelts = 8;
if (size == 'w')
printf_filtered ("\n");
fflush (stdout);
}
+ free (val_type);
}
\f
static void
if (msymbol != NULL)
printf ("Symbol \"%s\" is at %s in a file compiled without debugging.\n",
- exp, local_hex_string(SYMBOL_VALUE_ADDRESS (msymbol)));
+ exp,
+ local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (msymbol)));
else
error ("No symbol \"%s\" in current context.", exp);
return;
break;
case LOC_LABEL:
- printf ("a label at address %s", local_hex_string(SYMBOL_VALUE_ADDRESS (sym)));
+ printf ("a label at address %s",
+ local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym)));
break;
case LOC_REGISTER:
break;
case LOC_STATIC:
- printf ("static storage at address %s", local_hex_string(SYMBOL_VALUE_ADDRESS (sym)));
+ printf ("static storage at address %s",
+ local_hex_string((unsigned long) SYMBOL_VALUE_ADDRESS (sym)));
break;
case LOC_REGPARM:
printf ("an argument in register %s", reg_names[val]);
break;
- case LOC_REGPARM_ADDR:
- printf ("address of an argument in register %s", reg_names[val]);
- break;
-
+ case LOC_REGPARM_ADDR:
+ printf ("address of an argument in register %s", reg_names[val]);
+ break;
+
case LOC_ARG:
- if (SYMBOL_BASEREG_VALID (sym))
- {
- printf ("an argument at offset %ld from register %s",
- val, reg_names[basereg]);
- }
- else
- {
- printf ("an argument at offset %ld", val);
- }
+ printf ("an argument at offset %ld", val);
break;
case LOC_LOCAL_ARG:
- if (SYMBOL_BASEREG_VALID (sym))
- {
- printf ("an argument at offset %ld from register %s",
- val, reg_names[basereg]);
- }
- else
- {
- printf ("an argument at frame offset %ld", val);
- }
+ printf ("an argument at frame offset %ld", val);
break;
case LOC_LOCAL:
- if (SYMBOL_BASEREG_VALID (sym))
- {
- printf ("a local variable at offset %ld from register %s",
- val, reg_names[basereg]);
- }
- else
- {
- printf ("a local variable at frame offset %ld", val);
- }
+ printf ("a local variable at frame offset %ld", val);
break;
case LOC_REF_ARG:
printf ("a reference argument at offset %ld", val);
break;
+ case LOC_BASEREG:
+ printf ("a variable at offset %ld from register %s",
+ val, reg_names[basereg]);
+ break;
+
+ case LOC_BASEREG_ARG:
+ printf ("an argument at offset %ld from register %s",
+ val, reg_names[basereg]);
+ break;
+
case LOC_TYPEDEF:
printf ("a typedef");
break;
case LOC_BLOCK:
printf ("a function at address %s",
- local_hex_string(BLOCK_START (SYMBOL_BLOCK_VALUE (sym))));
+ local_hex_string((unsigned long) BLOCK_START (SYMBOL_BLOCK_VALUE (sym))));
break;
case LOC_OPTIMIZED_OUT:
int num;
FILE *stream;
{
- struct block *b;
+ struct block *b = NULL;
int nsyms = 0;
int first = 1;
register int i;
case LOC_REGPARM:
case LOC_REGPARM_ADDR:
case LOC_LOCAL_ARG:
+ case LOC_BASEREG_ARG:
break;
/* Other types of symbols we just skip over. */
}
}
\f
-/* Make makeva* work on an __INT_VARARGS_H machine. */
-
-#if defined (__INT_VARARGS_H)
-/* This is used on an 88k. Not sure whether it is used by anything else. */
-#define MAKEVA_END(list) \
- va_list retval; \
- retval.__va_arg = 0; \
- retval.__va_stk = (int *) (list)->aligner.arg_bytes; \
- retval.__va_reg = (int *) (list)->aligner.arg_bytes; \
- return retval;
-#endif
-\f
/* This is an interface which allows to us make a va_list. */
typedef struct {
unsigned int nargs;
unsigned int nargs;
unsigned int max_arg_size;
{
+#if defined (MAKEVA_SIZE)
+ MAKEVA_SIZE (nargs, max_arg_size);
+#else
return sizeof (makeva_list) + nargs * max_arg_size;
+#endif
}
/* Start working on LIST with NARGS arguments and whose largest
int nargs_wanted;
int lcount;
int i;
+ /* We build up a va_list to pass to vprintf. This is unnecessary;
+ instead of calling vprintf ("%d%f", <constructed va_list>) we
+ could just call printf ("%d", arg1); printf ("%f", arg2);. Funny
+ how I thought of that right *after* I got the MAKEVA stuff pretty much
+ working... */
makeva_list *args_makeva;
argclass = (enum argclass *) alloca (strlen (s) * sizeof *argclass);
argclass[nargs_wanted++] = int_arg;
f++;
}
-
+
/* Now, parse all arguments and evaluate them.
Store the VALUEs in VAL_ARGS. */
-
+
while (*s != '\0')
{
char *s1;
}
else
{
- printf_filtered ("from %s ", local_hex_string(low));
- printf_filtered ("to %s:\n", local_hex_string(high));
+ printf_filtered ("from %s ", local_hex_string((unsigned long) low));
+ printf_filtered ("to %s:\n", local_hex_string((unsigned long) high));
}
/* Dump the specified range. */