aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-03-03 01:00:57 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-03-03 01:00:57 +0000
commit82a2edfbcf9e89d869c4f60d82c69bc4851aa4e3 (patch)
treeb2a53ed1671d442fb77a78e2efdc662a38707038 /gdb/printcmd.c
parent4e64845ca5e5c23afd925cd780aa08884714cda9 (diff)
downloadgdb-82a2edfbcf9e89d869c4f60d82c69bc4851aa4e3.zip
gdb-82a2edfbcf9e89d869c4f60d82c69bc4851aa4e3.tar.gz
gdb-82a2edfbcf9e89d869c4f60d82c69bc4851aa4e3.tar.bz2
* breakpoint.c, breakpoint.h, c-valprint.c, ch-valprint.c,
cp-valprint.c, eval.c, expprint.c, findvar.c, language.c, objfiles.h, infcmd.c, printcmd.c, stack.c, typeprint.c, valarith.c, valops.c, valprint.c, value.h, values.c: Replace value with value_ptr. This is for the ptx compiler. * objfiles.h, target.h: Don't declare a "sec_ptr" field using a "sec_ptr" typedef. * symm-nat.c: Add a bunch of stuff for symmetry's ptrace stuff. #if 0 i386_float_info. * symm-tdep.c (round): Remove. Also remove sgttyb. * symm-tdep.c: Remove lots of stuff which duplicates stuff from i386-tdep.c. Remove register_addr and ptx_coff_regno_to_gdb. * i386-tdep.c (i386_frame_find_saved_regs): Put in I386_REGNO_TO_SYMMETRY check in case it is needed for Dynix someday. * config/i386/nm-symmetry.h: Change KERNEL_U_ADDR. Move stuff from PTRACE_READ_REGS, PTRACE_WRITE_REGS macros to symm-nat.c. Define CHILD_WAIT and declare child_wait(). * config/i386/tm-symmetry.h: Remove call function stuff; stuff in tm-i386v.h is apparently OK. * config/i386/xm-symmetry.h [_SEQUENT_]: Define HAVE_TERMIOS not HAVE_TERMIO. Define MEM_FNS_DECLARED, NEED_POSIX_SETPGID, and USE_O_NOCTTY.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c73
1 files changed, 49 insertions, 24 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index f6be184..a9fa164 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -63,7 +63,7 @@ static CORE_ADDR last_examine_address;
/* Contents of last address examined.
This is not valid past the end of the `x' command! */
-static value last_examine_value;
+static value_ptr last_examine_value;
/* Largest offset between a symbolic value and an address, that will be
printed as `0x1234 <symbol+offset>'. */
@@ -182,7 +182,7 @@ static void
do_examine PARAMS ((struct format_data, CORE_ADDR));
static void
-print_formatted PARAMS ((value, int, int));
+print_formatted PARAMS ((value_ptr, int, int));
static struct format_data
decode_format PARAMS ((char **, int, int));
@@ -227,13 +227,6 @@ decode_format (string_ptr, oformat, osize)
break;
}
-#ifndef CC_HAS_LONG_LONG
- /* Make sure 'g' size is not used on integer types.
- Well, actually, we can handle hex. */
- if (val.size == 'g' && val.format != 'f' && val.format != 'x')
- val.size = 'w';
-#endif
-
while (*p == ' ' || *p == '\t') p++;
*string_ptr = p;
@@ -256,9 +249,24 @@ decode_format (string_ptr, oformat, osize)
{
case 'a':
case 's':
- /* Addresses must be words. */
+ /* Pick the appropriate size for an address. */
+#if TARGET_PTR_BIT == 64
+ val.size = osize ? 'g' : osize;
+ break;
+#else /* Not 64 */
+#if TARGET_PTR_BIT == 32
val.size = osize ? 'w' : osize;
break;
+#else /* Not 32 */
+#if TARGET_PTR_BIT == 16
+ val.size = osize ? 'h' : osize;
+ break;
+#else /* Not 16 */
+ #error Bad value for TARGET_PTR_BIT
+#endif /* Not 16 */
+#endif /* Not 32 */
+#endif /* Not 64 */
+ break;
case 'f':
/* Floating point has to be word or giantword. */
if (osize == 'w' || osize == 'g')
@@ -288,7 +296,7 @@ decode_format (string_ptr, oformat, osize)
static void
print_formatted (val, format, size)
- register value val;
+ register value_ptr val;
register int format;
int size;
{
@@ -750,7 +758,7 @@ print_command_1 (exp, inspect, voidprint)
struct expression *expr;
register struct cleanup *old_chain = 0;
register char format = 0;
- register value val;
+ register value_ptr val;
struct format_data fmt;
int cleanup = 0;
@@ -789,7 +797,7 @@ print_command_1 (exp, inspect, voidprint)
&& ( TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT
|| TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_UNION))
{
- value v;
+ value_ptr v;
v = value_from_vtable_info (val, TYPE_TARGET_TYPE (type));
if (v != 0)
@@ -863,7 +871,7 @@ output_command (exp, from_tty)
struct expression *expr;
register struct cleanup *old_chain;
register char format = 0;
- register value val;
+ register value_ptr val;
struct format_data fmt;
if (exp && *exp == '/')
@@ -1453,7 +1461,7 @@ print_variable_value (var, frame, stream)
FRAME frame;
GDB_FILE *stream;
{
- value val = read_var_value (var, frame);
+ value_ptr val = read_var_value (var, frame);
value_print (val, stream, 0, Val_pretty_default);
}
@@ -1477,7 +1485,7 @@ print_frame_args (func, fi, num, stream)
int first = 1;
register int i;
register struct symbol *sym;
- register value val;
+ register value_ptr val;
/* Offset of next stack argument beyond the one we have seen that is
at the highest offset.
-1 if we haven't come to a stack argument yet. */
@@ -1683,14 +1691,14 @@ printf_command (arg, from_tty)
register char *f;
register char *s = arg;
char *string;
- value *val_args;
+ value_ptr *val_args;
char *substrings;
char *current_substring;
int nargs = 0;
int allocated_args = 20;
struct cleanup *old_cleanups;
- val_args = (value *) xmalloc (allocated_args * sizeof (value));
+ val_args = (value_ptr *) xmalloc (allocated_args * sizeof (value_ptr));
old_cleanups = make_cleanup (free_current_contents, &val_args);
if (s == 0)
@@ -1722,21 +1730,38 @@ printf_command (arg, from_tty)
case '\\':
*f++ = '\\';
break;
+ case 'a':
+#ifdef __STDC__
+ *f++ = '\a';
+#else
+ *f++ = '\007'; /* Bell */
+#endif
+ break;
+ case 'b':
+ *f++ = '\b';
+ break;
+ case 'f':
+ *f++ = '\f';
+ break;
case 'n':
*f++ = '\n';
break;
+ case 'r':
+ *f++ = '\r';
+ break;
case 't':
*f++ = '\t';
break;
- case 'r':
- *f++ = '\r';
+ case 'v':
+ *f++ = '\v';
break;
case '"':
*f++ = '"';
break;
default:
/* ??? TODO: handle other escape sequences */
- error ("Unrecognized \\ escape character in format string.");
+ error ("Unrecognized escape character \\%c in format string.",
+ c);
}
break;
@@ -1834,9 +1859,9 @@ printf_command (arg, from_tty)
{
char *s1;
if (nargs == allocated_args)
- val_args = (value *) xrealloc ((char *) val_args,
- (allocated_args *= 2)
- * sizeof (value));
+ val_args = (value_ptr *) xrealloc ((char *) val_args,
+ (allocated_args *= 2)
+ * sizeof (value_ptr));
s1 = s;
val_args[nargs] = parse_to_comma_and_eval (&s1);