Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: "Ulrich Weigand" <uweigand@de.ibm.com>
Cc: brobecker@adacore.com (Joel Brobecker), gdb-patches@sourceware.org
Subject: Re: [RFC/RFA] add struct parse_context to all command functions
Date: Tue, 21 Oct 2008 19:33:00 -0000	[thread overview]
Message-ID: <m37i819232.fsf@fleche.redhat.com> (raw)
In-Reply-To: <200810211811.m9LIBW3I020177@d12av02.megacenter.de.ibm.com> (Ulrich Weigand's message of "Tue\, 21 Oct 2008 20\:11\:32 +0200 \(CEST\)")

[-- Attachment #1: Type: text/plain, Size: 2113 bytes --]

>>>>> "Ulrich" == Ulrich Weigand <uweigand@de.ibm.com> writes:

Ulrich> Great!  I was just about to start implementing something along those
Ulrich> lines (to pull current_gdbarch out of the print routines) ...  Do you
Ulrich> already have a version of that patch you could share?

I've been meaning to do this for a while, so I went ahead today and
updated my patch to apply to cvs trunk.

I have not written a ChangeLog entry yet, sorry.  And, I haven't sent
this through the tester yet either.  IOW, this is a raw patch, use at
your own risk, etc.

Basically I moved all print-formatting globals into a structure.  To
ensure I didn't miss anything in the value_print/val_print hierarchy,
I actually removed the globals everywhere and replaced remaining
references to them with references to user_print_options (where the
global state now resides).

A couple spots needed to make their own print-options structure; here
I made a couple of convenience functions to copy the global structure
and modify it to suit.  I wrote them to initialize an argument to
avoid any possible confusion about ownership (a previous patch had
get_raw_print_options, e.g., return a pointer to a static struct --
but this could be confusing, or even wrong if there is any recursion).

My motivation here is that I wanted to add a new value-printing flag
to control Python-based pretty-printing.  I didn't think that adding a
new enum value to val_prettyprint would yield good results; but adding
a new argument to the whole hierarchy looked ugly.  On the python
branch, I just used a global -- also ugly, but at least easy to
implement and maintain separately from the trunk.

This patch, I believe, fixes a latent bug.  print_command_1 may set
the global inspect_it, but the value is not reset on error.  I.e.,
this function is missing a cleanup.  I found this by inspection; I
haven't tried testing this theory.

Let me know what you think.  I'd like to get something along these
lines into gdb.  If this looks reasonable, I'll write a ChangeLog
entry and send it through testing.  Or, if you want changes, let me
know that.

Tom


[-- Attachment #2: the patch --]
[-- Type: application/octet-stream, Size: 176667 bytes --]

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2e29770..cbd031e 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -353,9 +353,9 @@ ada_get_gdb_completer_word_break_characters (void)
 
 static void
 ada_print_array_index (struct value *index_value, struct ui_file *stream,
-                       int format, enum val_prettyprint pretty)
+                       const struct value_print_options *options)
 {
-  LA_VALUE_PRINT (index_value, stream, format, pretty);
+  LA_VALUE_PRINT (index_value, stream, options);
   fprintf_filtered (stream, " => ");
 }
 
@@ -10060,7 +10060,7 @@ static void
 print_one_exception (enum exception_catchpoint_kind ex,
                      struct breakpoint *b, CORE_ADDR *last_addr)
 { 
-  if (addressprint)
+  if (user_print_options.addressprint)
     {
       annotate_field (4);
       ui_out_field_core_addr (uiout, "addr", b->loc->address);
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 2d13603..e65a838 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -258,11 +258,11 @@ extern void ada_print_type (struct type *, char *, struct ui_file *, int,
                             int);
 
 extern int ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-                          struct ui_file *, int, int, int,
-                          enum val_prettyprint);
+                          struct ui_file *, int,
+			  const struct value_print_options *);
 
-extern int ada_value_print (struct value *, struct ui_file *, int,
-                            enum val_prettyprint);
+extern int ada_value_print (struct value *, struct ui_file *,
+			    const struct value_print_options *);
 
                                 /* Defined in ada-lang.c */
 
@@ -275,7 +275,8 @@ extern void ada_emit_char (int, struct ui_file *, int, int);
 extern void ada_printchar (int, struct ui_file *);
 
 extern void ada_printstr (struct ui_file *, const gdb_byte *,
-			  unsigned int, int, int);
+			  unsigned int, int, int,
+			  const struct value_print_options *);
 
 struct value *ada_convert_actual (struct value *actual,
                                   struct type *formal_type0,
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index e2f7740..794f799 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -43,18 +43,17 @@ struct ada_val_print_args
   int embedded_offset;
   CORE_ADDR address;
   struct ui_file *stream;
-  int format;
-  int deref_ref;
   int recurse;
-  enum val_prettyprint pretty;
+  const struct value_print_options *options;
 };
 
 static void print_record (struct type *, const gdb_byte *, struct ui_file *,
-			  int, int, enum val_prettyprint);
+			  int, const struct value_print_options *);
 
 static int print_field_values (struct type *, const gdb_byte *,
-			       struct ui_file *, int, int,
-			       enum val_prettyprint, int, struct type *,
+			       struct ui_file *, int,
+			       const struct value_print_options *,
+			       int, struct type *,
 			       const gdb_byte *);
 
 static void adjust_type_signedness (struct type *);
@@ -62,8 +61,8 @@ static void adjust_type_signedness (struct type *);
 static int ada_val_print_stub (void *args0);
 
 static int ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR,
-			    struct ui_file *, int, int, int,
-			    enum val_prettyprint);
+			    struct ui_file *, int,
+			    const struct value_print_options *);
 \f
 
 /* Make TYPE unsigned if its range of values includes no negatives.  */
@@ -81,13 +80,14 @@ adjust_type_signedness (struct type *type)
    otherwise 0.  */
 
 static int
-print_optional_low_bound (struct ui_file *stream, struct type *type)
+print_optional_low_bound (struct ui_file *stream, struct type *type,
+			  const struct value_print_options *options)
 {
   struct type *index_type;
   long low_bound;
   long high_bound;
 
-  if (print_array_indexes_p ())
+  if (options->print_array_indexes)
     return 0;
 
   if (!get_array_bounds (type, &low_bound, &high_bound))
@@ -145,8 +145,8 @@ print_optional_low_bound (struct ui_file *stream, struct type *type)
 static void
 val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
 				 int bitoffset, struct ui_file *stream,
-				 int format, int recurse,
-				 enum val_prettyprint pretty)
+				 int recurse,
+				 const struct value_print_options *options)
 {
   unsigned int i;
   unsigned int things_printed = 0;
@@ -172,14 +172,14 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
   i = 0;
   annotate_array_section_begin (i, elttype);
 
-  while (i < len && things_printed < print_max)
+  while (i < len && things_printed < options->print_max)
     {
       struct value *v0, *v1;
       int i0;
 
       if (i != 0)
 	{
-	  if (prettyprint_arrays)
+	  if (options->prettyprint_arrays)
 	    {
 	      fprintf_filtered (stream, ",\n");
 	      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -190,7 +190,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
 	    }
 	}
       wrap_here (n_spaces (2 + 2 * recurse));
-      maybe_print_array_index (index_type, i + low, stream, format, pretty);
+      maybe_print_array_index (index_type, i + low, stream, options);
 
       i0 = i;
       v0 = ada_value_primitive_packed_val (NULL, valaddr,
@@ -210,10 +210,10 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
 	    break;
 	}
 
-      if (i - i0 > repeat_count_threshold)
+      if (i - i0 > options->repeat_count_threshold)
 	{
-	  val_print (elttype, value_contents (v0), 0, 0, stream, format,
-		     0, recurse + 1, pretty, current_language);
+	  val_print (elttype, value_contents (v0), 0, 0, stream,
+		     recurse + 1, options, current_language);
 	  annotate_elt_rep (i - i0);
 	  fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
 	  annotate_elt_rep_end ();
@@ -226,7 +226,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
 	    {
 	      if (j > i0)
 		{
-		  if (prettyprint_arrays)
+		  if (options->prettyprint_arrays)
 		    {
 		      fprintf_filtered (stream, ",\n");
 		      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -237,10 +237,10 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
 		    }
 		  wrap_here (n_spaces (2 + 2 * recurse));
 		  maybe_print_array_index (index_type, j + low,
-					   stream, format, pretty);
+					   stream, options);
 		}
-	      val_print (elttype, value_contents (v0), 0, 0, stream, format,
-			 0, recurse + 1, pretty, current_language);
+	      val_print (elttype, value_contents (v0), 0, 0, stream,
+			 recurse + 1, options, current_language);
 	      annotate_elt ();
 	    }
 	}
@@ -452,7 +452,8 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream)
 
 static void
 printstr (struct ui_file *stream, const gdb_byte *string,
-	  unsigned int length, int force_ellipses, int type_len)
+	  unsigned int length, int force_ellipses, int type_len,
+	  const struct value_print_options *options)
 {
   unsigned int i;
   unsigned int things_printed = 0;
@@ -465,7 +466,7 @@ printstr (struct ui_file *stream, const gdb_byte *string,
       return;
     }
 
-  for (i = 0; i < length && things_printed < print_max; i += 1)
+  for (i = 0; i < length && things_printed < options->print_max; i += 1)
     {
       /* Position of the character we are examining
          to see whether it is repeated.  */
@@ -491,11 +492,11 @@ printstr (struct ui_file *stream, const gdb_byte *string,
 	  reps += 1;
 	}
 
-      if (reps > repeat_count_threshold)
+      if (reps > options->repeat_count_threshold)
 	{
 	  if (in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\\", ", stream);
 	      else
 		fputs_filtered ("\", ", stream);
@@ -507,14 +508,14 @@ printstr (struct ui_file *stream, const gdb_byte *string,
 	  fputs_filtered ("'", stream);
 	  fprintf_filtered (stream, _(" <repeats %u times>"), reps);
 	  i = rep1 - 1;
-	  things_printed += repeat_count_threshold;
+	  things_printed += options->repeat_count_threshold;
 	  need_comma = 1;
 	}
       else
 	{
 	  if (!in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\\"", stream);
 	      else
 		fputs_filtered ("\"", stream);
@@ -529,7 +530,7 @@ printstr (struct ui_file *stream, const gdb_byte *string,
   /* Terminate the quotes if necessary.  */
   if (in_quotes)
     {
-      if (inspect_it)
+      if (options->inspect_it)
 	fputs_filtered ("\\\"", stream);
       else
 	fputs_filtered ("\"", stream);
@@ -541,9 +542,10 @@ printstr (struct ui_file *stream, const gdb_byte *string,
 
 void
 ada_printstr (struct ui_file *stream, const gdb_byte *string,
-	      unsigned int length, int width, int force_ellipses)
+	      unsigned int length, int width, int force_ellipses,
+	      const struct value_print_options *options)
 {
-  printstr (stream, string, length, force_ellipses, width);
+  printstr (stream, string, length, force_ellipses, width, options);
 }
 
 
@@ -569,8 +571,8 @@ ada_printstr (struct ui_file *stream, const gdb_byte *string,
 int
 ada_val_print (struct type *type, const gdb_byte *valaddr0,
 	       int embedded_offset, CORE_ADDR address,
-	       struct ui_file *stream, int format, int deref_ref,
-	       int recurse, enum val_prettyprint pretty)
+	       struct ui_file *stream, int recurse,
+	       const struct value_print_options *options)
 {
   struct ada_val_print_args args;
   args.type = type;
@@ -578,10 +580,8 @@ ada_val_print (struct type *type, const gdb_byte *valaddr0,
   args.embedded_offset = embedded_offset;
   args.address = address;
   args.stream = stream;
-  args.format = format;
-  args.deref_ref = deref_ref;
   args.recurse = recurse;
-  args.pretty = pretty;
+  args.options = options;
 
   return catch_errors (ada_val_print_stub, &args, NULL, RETURN_MASK_ALL);
 }
@@ -594,8 +594,7 @@ ada_val_print_stub (void *args0)
   struct ada_val_print_args *argsp = (struct ada_val_print_args *) args0;
   return ada_val_print_1 (argsp->type, argsp->valaddr0,
 			  argsp->embedded_offset, argsp->address,
-			  argsp->stream, argsp->format, argsp->deref_ref,
-			  argsp->recurse, argsp->pretty);
+			  argsp->stream, argsp->recurse, argsp->options);
 }
 
 /* Assuming TYPE is a simple array, print the value of this array located
@@ -605,8 +604,8 @@ ada_val_print_stub (void *args0)
 
 static int
 ada_val_print_array (struct type *type, const gdb_byte *valaddr,
-		     CORE_ADDR address, struct ui_file *stream, int format,
-		     int deref_ref, int recurse, enum val_prettyprint pretty)
+		     CORE_ADDR address, struct ui_file *stream, int recurse,
+		     const struct value_print_options *options)
 {
   struct type *elttype = TYPE_TARGET_TYPE (type);
   unsigned int eltlen;
@@ -623,40 +622,40 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
     len = TYPE_LENGTH (type) / eltlen;
 
   /* For an array of chars, print with string syntax.  */
-  if (ada_is_string_type (type) && (format == 0 || format == 's'))
+  if (ada_is_string_type (type)
+      && (options->output_format == 0 || options->output_format == 's'))
     {
-      if (prettyprint_arrays)
+      if (options->prettyprint_arrays)
         print_spaces_filtered (2 + 2 * recurse, stream);
 
       /* If requested, look for the first null char and only print
          elements up to it.  */
-      if (stop_print_at_null)
+      if (options->stop_print_at_null)
         {
           int temp_len;
 
           /* Look for a NULL char.  */
           for (temp_len = 0;
                (temp_len < len
-                && temp_len < print_max
+                && temp_len < options->print_max
                 && char_at (valaddr, temp_len, eltlen) != 0);
                temp_len += 1);
           len = temp_len;
         }
 
-      printstr (stream, valaddr, len, 0, eltlen);
+      printstr (stream, valaddr, len, 0, eltlen, options);
       result = len;
     }
   else
     {
       fprintf_filtered (stream, "(");
-      print_optional_low_bound (stream, type);
+      print_optional_low_bound (stream, type, options);
       if (TYPE_FIELD_BITSIZE (type, 0) > 0)
         val_print_packed_array_elements (type, valaddr, 0, stream,
-                                         format, recurse, pretty);
+                                         recurse, options);
       else
         val_print_array_elements (type, valaddr, address, stream,
-                                  format, deref_ref, recurse,
-                                  pretty, 0);
+                                  recurse, options, 0);
       fprintf_filtered (stream, ")");
     }
 
@@ -669,8 +668,8 @@ ada_val_print_array (struct type *type, const gdb_byte *valaddr,
 static int
 ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
 		 int embedded_offset, CORE_ADDR address,
-		 struct ui_file *stream, int format,
-		 int deref_ref, int recurse, enum val_prettyprint pretty)
+		 struct ui_file *stream, int recurse,
+		 const struct value_print_options *options)
 {
   unsigned int len;
   int i;
@@ -695,8 +694,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
 	}
       else
 	retn = ada_val_print_1 (value_type (val), value_contents (val), 0,
-				VALUE_ADDRESS (val), stream, format,
-				deref_ref, recurse, pretty);
+				VALUE_ADDRESS (val), stream, recurse, options);
       value_free_to_mark (mark);
       return retn;
     }
@@ -709,12 +707,12 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
     {
     default:
       return c_val_print (type, valaddr0, embedded_offset, address, stream,
-			  format, deref_ref, recurse, pretty);
+			  recurse, options);
 
     case TYPE_CODE_PTR:
       {
 	int ret = c_val_print (type, valaddr0, embedded_offset, address, 
-			       stream, format, deref_ref, recurse, pretty);
+			       stream, recurse, options);
 	if (ada_is_tag_type (type))
 	  {
 	    struct value *val = 
@@ -778,17 +776,16 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
 					    value_from_contents_and_address
 					    (type, valaddr, 0));
 	      return ada_val_print_1 (target_type, value_contents (v), 0, 0,
-				      stream, format, 0, recurse + 1, pretty);
+				      stream, recurse + 1, options);
 	    }
 	  else
 	    return ada_val_print_1 (TYPE_TARGET_TYPE (type),
 				    valaddr0, embedded_offset,
-				    address, stream, format, deref_ref,
-				    recurse, pretty);
+				    address, stream, recurse, options);
 	}
       else
 	{
-	  format = format ? format : output_format;
+	  int format = options->output_format;
 	  if (format)
 	    {
 	      print_scalar_formatted (valaddr, type, format, 0, stream);
@@ -830,9 +827,10 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
 	}
 
     case TYPE_CODE_ENUM:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr, type, format, 0, stream);
+	  print_scalar_formatted (valaddr, type, options->output_format,
+				  0, stream);
 	  break;
 	}
       len = TYPE_NFIELDS (type);
@@ -860,16 +858,17 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
       break;
 
     case TYPE_CODE_FLAGS:
-      if (format)
-	  print_scalar_formatted (valaddr, type, format, 0, stream);
+      if (options->output_format)
+	  print_scalar_formatted (valaddr, type, options->output_format,
+				  0, stream);
       else
 	val_print_type_code_flags (type, valaddr, stream);
       break;
 
     case TYPE_CODE_FLT:
-      if (format)
+      if (options->output_format)
 	return c_val_print (type, valaddr0, embedded_offset, address, stream,
-			    format, deref_ref, recurse, pretty);
+			    recurse, options);
       else
 	ada_print_floating (valaddr0 + embedded_offset, type, stream);
       break;
@@ -883,13 +882,13 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
 	}
       else
 	{
-	  print_record (type, valaddr, stream, format, recurse, pretty);
+	  print_record (type, valaddr, stream, recurse, options);
 	  return 0;
 	}
 
     case TYPE_CODE_ARRAY:
-      return ada_val_print_array (type, valaddr, address, stream, format,
-                                  deref_ref, recurse, pretty);
+      return ada_val_print_array (type, valaddr, address, stream,
+				  recurse, options);
 
     case TYPE_CODE_REF:
       /* For references, the debugger is expected to print the value as
@@ -910,8 +909,8 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
                                 deref_val_int));
               val_print (value_type (deref_val),
                          value_contents (deref_val), 0,
-                         VALUE_ADDRESS (deref_val), stream, format,
-                         deref_ref, recurse + 1, pretty, current_language);
+                         VALUE_ADDRESS (deref_val), stream, recurse + 1,
+			 options, current_language);
             }
           else
             fputs_filtered ("(null)", stream);
@@ -927,8 +926,8 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0,
 
 static int
 print_variant_part (struct type *type, int field_num, const gdb_byte *valaddr,
-		    struct ui_file *stream, int format, int recurse,
-		    enum val_prettyprint pretty, int comma_needed,
+		    struct ui_file *stream, int recurse,
+		    const struct value_print_options *options, int comma_needed,
 		    struct type *outer_type, const gdb_byte *outer_valaddr)
 {
   struct type *var_type = TYPE_FIELD_TYPE (type, field_num);
@@ -941,13 +940,13 @@ print_variant_part (struct type *type, int field_num, const gdb_byte *valaddr,
       (TYPE_FIELD_TYPE (var_type, which),
        valaddr + TYPE_FIELD_BITPOS (type, field_num) / HOST_CHAR_BIT
        + TYPE_FIELD_BITPOS (var_type, which) / HOST_CHAR_BIT,
-       stream, format, recurse, pretty,
+       stream, recurse, options,
        comma_needed, outer_type, outer_valaddr);
 }
 
 int
-ada_value_print (struct value *val0, struct ui_file *stream, int format,
-		 enum val_prettyprint pretty)
+ada_value_print (struct value *val0, struct ui_file *stream,
+		 const struct value_print_options *options)
 {
   const gdb_byte *valaddr = value_contents (val0);
   CORE_ADDR address = VALUE_ADDRESS (val0) + value_offset (val0);
@@ -985,20 +984,20 @@ ada_value_print (struct value *val0, struct ui_file *stream, int format,
     }
 
   return (val_print (type, value_contents (val), 0, address,
-		     stream, format, 1, 0, pretty, current_language));
+		     stream, 0, options, current_language));
 }
 
 static void
 print_record (struct type *type, const gdb_byte *valaddr,
-	      struct ui_file *stream, int format, int recurse,
-	      enum val_prettyprint pretty)
+	      struct ui_file *stream, int recurse,
+	      const struct value_print_options *options)
 {
   type = ada_check_typedef (type);
 
   fprintf_filtered (stream, "(");
 
-  if (print_field_values (type, valaddr, stream, format, recurse, pretty,
-			  0, type, valaddr) != 0 && pretty)
+  if (print_field_values (type, valaddr, stream, recurse, options,
+			  0, type, valaddr) != 0 && options->pretty)
     {
       fprintf_filtered (stream, "\n");
       print_spaces_filtered (2 * recurse, stream);
@@ -1023,8 +1022,9 @@ print_record (struct type *type, const gdb_byte *valaddr,
 
 static int
 print_field_values (struct type *type, const gdb_byte *valaddr,
-		    struct ui_file *stream, int format, int recurse,
-		    enum val_prettyprint pretty, int comma_needed,
+		    struct ui_file *stream, int recurse,
+		    const struct value_print_options *options,
+		    int comma_needed,
 		    struct type *outer_type, const gdb_byte *outer_valaddr)
 {
   int i, len;
@@ -1042,7 +1042,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
 	    print_field_values (TYPE_FIELD_TYPE (type, i),
 				valaddr
 				+ TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
-				stream, format, recurse, pretty,
+				stream, recurse, options,
 				comma_needed, type, valaddr);
 	  continue;
 	}
@@ -1050,7 +1050,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
 	{
 	  comma_needed =
 	    print_variant_part (type, i, valaddr,
-				stream, format, recurse, pretty, comma_needed,
+				stream, recurse, options, comma_needed,
 				outer_type, outer_valaddr);
 	  continue;
 	}
@@ -1059,7 +1059,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
 	fprintf_filtered (stream, ", ");
       comma_needed = 1;
 
-      if (pretty)
+      if (options->pretty)
 	{
 	  fprintf_filtered (stream, "\n");
 	  print_spaces_filtered (2 + 2 * recurse, stream);
@@ -1068,7 +1068,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
 	{
 	  wrap_here (n_spaces (2 + 2 * recurse));
 	}
-      if (inspect_it)
+      if (options->inspect_it)
 	{
 	  if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
 	    fputs_filtered ("\"( ptr \"", stream);
@@ -1115,14 +1115,13 @@ print_field_values (struct type *type, const gdb_byte *valaddr,
 						  bit_size,
 						  TYPE_FIELD_TYPE (type, i));
 	      val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
-			 stream, format, 0, recurse + 1, pretty,
-			 current_language);
+			 stream, recurse + 1, options, current_language);
 	    }
 	}
       else
 	ada_val_print (TYPE_FIELD_TYPE (type, i),
 		       valaddr + TYPE_FIELD_BITPOS (type, i) / HOST_CHAR_BIT,
-		       0, 0, stream, format, 0, recurse + 1, pretty);
+		       0, 0, stream, recurse + 1, options);
       annotate_field_end ();
     }
 
diff --git a/gdb/auxv.c b/gdb/auxv.c
index afc7fdd..ed0201c 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -172,7 +172,6 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
 
   while (target_auxv_parse (ops, &ptr, data + len, &type, &val) > 0)
     {
-      extern int addressprint;
       const char *name = "???";
       const char *description = "";
       enum { dec, hex, str } flavor = hex;
@@ -240,9 +239,9 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
 	  fprintf_filtered (file, "0x%s\n", paddr_nz (val));
 	  break;
 	case str:
-	  if (addressprint)
+	  if (user_print_options.addressprint)
 	    fprintf_filtered (file, "0x%s", paddr_nz (val));
-	  val_print_string (val, -1, 1, file);
+	  val_print_string (val, -1, 1, file, &user_print_options);
 	  fprintf_filtered (file, "\n");
 	  break;
 	}
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 180f6c9..3ca4c08 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -56,6 +56,7 @@
 #include "ada-lang.h"
 #include "top.h"
 #include "wrapper.h"
+#include "valprint.h"
 
 #include "mi/mi-common.h"
 
@@ -283,8 +284,6 @@ breakpoints_always_inserted_mode (void)
 
 void _initialize_breakpoint (void);
 
-extern int addressprint;	/* Print machine addresses? */
-
 /* Are we executing breakpoint commands?  */
 static int executing_breakpoint_commands;
 
@@ -2259,7 +2258,7 @@ watchpoint_value_print (struct value *val, struct ui_file *stream)
   if (val == NULL)
     fprintf_unfiltered (stream, _("<unreadable>"));
   else
-    value_print (val, stream, 0, Val_pretty_default);
+    value_print (val, stream, &user_print_options);
 }
 
 /* This is the normal print function for a bpstat.  In the future,
@@ -3640,7 +3639,7 @@ print_one_breakpoint_location (struct breakpoint *b,
   
   /* 5 and 6 */
   strcpy (wrap_indent, "                           ");
-  if (addressprint)
+  if (user_print_options.addressprint)
     {
       if (gdbarch_addr_bit (current_gdbarch) <= 32)
 	strcat (wrap_indent, "           ");
@@ -3672,7 +3671,7 @@ print_one_breakpoint_location (struct breakpoint *b,
 	/* Field 4, the address, is omitted (which makes the columns
 	   not line up too nicely with the headers, but the effect
 	   is relatively readable).  */
-	if (addressprint)
+	if (user_print_options.addressprint)
 	  ui_out_field_skip (uiout, "addr");
 	annotate_field (5);
 	print_expression (b->exp, stb->stream);
@@ -3684,7 +3683,7 @@ print_one_breakpoint_location (struct breakpoint *b,
 	/* Field 4, the address, is omitted (which makes the columns
 	   not line up too nicely with the headers, but the effect
 	   is relatively readable).  */
-	if (addressprint)
+	if (user_print_options.addressprint)
 	  ui_out_field_skip (uiout, "addr");
 	annotate_field (5);
 	if (b->dll_pathname == NULL)
@@ -3704,7 +3703,7 @@ print_one_breakpoint_location (struct breakpoint *b,
 	/* Field 4, the address, is omitted (which makes the columns
 	   not line up too nicely with the headers, but the effect
 	   is relatively readable).  */
-	if (addressprint)
+	if (user_print_options.addressprint)
 	  ui_out_field_skip (uiout, "addr");
 	annotate_field (5);
 	if (b->exec_pathname != NULL)
@@ -3727,7 +3726,7 @@ print_one_breakpoint_location (struct breakpoint *b,
       case bp_shlib_event:
       case bp_thread_event:
       case bp_overlay_event:
-	if (addressprint)
+	if (user_print_options.addressprint)
 	  {
 	    annotate_field (4);
 	    if (header_of_multiple)
@@ -3944,7 +3943,7 @@ breakpoint_1 (int bnum, int allflag)
 	  nr_printable_breakpoints++;
       }
 
-  if (addressprint)
+  if (user_print_options.addressprint)
     bkpttbl_chain 
       = make_cleanup_ui_out_table_begin_end (uiout, 6, nr_printable_breakpoints,
                                              "BreakpointTable");
@@ -3967,7 +3966,7 @@ breakpoint_1 (int bnum, int allflag)
   if (nr_printable_breakpoints > 0)
     annotate_field (3);
   ui_out_table_header (uiout, 3, ui_left, "enabled", "Enb");	/* 4 */
-  if (addressprint)
+  if (user_print_options.addressprint)
 	{
 	  if (nr_printable_breakpoints > 0)
 	    annotate_field (4);
@@ -4763,7 +4762,7 @@ print_one_catch_fork (struct breakpoint *b, CORE_ADDR *last_addr)
   /* Field 4, the address, is omitted (which makes the columns
      not line up too nicely with the headers, but the effect
      is relatively readable).  */
-  if (addressprint)
+  if (user_print_options.addressprint)
     ui_out_field_skip (uiout, "addr");
   annotate_field (5);
   ui_out_text (uiout, "fork");
@@ -4841,7 +4840,7 @@ print_one_catch_vfork (struct breakpoint *b, CORE_ADDR *last_addr)
   /* Field 4, the address, is omitted (which makes the columns
      not line up too nicely with the headers, but the effect
      is relatively readable).  */
-  if (addressprint)
+  if (user_print_options.addressprint)
     ui_out_field_skip (uiout, "addr");
   annotate_field (5);
   ui_out_text (uiout, "vfork");
@@ -5184,7 +5183,7 @@ mention (struct breakpoint *b)
 	}
       else
 	{
-	  if (addressprint || b->source_file == NULL)
+	  if (user_print_options.addressprint || b->source_file == NULL)
 	    {
 	      printf_filtered (" at ");
 	      fputs_filtered (paddress (b->loc->address), gdb_stdout);
@@ -6746,7 +6745,7 @@ print_exception_catchpoint (struct breakpoint *b)
 static void
 print_one_exception_catchpoint (struct breakpoint *b, CORE_ADDR *last_addr)
 {
-  if (addressprint)
+  if (user_print_options.addressprint)
     {
       annotate_field (4);
       if (b->loc == NULL || b->loc->shlib_disabled)
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index a978b17..067e429 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -86,7 +86,8 @@ c_printchar (int c, struct ui_file *stream)
 
 void
 c_printstr (struct ui_file *stream, const gdb_byte *string,
-	    unsigned int length, int width, int force_ellipses)
+	    unsigned int length, int width, int force_ellipses,
+	    const struct value_print_options *options)
 {
   unsigned int i;
   unsigned int things_printed = 0;
@@ -108,7 +109,7 @@ c_printstr (struct ui_file *stream, const gdb_byte *string,
       return;
     }
 
-  for (i = 0; i < length && things_printed < print_max; ++i)
+  for (i = 0; i < length && things_printed < options->print_max; ++i)
     {
       /* Position of the character we are examining
          to see whether it is repeated.  */
@@ -137,11 +138,11 @@ c_printstr (struct ui_file *stream, const gdb_byte *string,
 	  ++reps;
 	}
 
-      if (reps > repeat_count_threshold)
+      if (reps > options->repeat_count_threshold)
 	{
 	  if (in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\\", ", stream);
 	      else
 		fputs_filtered ("\", ", stream);
@@ -150,14 +151,14 @@ c_printstr (struct ui_file *stream, const gdb_byte *string,
 	  LA_PRINT_CHAR (current_char, stream);
 	  fprintf_filtered (stream, _(" <repeats %u times>"), reps);
 	  i = rep1 - 1;
-	  things_printed += repeat_count_threshold;
+	  things_printed += options->repeat_count_threshold;
 	  need_comma = 1;
 	}
       else
 	{
 	  if (!in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\\"", stream);
 	      else
 		fputs_filtered ("\"", stream);
@@ -171,7 +172,7 @@ c_printstr (struct ui_file *stream, const gdb_byte *string,
   /* Terminate the quotes if necessary.  */
   if (in_quotes)
     {
-      if (inspect_it)
+      if (options->inspect_it)
 	fputs_filtered ("\\\"", stream);
       else
 	fputs_filtered ("\"", stream);
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index fe1939a..cc9abde 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -40,11 +40,11 @@ extern void c_print_type (struct type *, char *, struct ui_file *, int,
 extern void c_print_typedef (struct type *, struct symbol *, struct ui_file *);
 
 extern int c_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			struct ui_file *, int, int, int,
-			enum val_prettyprint);
+			struct ui_file *, int,
+			const struct value_print_options *);
 
-extern int c_value_print (struct value *, struct ui_file *, int,
-			  enum val_prettyprint);
+extern int c_value_print (struct value *, struct ui_file *,
+			  const struct value_print_options *);
 
 /* These are in c-lang.c: */
 
@@ -52,7 +52,8 @@ extern void c_printchar (int, struct ui_file *);
 
 extern void c_printstr (struct ui_file * stream, const gdb_byte *string,
 			unsigned int length, int width,
-			int force_ellipses);
+			int force_ellipses,
+			const struct value_print_options *options);
 
 extern void scan_macro_expansion (char *expansion);
 extern int scanning_macro_expansion (void);
@@ -70,17 +71,13 @@ extern void c_type_print_base (struct type *, struct ui_file *, int, int);
 
 /* These are in cp-valprint.c */
 
-extern int vtblprint;		/* Controls printing of vtbl's */
-
-extern int static_field_print;
-
 extern void cp_print_class_member (const gdb_byte *, struct type *,
 				   struct ui_file *, char *);
 
 extern void cp_print_value_fields (struct type *, struct type *,
 				   const gdb_byte *, int, CORE_ADDR,
 				   struct ui_file *, int,
-				   int, enum val_prettyprint,
+				   const struct value_print_options *,
 				   struct type **, int);
 
 extern int cp_is_vtbl_ptr_type (struct type *);
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 1dff6cb..fb7148e 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -36,7 +36,8 @@
    stream STREAM.  */
 
 static void
-print_function_pointer_address (CORE_ADDR address, struct ui_file *stream)
+print_function_pointer_address (CORE_ADDR address, struct ui_file *stream,
+				int addressprint)
 {
   CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
 							    address,
@@ -115,8 +116,8 @@ textual_element_type (struct type *type, char format)
 
 int
 c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
-	     CORE_ADDR address, struct ui_file *stream, int format,
-	     int deref_ref, int recurse, enum val_prettyprint pretty)
+	     CORE_ADDR address, struct ui_file *stream, int recurse,
+	     const struct value_print_options *options)
 {
   unsigned int i = 0;	/* Number of characters printed */
   unsigned len;
@@ -134,29 +135,29 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	{
 	  eltlen = TYPE_LENGTH (elttype);
 	  len = TYPE_LENGTH (type) / eltlen;
-	  if (prettyprint_arrays)
+	  if (options->prettyprint_arrays)
 	    {
 	      print_spaces_filtered (2 + 2 * recurse, stream);
 	    }
 
 	  /* Print arrays of textual chars with a string syntax.  */
-          if (textual_element_type (elttype, format))
+          if (textual_element_type (elttype, options->output_format))
 	    {
 	      /* If requested, look for the first null char and only print
 	         elements up to it.  */
-	      if (stop_print_at_null)
+	      if (options->stop_print_at_null)
 		{
 		  unsigned int temp_len;
 
 		  /* Look for a NULL char. */
 		  for (temp_len = 0;
 		       (valaddr + embedded_offset)[temp_len]
-		       && temp_len < len && temp_len < print_max;
+		       && temp_len < len && temp_len < options->print_max;
 		       temp_len++);
 		  len = temp_len;
 		}
 
-	      LA_PRINT_STRING (stream, valaddr + embedded_offset, len, eltlen, 0);
+	      LA_PRINT_STRING (stream, valaddr + embedded_offset, len, eltlen, 0, options);
 	      i = len;
 	    }
 	  else
@@ -174,7 +175,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 		  i = 0;
 		}
 	      val_print_array_elements (type, valaddr + embedded_offset, address, stream,
-				     format, deref_ref, recurse, pretty, i);
+					recurse, options, i);
 	      fprintf_filtered (stream, "}");
 	    }
 	  break;
@@ -184,9 +185,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       goto print_unpacked_pointer;
 
     case TYPE_CODE_MEMBERPTR:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	  break;
 	}
       cp_print_class_member (valaddr + embedded_offset, type, stream, "&");
@@ -197,19 +199,20 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_PTR:
-      if (format && format != 's')
+      if (options->output_format && options->output_format != 's')
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	  break;
 	}
-      if (vtblprint && cp_is_vtbl_ptr_type (type))
+      if (options->vtblprint && cp_is_vtbl_ptr_type (type))
 	{
 	  /* 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.) */
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type);
-	  print_function_pointer_address (addr, stream);
+	  print_function_pointer_address (addr, stream, options->addressprint);
 	  break;
 	}
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
@@ -220,21 +223,24 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	  if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
 	    {
 	      /* Try to print what function it points to.  */
-	      print_function_pointer_address (addr, stream);
+	      print_function_pointer_address (addr, stream,
+					      options->addressprint);
 	      /* Return value is irrelevant except for string pointers.  */
 	      return (0);
 	    }
 
-	  if (addressprint)
+	  if (options->addressprint)
 	    fputs_filtered (paddress (addr), stream);
 
 	  /* For a pointer to a textual type, also print the string
 	     pointed to, unless pointer is null.  */
 	  /* FIXME: need to handle wchar_t here... */
 
-	  if (textual_element_type (elttype, format) && addr != 0)
+	  if (textual_element_type (elttype, options->output_format)
+	      && addr != 0)
 	    {
-	      i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
+	      i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream,
+				    options);
 	    }
 	  else if (cp_is_vtbl_member (type))
 	    {
@@ -250,7 +256,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 		  fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
 		  fputs_filtered (">", stream);
 		}
-	      if (vt_address && vtblprint)
+	      if (vt_address && options->vtblprint)
 		{
 		  struct value *vt_val;
 		  struct symbol *wsym = (struct symbol *) NULL;
@@ -271,10 +277,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 		      wtype = TYPE_TARGET_TYPE (type);
 		    }
 		  vt_val = value_at (wtype, vt_address);
-		  common_val_print (vt_val, stream, format,
-				    deref_ref, recurse + 1, pretty,
+		  common_val_print (vt_val, stream, recurse + 1, options,
 				    current_language);
-		  if (pretty)
+		  if (options->pretty)
 		    {
 		      fprintf_filtered (stream, "\n");
 		      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -291,17 +296,17 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 
     case TYPE_CODE_REF:
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
-      if (addressprint)
+      if (options->addressprint)
 	{
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type);
 	  fprintf_filtered (stream, "@");
 	  fputs_filtered (paddress (addr), stream);
-	  if (deref_ref)
+	  if (options->deref_ref)
 	    fputs_filtered (": ", stream);
 	}
       /* De-reference the reference.  */
-      if (deref_ref)
+      if (options->deref_ref)
 	{
 	  if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
 	    {
@@ -309,8 +314,8 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	      value_at
 	      (TYPE_TARGET_TYPE (type),
 	       unpack_pointer (type, valaddr + embedded_offset));
-	      common_val_print (deref_val, stream, format, deref_ref,
-				recurse, pretty, current_language);
+	      common_val_print (deref_val, stream, recurse, options,
+				current_language);
 	    }
 	  else
 	    fputs_filtered ("???", stream);
@@ -318,7 +323,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_UNION:
-      if (recurse && !unionprint)
+      if (recurse && !options->unionprint)
 	{
 	  fprintf_filtered (stream, "{...}");
 	  break;
@@ -326,7 +331,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       /* Fall through.  */
     case TYPE_CODE_STRUCT:
       /*FIXME: Abstract this away */
-      if (vtblprint && cp_is_vtbl_ptr_type (type))
+      if (options->vtblprint && cp_is_vtbl_ptr_type (type))
 	{
 	  /* Print the unmangled name if desired.  */
 	  /* Print vtable entry - we only get here if NOT using
@@ -337,17 +342,18 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + offset, field_type);
 
-	  print_function_pointer_address (addr, stream);
+	  print_function_pointer_address (addr, stream, options->addressprint);
 	}
       else
-	cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream, format,
-			       recurse, pretty, NULL, 0);
+	cp_print_value_fields (type, type, valaddr, embedded_offset, address, stream,
+			       recurse, options, NULL, 0);
       break;
 
     case TYPE_CODE_ENUM:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	  break;
 	}
       len = TYPE_NFIELDS (type);
@@ -371,17 +377,19 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_FLAGS:
-      if (format)
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+      if (options->output_format)
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
       else
 	val_print_type_code_flags (type, valaddr + embedded_offset, stream);
       break;
 
     case TYPE_CODE_FUNC:
     case TYPE_CODE_METHOD:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	  break;
 	}
       /* FIXME, we should consider, at least for ANSI C language, eliminating
@@ -394,9 +402,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_BOOL:
-      format = format ? format : output_format;
-      if (format)
-	print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+      if (options->output_format)
+	print_scalar_formatted (valaddr + embedded_offset, type,
+				options->output_format, 0, stream);
       else
 	{
 	  val = unpack_long (type, valaddr + embedded_offset);
@@ -420,10 +428,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       /* FALLTHROUGH */
 
     case TYPE_CODE_INT:
-      format = format ? format : output_format;
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	}
       else
 	{
@@ -432,7 +440,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	     Since we don't know whether the value is really intended to
 	     be used as an integer or a character, print the character
 	     equivalent as well.  */
-	  if (textual_element_type (type, format))
+	  if (textual_element_type (type, options->output_format))
 	    {
 	      fputs_filtered (" ", stream);
 	      LA_PRINT_CHAR ((unsigned char) unpack_long (type, valaddr + embedded_offset),
@@ -442,10 +450,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_CHAR:
-      format = format ? format : output_format;
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	}
       else
 	{
@@ -460,9 +468,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_FLT:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	}
       else
 	{
@@ -471,8 +480,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_DECFLOAT:
-      if (format)
-	print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+      if (options->output_format)
+	print_scalar_formatted (valaddr + embedded_offset, type,
+				options->output_format, 0, stream);
       else
 	print_decimal_floating (valaddr + embedded_offset, type, stream);
       break;
@@ -493,19 +503,19 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_COMPLEX:
-      if (format)
+      if (options->output_format)
 	print_scalar_formatted (valaddr + embedded_offset,
 				TYPE_TARGET_TYPE (type),
-				format, 0, stream);
+				options->output_format, 0, stream);
       else
 	print_floating (valaddr + embedded_offset, TYPE_TARGET_TYPE (type),
 			stream);
       fprintf_filtered (stream, " + ");
-      if (format)
+      if (options->output_format)
 	print_scalar_formatted (valaddr + embedded_offset
 				+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
 				TYPE_TARGET_TYPE (type),
-				format, 0, stream);
+				options->output_format, 0, stream);
       else
 	print_floating (valaddr + embedded_offset
 			+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
@@ -522,8 +532,8 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 }
 \f
 int
-c_value_print (struct value *val, struct ui_file *stream, int format,
-	       enum val_prettyprint pretty)
+c_value_print (struct value *val, struct ui_file *stream, 
+	       const struct value_print_options *options)
 {
   struct type *type, *real_type;
   int full, top, using_enc;
@@ -551,7 +561,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
 	{
 	  /* Print nothing */
 	}
-      else if (objectprint && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
+      else if (options->objectprint
+	       && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
 	{
 
 	  if (TYPE_CODE(type) == TYPE_CODE_REF)
@@ -602,7 +613,7 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
   if (!value_initialized (val))
     fprintf_filtered (stream, " [uninitialized] ");
 
-  if (objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS))
+  if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_CLASS))
     {
       /* Attempt to determine real type of object */
       real_type = value_rtti_type (val, &full, &top, &using_enc);
@@ -616,8 +627,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
 	  /* 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, current_language);
+			    VALUE_ADDRESS (val), stream, 0,
+			    options, current_language);
           /* Note: When we look up RTTI entries, we don't get any information on
              const or volatile attributes */
 	}
@@ -628,8 +639,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
 			    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, current_language);
+			    VALUE_ADDRESS (val), stream, 0,
+			    options, current_language);
 	}
       /* Otherwise, we end up at the return outside this "if" */
     }
@@ -637,5 +648,5 @@ c_value_print (struct value *val, struct ui_file *stream, int format,
   return val_print (type, value_contents_all (val),
 		    value_embedded_offset (val),
 		    VALUE_ADDRESS (val) + value_offset (val),
-		    stream, format, 1, 0, pretty, current_language);
+		    stream, 0, options, current_language);
 }
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 61559af..bbb7689 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -38,7 +38,6 @@
 #include "language.h"
 
 /* Controls printing of vtbl's */
-int vtblprint;
 static void
 show_vtblprint (struct ui_file *file, int from_tty,
 		struct cmd_list_element *c, const char *value)
@@ -50,7 +49,6 @@ Printing of C++ virtual function tables is %s.\n"),
 
 /* Controls looking up an object's derived type using what we find in
    its vtables.  */
-int objectprint;
 static void
 show_objectprint (struct ui_file *file, int from_tty,
 		  struct cmd_list_element *c,
@@ -61,7 +59,6 @@ Printing of object's derived type based on vtable info is %s.\n"),
 		    value);
 }
 
-int static_field_print;		/* Controls printing of static fields. */
 static void
 show_static_field_print (struct ui_file *file, int from_tty,
 			 struct cmd_list_element *c, const char *value)
@@ -77,12 +74,12 @@ static struct obstack dont_print_statmem_obstack;
 extern void _initialize_cp_valprint (void);
 
 static void cp_print_static_field (struct type *, struct value *,
-				   struct ui_file *, int, int,
-				   enum val_prettyprint);
+				   struct ui_file *, int,
+				   const struct value_print_options *);
 
 static void cp_print_value (struct type *, struct type *, const gdb_byte *,
-			    int, CORE_ADDR, struct ui_file *, int, int,
-			    enum val_prettyprint, struct type **);
+			    int, CORE_ADDR, struct ui_file *, int,
+			    const struct value_print_options *, struct type **);
 
 
 /* GCC versions after 2.4.5 use this.  */
@@ -151,9 +148,9 @@ cp_is_vtbl_member (struct type *type)
 void
 cp_print_value_fields (struct type *type, struct type *real_type,
 		       const gdb_byte *valaddr, int offset, CORE_ADDR address,
-		       struct ui_file *stream, int format, int recurse,
-		       enum val_prettyprint pretty,
-		       struct type **dont_print_vb,int dont_print_statmem)
+		       struct ui_file *stream, int recurse,
+		       const struct value_print_options *options,
+		       struct type **dont_print_vb, int dont_print_statmem)
 {
   int i, len, n_baseclasses;
   char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
@@ -170,7 +167,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 
   if (n_baseclasses > 0)
     cp_print_value (type, real_type, valaddr, offset, address, stream,
-		    format, recurse + 1, pretty, dont_print_vb);
+		    recurse + 1, options, dont_print_vb);
 
   /* Second, print out data fields */
 
@@ -192,7 +189,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
       for (i = n_baseclasses; i < len; i++)
 	{
 	  /* If requested, skip printing of static fields.  */
-	  if (!static_field_print
+	  if (!options->static_field_print
 	      && field_is_static (&TYPE_FIELD (type, i)))
 	    continue;
 
@@ -200,7 +197,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 	    fprintf_filtered (stream, ", ");
 	  else if (n_baseclasses > 0)
 	    {
-	      if (pretty)
+	      if (options->pretty)
 		{
 		  fprintf_filtered (stream, "\n");
 		  print_spaces_filtered (2 + 2 * recurse, stream);
@@ -211,7 +208,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 	    }
 	  fields_seen = 1;
 
-	  if (pretty)
+	  if (options->pretty)
 	    {
 	      fprintf_filtered (stream, "\n");
 	      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -220,7 +217,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 	    {
 	      wrap_here (n_spaces (2 + 2 * recurse));
 	    }
-	  if (inspect_it)
+	  if (options->inspect_it)
 	    {
 	      if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
 		fputs_filtered ("\"( ptr \"", stream);
@@ -270,7 +267,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 		    (TYPE_FIELD_TYPE (type, i), 
 		     unpack_field_as_long (type, valaddr + offset, i));
 
-		  common_val_print (v, stream, format, 0, recurse + 1, pretty,
+		  common_val_print (v, stream, recurse + 1, options,
 				    current_language);
 		}
 	    }
@@ -287,15 +284,14 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 		    fputs_filtered ("<optimized out>", stream);
 		  else
 		    cp_print_static_field (TYPE_FIELD_TYPE (type, i), v,
-					   stream, format, recurse + 1,
-					   pretty);
+					   stream, recurse + 1, options);
 		}
 	      else
 		{
 		  val_print (TYPE_FIELD_TYPE (type, i),
 			     valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8,
 			     address + TYPE_FIELD_BITPOS (type, i) / 8,
-			     stream, format, 0, recurse + 1, pretty,
+			     stream, recurse + 1, options,
 			     current_language);
 		}
 	    }
@@ -310,7 +306,7 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 	  dont_print_statmem_obstack = tmp_obstack;
 	}
 
-      if (pretty)
+      if (options->pretty)
 	{
 	  fprintf_filtered (stream, "\n");
 	  print_spaces_filtered (2 * recurse, stream);
@@ -326,8 +322,9 @@ cp_print_value_fields (struct type *type, struct type *real_type,
 static void
 cp_print_value (struct type *type, struct type *real_type,
 		const gdb_byte *valaddr, int offset, CORE_ADDR address,
-		struct ui_file *stream, int format, int recurse,
-		enum val_prettyprint pretty, struct type **dont_print_vb)
+		struct ui_file *stream, int recurse,
+		const struct value_print_options *options,
+		struct type **dont_print_vb)
 {
   struct type **last_dont_print
     = (struct type **) obstack_next_free (&dont_print_vb_obstack);
@@ -402,7 +399,7 @@ cp_print_value (struct type *type, struct type *real_type,
 	base_valaddr = valaddr;
 
       /* now do the printing */
-      if (pretty)
+      if (options->pretty)
 	{
 	  fprintf_filtered (stream, "\n");
 	  print_spaces_filtered (2 * recurse, stream);
@@ -419,8 +416,7 @@ cp_print_value (struct type *type, struct type *real_type,
       else
 	cp_print_value_fields (baseclass, thistype, base_valaddr,
 			       thisoffset + boffset, address + boffset,
-			       stream, format,
-			       recurse, pretty,
+			       stream, recurse, options,
 			       ((struct type **)
 				obstack_base (&dont_print_vb_obstack)),
 			       0);
@@ -454,9 +450,8 @@ static void
 cp_print_static_field (struct type *type,
 		       struct value *val,
 		       struct ui_file *stream,
-		       int format,
 		       int recurse,
-		       enum val_prettyprint pretty)
+		       const struct value_print_options *options)
 {
   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
     {
@@ -485,12 +480,12 @@ cp_print_static_field (struct type *type,
       CHECK_TYPEDEF (type);
       cp_print_value_fields (type, type, value_contents_all (val),
 			     value_embedded_offset (val), VALUE_ADDRESS (val),
-			     stream, format, recurse, pretty, NULL, 1);
+			     stream, recurse, options, NULL, 1);
       return;
     }
   val_print (type, value_contents_all (val), 
 	     value_embedded_offset (val), VALUE_ADDRESS (val),
-	     stream, format, 0, recurse, pretty, current_language);
+	     stream, recurse, options, current_language);
 }
 
 
@@ -589,32 +584,29 @@ void
 _initialize_cp_valprint (void)
 {
   add_setshow_boolean_cmd ("static-members", class_support,
-			   &static_field_print, _("\
+			   &user_print_options.static_field_print, _("\
 Set printing of C++ static members."), _("\
 Show printing of C++ static members."), NULL,
 			   NULL,
 			   show_static_field_print,
 			   &setprintlist, &showprintlist);
-  /* Turn on printing of static fields.  */
-  static_field_print = 1;
 
-  add_setshow_boolean_cmd ("vtbl", class_support, &vtblprint, _("\
+  add_setshow_boolean_cmd ("vtbl", class_support,
+			   &user_print_options.vtblprint, _("\
 Set printing of C++ virtual function tables."), _("\
 Show printing of C++ virtual function tables."), NULL,
 			   NULL,
 			   show_vtblprint,
 			   &setprintlist, &showprintlist);
 
-  add_setshow_boolean_cmd ("object", class_support, &objectprint, _("\
+  add_setshow_boolean_cmd ("object", class_support,
+			   &user_print_options.objectprint, _("\
 Set printing of object's derived type based on vtable info."), _("\
 Show printing of object's derived type based on vtable info."), NULL,
 			   NULL,
 			   show_objectprint,
 			   &setprintlist, &showprintlist);
 
-  /* Give people the defaults which they are used to.  */
-  objectprint = 0;
-  vtblprint = 0;
   obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
   obstack_specify_allocation (&dont_print_statmem_obstack,
 			      32 * sizeof (CORE_ADDR), sizeof (CORE_ADDR),
diff --git a/gdb/eval.c b/gdb/eval.c
index cf3e876..bc07658 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -39,16 +39,13 @@
 #include "exceptions.h"
 #include "regcache.h"
 #include "user-regs.h"
+#include "valprint.h"
 
 #include "gdb_assert.h"
 
 /* This is defined in valops.c */
 extern int overload_resolution;
 
-/* JYG: lookup rtti type of STRUCTOP_PTR when this is set to continue
-   on with successful lookup for member/method of the rtti type. */
-extern int objectprint;
-
 /* Prototypes for local functions. */
 
 static struct value *evaluate_subexp_for_sizeof (struct expression *, int *);
@@ -1629,7 +1626,7 @@ evaluate_subexp_standard (struct type *expect_type,
         struct type *real_type;
         int full, top, using_enc;
         
-        if (objectprint && TYPE_TARGET_TYPE(type) &&
+        if (user_print_options.objectprint && TYPE_TARGET_TYPE(type) &&
             (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
           {
             real_type = value_rtti_target_type (arg1, &full, &top, &using_enc);
diff --git a/gdb/expprint.c b/gdb/expprint.c
index 079f2a9..ce65a81 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -31,6 +31,7 @@
 #include "block.h"
 #include "objfiles.h"
 #include "gdb_assert.h"
+#include "valprint.h"
 
 #ifdef HAVE_CTYPE_H
 #include <ctype.h>
@@ -92,17 +93,25 @@ print_subexp_standard (struct expression *exp, int *pos,
       return;
 
     case OP_LONG:
-      (*pos) += 3;
-      value_print (value_from_longest (exp->elts[pc + 1].type,
-				       exp->elts[pc + 2].longconst),
-		   stream, 0, Val_no_prettyprint);
+      {
+	struct value_print_options opts;
+	get_raw_print_options (&opts);
+	(*pos) += 3;
+	value_print (value_from_longest (exp->elts[pc + 1].type,
+					 exp->elts[pc + 2].longconst),
+		     stream, &opts);
+      }
       return;
 
     case OP_DOUBLE:
-      (*pos) += 3;
-      value_print (value_from_double (exp->elts[pc + 1].type,
-				      exp->elts[pc + 2].doubleconst),
-		   stream, 0, Val_no_prettyprint);
+      {
+	struct value_print_options opts;
+	get_raw_print_options (&opts);
+	(*pos) += 3;
+	value_print (value_from_double (exp->elts[pc + 1].type,
+					exp->elts[pc + 2].doubleconst),
+		     stream, &opts);
+      }
       return;
 
     case OP_VAR_VALUE:
@@ -174,7 +183,8 @@ print_subexp_standard (struct expression *exp, int *pos,
       /* LA_PRINT_STRING will print using the current repeat count threshold.
          If necessary, we can temporarily set it to zero, or pass it as an
          additional parameter to LA_PRINT_STRING.  -fnf */
-      LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
+      LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0,
+		       &user_print_options);
       return;
 
     case OP_BITSTRING:
@@ -188,7 +198,8 @@ print_subexp_standard (struct expression *exp, int *pos,
       nargs = longest_to_int (exp->elts[pc + 1].longconst);
       (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
       fputs_filtered ("@\"", stream);
-      LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0);
+      LA_PRINT_STRING (stream, &exp->elts[pc + 2].string, nargs, 1, 0,
+		       &user_print_options);
       fputs_filtered ("\"", stream);
       return;
 
@@ -270,7 +281,8 @@ print_subexp_standard (struct expression *exp, int *pos,
 	}
       if (tem > 0)
 	{
-	  LA_PRINT_STRING (stream, tempstr, nargs - 1, 1, 0);
+	  LA_PRINT_STRING (stream, tempstr, nargs - 1, 1, 0,
+			   &user_print_options);
 	  (*pos) = pc;
 	}
       else
@@ -394,6 +406,8 @@ print_subexp_standard (struct expression *exp, int *pos,
       if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC &&
 	  exp->elts[pc + 3].opcode == OP_LONG)
 	{
+	  struct value_print_options opts;
+
 	  /* We have a minimal symbol fn, probably.  It's encoded
 	     as a UNOP_MEMVAL (function-type) of an OP_LONG (int, address).
 	     Swallow the OP_LONG (including both its opcodes); ignore
@@ -401,7 +415,8 @@ print_subexp_standard (struct expression *exp, int *pos,
 	  (*pos) += 4;
 	  val = value_at_lazy (exp->elts[pc + 1].type,
 			       (CORE_ADDR) exp->elts[pc + 5].longconst);
-	  value_print (val, stream, 0, Val_no_prettyprint);
+	  get_raw_print_options (&opts);
+	  value_print (val, stream, &opts);
 	}
       else
 	{
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index 736d6c6..4d4d4d7 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -142,7 +142,8 @@ f_printchar (int c, struct ui_file *stream)
 
 static void
 f_printstr (struct ui_file *stream, const gdb_byte *string,
-	    unsigned int length, int width, int force_ellipses)
+	    unsigned int length, int width, int force_ellipses,
+	    const struct value_print_options *options)
 {
   unsigned int i;
   unsigned int things_printed = 0;
@@ -155,7 +156,7 @@ f_printstr (struct ui_file *stream, const gdb_byte *string,
       return;
     }
 
-  for (i = 0; i < length && things_printed < print_max; ++i)
+  for (i = 0; i < length && things_printed < options->print_max; ++i)
     {
       /* Position of the character we are examining
          to see whether it is repeated.  */
@@ -179,11 +180,11 @@ f_printstr (struct ui_file *stream, const gdb_byte *string,
 	  ++reps;
 	}
 
-      if (reps > repeat_count_threshold)
+      if (reps > options->repeat_count_threshold)
 	{
 	  if (in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\', ", stream);
 	      else
 		fputs_filtered ("', ", stream);
@@ -192,14 +193,14 @@ f_printstr (struct ui_file *stream, const gdb_byte *string,
 	  f_printchar (string[i], stream);
 	  fprintf_filtered (stream, " <repeats %u times>", reps);
 	  i = rep1 - 1;
-	  things_printed += repeat_count_threshold;
+	  things_printed += options->repeat_count_threshold;
 	  need_comma = 1;
 	}
       else
 	{
 	  if (!in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\'", stream);
 	      else
 		fputs_filtered ("'", stream);
@@ -213,7 +214,7 @@ f_printstr (struct ui_file *stream, const gdb_byte *string,
   /* Terminate the quotes if necessary.  */
   if (in_quotes)
     {
-      if (inspect_it)
+      if (options->inspect_it)
 	fputs_filtered ("\\'", stream);
       else
 	fputs_filtered ("'", stream);
@@ -305,8 +306,8 @@ f_language_arch_info (struct gdbarch *gdbarch,
 
 /* 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 (struct value *, struct ui_file *, int,
-			  enum val_prettyprint);
+extern int c_value_print (struct value *, struct ui_file *,
+			  const struct value_print_options *);
 
 const struct language_defn f_language_defn =
 {
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 252d25d..3b3487e 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -29,8 +29,8 @@ extern void f_print_type (struct type *, char *, struct ui_file *, int,
 			  int);
 
 extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			struct ui_file *, int, int, int,
-			enum val_prettyprint);
+			struct ui_file *, int,
+			const struct value_print_options *);
 
 /* Language-specific data structures */
 
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 672e95c..3fae0a7 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -164,42 +164,42 @@ f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream)
 static void
 f77_print_array_1 (int nss, int ndimensions, struct type *type,
 		   const gdb_byte *valaddr, CORE_ADDR address,
-		   struct ui_file *stream, int format,
-		   int deref_ref, int recurse, enum val_prettyprint pretty,
+		   struct ui_file *stream, int recurse,
+		   const struct value_print_options *options,
 		   int *elts)
 {
   int i;
 
   if (nss != ndimensions)
     {
-      for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < print_max); i++)
+      for (i = 0; (i < F77_DIM_SIZE (nss) && (*elts) < options->print_max); i++)
 	{
 	  fprintf_filtered (stream, "( ");
 	  f77_print_array_1 (nss + 1, ndimensions, TYPE_TARGET_TYPE (type),
 			     valaddr + i * F77_DIM_OFFSET (nss),
 			     address + i * F77_DIM_OFFSET (nss),
-			     stream, format, deref_ref, recurse, pretty, elts);
+			     stream, recurse, options, elts);
 	  fprintf_filtered (stream, ") ");
 	}
-      if (*elts >= print_max && i < F77_DIM_SIZE (nss)) 
+      if (*elts >= options->print_max && i < F77_DIM_SIZE (nss)) 
 	fprintf_filtered (stream, "...");
     }
   else
     {
-      for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < print_max; 
+      for (i = 0; i < F77_DIM_SIZE (nss) && (*elts) < options->print_max;
 	   i++, (*elts)++)
 	{
 	  val_print (TYPE_TARGET_TYPE (type),
 		     valaddr + i * F77_DIM_OFFSET (ndimensions),
 		     0,
 		     address + i * F77_DIM_OFFSET (ndimensions),
-		     stream, format, deref_ref, recurse, pretty,
-		     current_language);
+		     stream, recurse, options, current_language);
 
 	  if (i != (F77_DIM_SIZE (nss) - 1))
 	    fprintf_filtered (stream, ", ");
 
-	  if ((*elts == print_max - 1) && (i != (F77_DIM_SIZE (nss) - 1)))
+	  if ((*elts == options->print_max - 1)
+	      && (i != (F77_DIM_SIZE (nss) - 1)))
 	    fprintf_filtered (stream, "...");
 	}
     }
@@ -211,8 +211,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type,
 static void
 f77_print_array (struct type *type, const gdb_byte *valaddr,
 		 CORE_ADDR address, struct ui_file *stream,
-		 int format, int deref_ref, int recurse,
-		 enum val_prettyprint pretty)
+		 int recurse, const struct value_print_options *options)
 {
   int ndimensions;
   int elts = 0;
@@ -229,8 +228,8 @@ f77_print_array (struct type *type, const gdb_byte *valaddr,
 
   f77_create_arrayprint_offset_tbl (type, stream);
 
-  f77_print_array_1 (1, ndimensions, type, valaddr, address, stream, format,
-		     deref_ref, recurse, pretty, &elts);
+  f77_print_array_1 (1, ndimensions, type, valaddr, address, stream,
+		     recurse, options, &elts);
 }
 \f
 
@@ -249,8 +248,8 @@ f77_print_array (struct type *type, const gdb_byte *valaddr,
 
 int
 f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
-	     CORE_ADDR address, struct ui_file *stream, int format,
-	     int deref_ref, int recurse, enum val_prettyprint pretty)
+	     CORE_ADDR address, struct ui_file *stream, int recurse,
+	     const struct value_print_options *options)
 {
   unsigned int i = 0;	/* Number of characters printed */
   struct type *elttype;
@@ -263,20 +262,20 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
     {
     case TYPE_CODE_STRING:
       f77_get_dynamic_length_of_aggregate (type);
-      LA_PRINT_STRING (stream, valaddr, TYPE_LENGTH (type), 1, 0);
+      LA_PRINT_STRING (stream, valaddr, TYPE_LENGTH (type), 1, 0, options);
       break;
 
     case TYPE_CODE_ARRAY:
       fprintf_filtered (stream, "(");
-      f77_print_array (type, valaddr, address, stream, format,
-		       deref_ref, recurse, pretty);
+      f77_print_array (type, valaddr, address, stream, recurse, options);
       fprintf_filtered (stream, ")");
       break;
 
     case TYPE_CODE_PTR:
-      if (format && format != 's')
+      if (options->output_format && options->output_format != 's')
 	{
-	  print_scalar_formatted (valaddr, type, format, 0, stream);
+	  print_scalar_formatted (valaddr, type, options->output_format,
+				  0, stream);
 	  break;
 	}
       else
@@ -292,16 +291,17 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	      return 0;
 	    }
 
-	  if (addressprint && format != 's')
+	  if (options->addressprint && options->output_format != 's')
 	    fputs_filtered (paddress (addr), stream);
 
 	  /* For a pointer to char or unsigned char, also print the string
 	     pointed to, unless pointer is null.  */
 	  if (TYPE_LENGTH (elttype) == 1
 	      && TYPE_CODE (elttype) == TYPE_CODE_INT
-	      && (format == 0 || format == 's')
+	      && (options->output_format == 0 || options->output_format == 's')
 	      && addr != 0)
-	    i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
+	    i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream,
+				  options);
 
 	  /* Return number of characters printed, including the terminating
 	     '\0' if we reached the end.  val_print_string takes care including
@@ -312,17 +312,17 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 
     case TYPE_CODE_REF:
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
-      if (addressprint)
+      if (options->addressprint)
 	{
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type);
 	  fprintf_filtered (stream, "@");
 	  fputs_filtered (paddress (addr), stream);
-	  if (deref_ref)
+	  if (options->deref_ref)
 	    fputs_filtered (": ", stream);
 	}
       /* De-reference the reference.  */
-      if (deref_ref)
+      if (options->deref_ref)
 	{
 	  if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
 	    {
@@ -330,8 +330,8 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	      value_at
 	      (TYPE_TARGET_TYPE (type),
 	       unpack_pointer (type, valaddr + embedded_offset));
-	      common_val_print (deref_val, stream, format, deref_ref, recurse,
-				pretty, current_language);
+	      common_val_print (deref_val, stream, recurse,
+				options, current_language);
 	    }
 	  else
 	    fputs_filtered ("???", stream);
@@ -339,9 +339,10 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_FUNC:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr, type, format, 0, stream);
+	  print_scalar_formatted (valaddr, type, options->output_format,
+				  0, stream);
 	  break;
 	}
       /* FIXME, we should consider, at least for ANSI C language, eliminating
@@ -354,9 +355,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_INT:
-      format = format ? format : output_format;
-      if (format)
-	print_scalar_formatted (valaddr, type, format, 0, stream);
+      if (options->output_format)
+	print_scalar_formatted (valaddr, type, options->output_format,
+				0, stream);
       else
 	{
 	  val_print_type_code_int (type, valaddr, stream);
@@ -374,15 +375,17 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_FLAGS:
-      if (format)
-	  print_scalar_formatted (valaddr, type, format, 0, stream);
+      if (options->output_format)
+	  print_scalar_formatted (valaddr, type, options->output_format,
+				  0, stream);
       else
 	val_print_type_code_flags (type, valaddr, stream);
       break;
 
     case TYPE_CODE_FLT:
-      if (format)
-	print_scalar_formatted (valaddr, type, format, 0, stream);
+      if (options->output_format)
+	print_scalar_formatted (valaddr, type, options->output_format,
+				0, stream);
       else
 	print_floating (valaddr, type, stream);
       break;
@@ -401,9 +404,9 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_BOOL:
-      format = format ? format : output_format;
-      if (format)
-	print_scalar_formatted (valaddr, type, format, 0, stream);
+      if (options->output_format)
+	print_scalar_formatted (valaddr, type, options->output_format,
+				0, stream);
       else
 	{
 	  val = extract_unsigned_integer (valaddr, TYPE_LENGTH (type));
@@ -417,8 +420,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	    {
 	      /* Bash the type code temporarily.  */
 	      TYPE_CODE (type) = TYPE_CODE_INT;
-	      f_val_print (type, valaddr, 0, address, stream, format,
-			   deref_ref, recurse, pretty);
+	      f_val_print (type, valaddr, 0, address, stream, recurse, options);
 	      /* Restore the type code so later uses work as intended. */
 	      TYPE_CODE (type) = TYPE_CODE_BOOL;
 	    }
@@ -450,8 +452,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
         {
           int offset = TYPE_FIELD_BITPOS (type, index) / 8;
           f_val_print (TYPE_FIELD_TYPE (type, index), valaddr + offset,
-                       embedded_offset, address, stream,
-                       format, deref_ref, recurse, pretty);
+                       embedded_offset, address, stream, recurse, options);
           if (index != TYPE_NFIELDS (type) - 1)
             fputs_filtered (", ", stream);
         }
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 4f55c33..f475330 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -51,6 +51,7 @@
 #include "exceptions.h"
 #include "cli/cli-decode.h"
 #include "gdbthread.h"
+#include "valprint.h"
 
 /* Functions exported for general use, in inferior.h: */
 
@@ -1282,6 +1283,8 @@ print_return_value (struct type *func_type, struct type *value_type)
 
   if (value)
     {
+      struct value_print_options opts;
+
       /* Print it.  */
       stb = ui_out_stream_new (uiout);
       old_chain = make_cleanup_ui_out_stream_delete (stb);
@@ -1289,7 +1292,8 @@ print_return_value (struct type *func_type, struct type *value_type)
       ui_out_field_fmt (uiout, "gdb-result-var", "$%d",
 			record_latest_value (value));
       ui_out_text (uiout, " = ");
-      value_print (value, stb->stream, 0, Val_no_prettyprint);
+      get_raw_print_options (&opts);
+      value_print (value, stb->stream, &opts);
       ui_out_field_stream (uiout, "return-value", stb);
       ui_out_text (uiout, "\n");
       do_cleanups (old_chain);
@@ -1805,7 +1809,7 @@ default_print_registers_info (struct gdbarch *gdbarch,
 	  int j;
 
 	  val_print (register_type (gdbarch, i), buffer, 0, 0,
-		     file, 0, 1, 0, Val_pretty_default, current_language);
+		     file, 0, &user_print_options, current_language);
 
 	  fprintf_filtered (file, "\t(raw 0x");
 	  for (j = 0; j < register_size (gdbarch, i); j++)
@@ -1821,16 +1825,20 @@ default_print_registers_info (struct gdbarch *gdbarch,
 	}
       else
 	{
+	  struct value_print_options opts;
+
 	  /* Print the register in hex.  */
+	  get_formatted_print_options (&opts, 'x');
 	  val_print (register_type (gdbarch, i), buffer, 0, 0,
-		     file, 'x', 1, 0, Val_pretty_default, current_language);
+		     file, 0, &opts,
+		     current_language);
           /* If not a vector register, print it also according to its
              natural format.  */
 	  if (TYPE_VECTOR (register_type (gdbarch, i)) == 0)
 	    {
 	      fprintf_filtered (file, "\t");
 	      val_print (register_type (gdbarch, i), buffer, 0, 0,
-			 file, 0, 1, 0, Val_pretty_default, current_language);
+			 file, 0, &user_print_options, current_language);
 	    }
 	}
 
diff --git a/gdb/jv-lang.h b/gdb/jv-lang.h
index 51bada2..04ba383 100644
--- a/gdb/jv-lang.h
+++ b/gdb/jv-lang.h
@@ -41,11 +41,11 @@ extern struct type *java_double_type;
 extern struct type *java_void_type;
 
 extern int java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			   struct ui_file *, int, int, int,
-			   enum val_prettyprint);
+			   struct ui_file *, int,
+			   const struct value_print_options *);
 
-extern int java_value_print (struct value *, struct ui_file *, int,
-			     enum val_prettyprint);
+extern int java_value_print (struct value *, struct ui_file *,
+			     const struct value_print_options *);
 
 extern struct value *java_class_from_object (struct value *);
 
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index 9e36aa4..975068b 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -35,8 +35,8 @@
 /* Local functions */
 
 int
-java_value_print (struct value *val, struct ui_file *stream, int format,
-		  enum val_prettyprint pretty)
+java_value_print (struct value *val, struct ui_file *stream, 
+		  const struct value_print_options *options)
 {
   struct type *type;
   CORE_ADDR address;
@@ -89,7 +89,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
 
 	  address += JAVA_OBJECT_SIZE + 4;	/* Skip object header and length. */
 
-	  while (i < length && things_printed < print_max)
+	  while (i < length && things_printed < options->print_max)
 	    {
 	      gdb_byte *buf;
 
@@ -145,7 +145,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
 	  VALUE_ADDRESS (v) = address + JAVA_OBJECT_SIZE + 4;
 	  VALUE_ADDRESS (next_v) = VALUE_ADDRESS (v);
 
-	  while (i < length && things_printed < print_max)
+	  while (i < length && things_printed < options->print_max)
 	    {
 	      fputs_filtered (", ", stream);
 	      wrap_here (n_spaces (2));
@@ -180,8 +180,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
 	      else
 		fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
 
-	      common_val_print (v, stream, format, 2, 1, pretty,
-				current_language);
+	      common_val_print (v, stream, 1, options, current_language);
 
 	      things_printed++;
 	      i += reps;
@@ -203,7 +202,7 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
       && TYPE_TAG_NAME (TYPE_TARGET_TYPE (type))
       && strcmp (TYPE_TAG_NAME (TYPE_TARGET_TYPE (type)),
 		 "java.lang.String") == 0
-      && (format == 0 || format == 's')
+      && (options->output_format == 0 || options->output_format == 's')
       && address != 0
       && value_as_address (val) != 0)
     {
@@ -228,13 +227,12 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
 
       value_free_to_mark (mark);	/* Release unnecessary values */
 
-      val_print_string (data + boffset, count, 2, stream);
+      val_print_string (data + boffset, count, 2, stream, options);
 
       return 0;
     }
 
-  return common_val_print (val, stream, format, 1, 0, pretty,
-			   current_language);
+  return common_val_print (val, stream, 0, options, current_language);
 }
 
 /* TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and PRETTY have the
@@ -246,7 +244,8 @@ java_value_print (struct value *val, struct ui_file *stream, int format,
 static void
 java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 			 CORE_ADDR address, struct ui_file *stream,
-			 int format, int recurse, enum val_prettyprint pretty)
+			 int recurse,
+			 const struct value_print_options *options)
 {
   int i, len, n_baseclasses;
 
@@ -275,7 +274,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 
 	  boffset = 0;
 
-	  if (pretty)
+	  if (options->pretty)
 	    {
 	      fprintf_filtered (stream, "\n");
 	      print_spaces_filtered (2 * (recurse + 1), stream);
@@ -289,7 +288,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 	  base_valaddr = valaddr;
 
 	  java_print_value_fields (baseclass, base_valaddr, address + boffset,
-				   stream, format, recurse + 1, pretty);
+				   stream, recurse + 1, options);
 	  fputs_filtered (", ", stream);
 	}
 
@@ -307,7 +306,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 	  if (field_is_static (&TYPE_FIELD (type, i)))
 	    {
 	      char *name = TYPE_FIELD_NAME (type, i);
-	      if (!static_field_print)
+	      if (!options->static_field_print)
 		continue;
 	      if (name != NULL && strcmp (name, "class") == 0)
 		continue;
@@ -316,7 +315,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 	    fprintf_filtered (stream, ", ");
 	  else if (n_baseclasses > 0)
 	    {
-	      if (pretty)
+	      if (options->pretty)
 		{
 		  fprintf_filtered (stream, "\n");
 		  print_spaces_filtered (2 + 2 * recurse, stream);
@@ -327,7 +326,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 	    }
 	  fields_seen = 1;
 
-	  if (pretty)
+	  if (options->pretty)
 	    {
 	      fprintf_filtered (stream, "\n");
 	      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -336,7 +335,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 	    {
 	      wrap_here (n_spaces (2 + 2 * recurse));
 	    }
-	  if (inspect_it)
+	  if (options->inspect_it)
 	    {
 	      if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
 		fputs_filtered ("\"( ptr \"", stream);
@@ -383,8 +382,8 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 		  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
 				   unpack_field_as_long (type, valaddr, i));
 
-		  common_val_print (v, stream, format, 0, recurse + 1,
-				    pretty, current_language);
+		  common_val_print (v, stream, recurse + 1,
+				    options, current_language);
 		}
 	    }
 	  else
@@ -403,8 +402,8 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 		      struct type *t = check_typedef (value_type (v));
 		      if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
 			v = value_addr (v);
-		      common_val_print (v, stream, format, 0, recurse + 1,
-					pretty, current_language);
+		      common_val_print (v, stream, recurse + 1,
+					options, current_language);
 		    }
 		}
 	      else if (TYPE_FIELD_TYPE (type, i) == NULL)
@@ -414,14 +413,14 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 		  val_print (TYPE_FIELD_TYPE (type, i),
 			     valaddr + TYPE_FIELD_BITPOS (type, i) / 8, 0,
 			     address + TYPE_FIELD_BITPOS (type, i) / 8,
-			     stream, format, 0, recurse + 1, pretty,
+			     stream, recurse + 1, options,
 			     current_language);
 		}
 	    }
 	  annotate_field_end ();
 	}
 
-      if (pretty)
+      if (options->pretty)
 	{
 	  fprintf_filtered (stream, "\n");
 	  print_spaces_filtered (2 * recurse, stream);
@@ -446,8 +445,8 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr,
 int
 java_val_print (struct type *type, const gdb_byte *valaddr,
 		int embedded_offset, CORE_ADDR address,
-		struct ui_file *stream, int format, int deref_ref,
-		int recurse, enum val_prettyprint pretty)
+		struct ui_file *stream, int recurse,
+		const struct value_print_options *options)
 {
   unsigned int i = 0;	/* Number of characters printed */
   struct type *target_type;
@@ -457,13 +456,13 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_PTR:
-      if (format && format != 's')
+      if (options->output_format && options->output_format != 's')
 	{
-	  print_scalar_formatted (valaddr, type, format, 0, stream);
+	  print_scalar_formatted (valaddr, type, options->output_format, 0, stream);
 	  break;
 	}
 #if 0
-      if (vtblprint && cp_is_vtbl_ptr_type (type))
+      if (options->vtblprint && cp_is_vtbl_ptr_type (type))
 	{
 	  /* Print the unmangled name if desired.  */
 	  /* Print vtable entry - we only get here if we ARE using
@@ -490,7 +489,7 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
 	  return (0);
 	}
 
-      if (addressprint && format != 's')
+      if (options->addressprint && options->output_format != 's')
 	{
 	  fputs_filtered ("@", stream);
 	  print_longest (stream, 'x', 0, (ULONGEST) addr);
@@ -502,9 +501,9 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
     case TYPE_CODE_INT:
       /* Can't just call c_val_print because that prints bytes as C
 	 chars.  */
-      format = format ? format : output_format;
-      if (format)
-	print_scalar_formatted (valaddr, type, format, 0, stream);
+      if (options->output_format)
+	print_scalar_formatted (valaddr, type, options->output_format,
+				0, stream);
       else if (TYPE_CODE (type) == TYPE_CODE_CHAR
 	       || (TYPE_CODE (type) == TYPE_CODE_INT
 		   && TYPE_LENGTH (type) == 2
@@ -515,13 +514,13 @@ java_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_STRUCT:
-      java_print_value_fields (type, valaddr, address, stream, format,
-			       recurse, pretty);
+      java_print_value_fields (type, valaddr, address, stream, recurse,
+			       options);
       break;
 
     default:
       return c_val_print (type, valaddr, embedded_offset, address, stream,
-			  format, deref_ref, recurse, pretty);
+			  recurse, options);
     }
 
   return 0;
diff --git a/gdb/language.c b/gdb/language.c
index 121fc55..46e238d 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -72,7 +72,8 @@ static void unk_lang_printchar (int c, struct ui_file *stream);
 static void unk_lang_print_type (struct type *, char *, struct ui_file *,
 				 int, int);
 
-static int unk_lang_value_print (struct value *, struct ui_file *, int, enum val_prettyprint);
+static int unk_lang_value_print (struct value *, struct ui_file *,
+				 const struct value_print_options *);
 
 static CORE_ADDR unk_lang_trampoline (struct frame_info *, CORE_ADDR pc);
 
@@ -1035,10 +1036,10 @@ default_word_break_characters (void)
 
 void
 default_print_array_index (struct value *index_value, struct ui_file *stream,
-                           int format, enum val_prettyprint pretty)
+			   const struct value_print_options *options)
 {
   fprintf_filtered (stream, "[");
-  LA_VALUE_PRINT (index_value, stream, format, pretty);
+  LA_VALUE_PRINT (index_value, stream, options);
   fprintf_filtered (stream, "] = ");
 }
 
@@ -1070,7 +1071,8 @@ unk_lang_printchar (int c, struct ui_file *stream)
 
 static void
 unk_lang_printstr (struct ui_file *stream, const gdb_byte *string,
-		   unsigned int length, int width, int force_ellipses)
+		   unsigned int length, int width, int force_ellipses,
+		   const struct value_print_options *options)
 {
   error (_("internal error - unimplemented function unk_lang_printstr called."));
 }
@@ -1085,15 +1087,15 @@ unk_lang_print_type (struct type *type, char *varstring, struct ui_file *stream,
 static int
 unk_lang_val_print (struct type *type, const gdb_byte *valaddr,
 		    int embedded_offset, CORE_ADDR address,
-		    struct ui_file *stream, int format,
-		    int deref_ref, int recurse, enum val_prettyprint pretty)
+		    struct ui_file *stream, int recurse,
+		    const struct value_print_options *options)
 {
   error (_("internal error - unimplemented function unk_lang_val_print called."));
 }
 
 static int
-unk_lang_value_print (struct value *val, struct ui_file *stream, int format,
-		      enum val_prettyprint pretty)
+unk_lang_value_print (struct value *val, struct ui_file *stream,
+		      const struct value_print_options *options)
 {
   error (_("internal error - unimplemented function unk_lang_value_print called."));
 }
diff --git a/gdb/language.h b/gdb/language.h
index cc10ff2..c92c57c 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -30,6 +30,7 @@ struct objfile;
 struct frame_info;
 struct expression;
 struct ui_file;
+struct value_print_options;
 
 #define MAX_FORTRAN_DIMS  7	/* Maximum number of F77 array dims */
 
@@ -189,7 +190,8 @@ struct language_defn
 
     void (*la_printstr) (struct ui_file * stream, const gdb_byte *string,
 			 unsigned int length, int width,
-			 int force_ellipses);
+			 int force_ellipses,
+			 const struct value_print_options *);
 
     void (*la_emitchar) (int ch, struct ui_file * stream, int quoter);
 
@@ -208,13 +210,13 @@ struct language_defn
     /* Print a value using syntax appropriate for this language. */
 
     int (*la_val_print) (struct type *, const gdb_byte *, int, CORE_ADDR,
-			 struct ui_file *, int, int, int,
-			 enum val_prettyprint);
+			 struct ui_file *, int,
+			 const struct value_print_options *);
 
     /* Print a top-level value using syntax appropriate for this language. */
 
     int (*la_value_print) (struct value *, struct ui_file *,
-			   int, enum val_prettyprint);
+			   const struct value_print_options *);
 
     /* PC is possibly an unknown languages trampoline.
        If that PC falls in a trampoline belonging to this language,
@@ -274,8 +276,7 @@ struct language_defn
     /* Print the index of an element of an array.  */
     void (*la_print_array_index) (struct value *index_value,
                                   struct ui_file *stream,
-                                  int format,
-                                  enum val_prettyprint pretty);
+                                  const struct value_print_options *options);
 
     /* Return non-zero if TYPE should be passed (and returned) by
        reference at the language level.  */
@@ -366,21 +367,22 @@ extern enum language set_language (enum language);
 #define LA_PRINT_TYPEDEF(type,new_symbol,stream) \
   (current_language->la_print_typedef(type,new_symbol,stream))
 
-#define LA_VAL_PRINT(type,valaddr,offset,addr,stream,fmt,deref,recurse,pretty) \
-  (current_language->la_val_print(type,valaddr,offset,addr,stream,fmt,deref, \
-				  recurse,pretty))
-#define LA_VALUE_PRINT(val,stream,fmt,pretty) \
-  (current_language->la_value_print(val,stream,fmt,pretty))
+#define LA_VAL_PRINT(type,valaddr,offset,addr,stream,recurse,options) \
+  (current_language->la_val_print(type,valaddr,offset,addr,stream, \
+				  recurse,options))
+#define LA_VALUE_PRINT(val,stream,options) \
+  (current_language->la_value_print(val,stream,options))
 
 #define LA_PRINT_CHAR(ch, stream) \
   (current_language->la_printchar(ch, stream))
-#define LA_PRINT_STRING(stream, string, length, width, force_ellipses) \
-  (current_language->la_printstr(stream, string, length, width, force_ellipses))
+#define LA_PRINT_STRING(stream, string, length, width, force_ellipses,options) \
+  (current_language->la_printstr(stream, string, length, width, \
+				 force_ellipses,options))
 #define LA_EMIT_CHAR(ch, stream, quoter) \
   (current_language->la_emitchar(ch, stream, quoter))
 
-#define LA_PRINT_ARRAY_INDEX(index_value, stream, format, pretty) \
-  (current_language->la_print_array_index(index_value, stream, format, pretty))
+#define LA_PRINT_ARRAY_INDEX(index_value, stream, optins) \
+  (current_language->la_print_array_index(index_value, stream, options))
 
 /* Test a character to decide whether it can be printed in literal form
    or needs to be printed in another representation.  For example,
@@ -472,8 +474,7 @@ extern char *default_word_break_characters (void);
 /* Print the index of an array element using the C99 syntax.  */
 extern void default_print_array_index (struct value *index_value,
                                        struct ui_file *stream,
-                                       int format,
-                                       enum val_prettyprint pretty);
+				       const struct value_print_options *options);
 
 /* Return non-zero if TYPE should be passed (and returned) by
    reference at the language level.  */
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index ea59403..e09b64b 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -104,7 +104,8 @@ m2_printchar (int c, struct ui_file *stream)
 
 static void
 m2_printstr (struct ui_file *stream, const gdb_byte *string,
-	     unsigned int length, int width, int force_ellipses)
+	     unsigned int length, int width, int force_ellipses,
+	     const struct value_print_options *options)
 {
   unsigned int i;
   unsigned int things_printed = 0;
@@ -117,7 +118,7 @@ m2_printstr (struct ui_file *stream, const gdb_byte *string,
       return;
     }
 
-  for (i = 0; i < length && things_printed < print_max; ++i)
+  for (i = 0; i < length && things_printed < options->print_max; ++i)
     {
       /* Position of the character we are examining
          to see whether it is repeated.  */
@@ -141,11 +142,11 @@ m2_printstr (struct ui_file *stream, const gdb_byte *string,
 	  ++reps;
 	}
 
-      if (reps > repeat_count_threshold)
+      if (reps > options->repeat_count_threshold)
 	{
 	  if (in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\\", ", stream);
 	      else
 		fputs_filtered ("\", ", stream);
@@ -154,14 +155,14 @@ m2_printstr (struct ui_file *stream, const gdb_byte *string,
 	  m2_printchar (string[i], stream);
 	  fprintf_filtered (stream, " <repeats %u times>", reps);
 	  i = rep1 - 1;
-	  things_printed += repeat_count_threshold;
+	  things_printed += options->repeat_count_threshold;
 	  need_comma = 1;
 	}
       else
 	{
 	  if (!in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\\"", stream);
 	      else
 		fputs_filtered ("\"", stream);
@@ -175,7 +176,7 @@ m2_printstr (struct ui_file *stream, const gdb_byte *string,
   /* Terminate the quotes if necessary.  */
   if (in_quotes)
     {
-      if (inspect_it)
+      if (options->inspect_it)
 	fputs_filtered ("\\\"", stream);
       else
 	fputs_filtered ("\"", stream);
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index 8ce458c..f99e31a 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -33,8 +33,8 @@ extern int m2_is_long_set (struct type *type);
 extern int m2_is_unbounded_array (struct type *type);
 
 extern int m2_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			 struct ui_file *, int, int, int,
-			 enum val_prettyprint);
+			 struct ui_file *, int,
+			 const struct value_print_options *);
 
 extern int get_long_set_bounds (struct type *type, LONGEST *low,
 				LONGEST *high);
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 82ff30e..e276e86 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -30,22 +30,24 @@
 #include "m2-lang.h"
 #include "target.h"
 
-int print_unpacked_pointer (struct type *type,
-			    CORE_ADDR address, CORE_ADDR addr,
-			    int format, struct ui_file *stream);
+static int print_unpacked_pointer (struct type *type,
+				   CORE_ADDR address, CORE_ADDR addr,
+				   const struct value_print_options *options,
+				   struct ui_file *stream);
 static void
 m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
 			 int embedded_offset, CORE_ADDR address,
-			 struct ui_file *stream, int format,
-			 enum val_prettyprint pretty,
-			 int deref_ref, int recurse, int len);
+			 struct ui_file *stream, int recurse,
+			 const struct value_print_options *options,
+			 int len);
 
 
 /* Print function pointer with inferior address ADDRESS onto stdio
    stream STREAM.  */
 
 static void
-print_function_pointer_address (CORE_ADDR address, struct ui_file *stream)
+print_function_pointer_address (CORE_ADDR address, struct ui_file *stream,
+				int addressprint)
 {
   CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
 							    address,
@@ -88,8 +90,7 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high)
 static void
 m2_print_long_set (struct type *type, const gdb_byte *valaddr,
 		   int embedded_offset, CORE_ADDR address,
-		   struct ui_file *stream, int format,
-		   enum val_prettyprint pretty)
+		   struct ui_file *stream)
 {
   int empty_set        = 1;
   int element_seen     = 0;
@@ -184,9 +185,8 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr,
 static void
 m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
 			  int embedded_offset, CORE_ADDR address,
-			  struct ui_file *stream, int format,
-			  int deref_ref, enum val_prettyprint pretty,
-			  int recurse)
+			  struct ui_file *stream, int recurse,
+			  const struct value_print_options *options)
 {
   struct type *content_type;
   CORE_ADDR addr;
@@ -207,26 +207,27 @@ m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
   fprintf_filtered (stream, "{");  
   m2_print_array_contents (value_type (val), value_contents(val),
 			   value_embedded_offset (val), addr, stream,
-			   format, deref_ref, pretty, recurse, len);
+			   recurse, options, len);
   fprintf_filtered (stream, ", HIGH = %d}", (int) len);
 }
 
-int
+static int
 print_unpacked_pointer (struct type *type,
 			CORE_ADDR address, CORE_ADDR addr,
-			int format, struct ui_file *stream)
+			const struct value_print_options *options,
+			struct ui_file *stream)
 {
   struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
 
   if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
     {
       /* Try to print what function it points to.  */
-      print_function_pointer_address (addr, stream);
+      print_function_pointer_address (addr, stream, options->addressprint);
       /* Return value is irrelevant except for string pointers.  */
       return 0;
     }
 
-  if (addressprint && format != 's')
+  if (options->addressprint && options->output_format != 's')
     fputs_filtered (paddress (address), stream);
 
   /* For a pointer to char or unsigned char, also print the string
@@ -234,9 +235,9 @@ print_unpacked_pointer (struct type *type,
 
   if (TYPE_LENGTH (elttype) == 1
       && TYPE_CODE (elttype) == TYPE_CODE_INT
-      && (format == 0 || format == 's')
+      && (options->output_format == 0 || options->output_format == 's')
       && addr != 0)
-      return val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
+    return val_print_string (addr, -1, TYPE_LENGTH (elttype), stream, options);
   
   return 0;
 }
@@ -244,9 +245,9 @@ print_unpacked_pointer (struct type *type,
 static void
 print_variable_at_address (struct type *type,
 			   const gdb_byte *valaddr,
-			   struct ui_file *stream, int format,
-			   int deref_ref, int recurse,
-			   enum val_prettyprint pretty)
+			   struct ui_file *stream,
+			   int recurse,
+			   const struct value_print_options *options)
 {
   CORE_ADDR addr = unpack_pointer (type, valaddr);
   struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
@@ -259,8 +260,7 @@ print_variable_at_address (struct type *type,
     {
       struct value *deref_val =
 	value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr));
-      common_val_print (deref_val, stream, format, deref_ref,
-			recurse, pretty, current_language);
+      common_val_print (deref_val, stream, recurse, options, current_language);
     }
   else
     fputs_filtered ("???", stream);
@@ -276,9 +276,9 @@ print_variable_at_address (struct type *type,
 static void
 m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
 			 int embedded_offset, CORE_ADDR address,
-			 struct ui_file *stream, int format,
-			 enum val_prettyprint pretty,
-			 int deref_ref, int recurse, int len)
+			 struct ui_file *stream, int recurse,
+			 const struct value_print_options *options,
+			 int len)
 {
   int eltlen;
   CHECK_TYPEDEF (type);
@@ -286,21 +286,20 @@ m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
   if (TYPE_LENGTH (type) > 0)
     {
       eltlen = TYPE_LENGTH (type);
-      if (prettyprint_arrays)
+      if (options->prettyprint_arrays)
 	print_spaces_filtered (2 + 2 * recurse, stream);
       /* For an array of chars, print with string syntax.  */
       if (eltlen == 1 &&
 	  ((TYPE_CODE (type) == TYPE_CODE_INT)
 	   || ((current_language->la_language == language_m2)
 	       && (TYPE_CODE (type) == TYPE_CODE_CHAR)))
-	  && (format == 0 || format == 's'))
-	val_print_string (address, len+1, eltlen, stream);
+	  && (options->output_format == 0 || options->output_format == 's'))
+	val_print_string (address, len+1, eltlen, stream, options);
       else
 	{
 	  fprintf_filtered (stream, "{");
 	  val_print_array_elements (type, valaddr + embedded_offset,
-				    address, stream, format,
-				    deref_ref, recurse, pretty, 0);
+				    address, stream, recurse, options, 0);
 	  fprintf_filtered (stream, "}");
 	}
     }
@@ -322,8 +321,8 @@ m2_print_array_contents (struct type *type, const gdb_byte *valaddr,
 
 int
 m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
-	      CORE_ADDR address, struct ui_file *stream, int format,
-	      int deref_ref, int recurse, enum val_prettyprint pretty)
+	      CORE_ADDR address, struct ui_file *stream, int recurse,
+	      const struct value_print_options *options)
 {
   unsigned int i = 0;	/* Number of characters printed */
   unsigned len;
@@ -343,74 +342,73 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 	  elttype = check_typedef (TYPE_TARGET_TYPE (type));
 	  eltlen = TYPE_LENGTH (elttype);
 	  len = TYPE_LENGTH (type) / eltlen;
-	  if (prettyprint_arrays)
+	  if (options->prettyprint_arrays)
 	    print_spaces_filtered (2 + 2 * recurse, stream);
 	  /* For an array of chars, print with string syntax.  */
 	  if (eltlen == 1 &&
 	      ((TYPE_CODE (elttype) == TYPE_CODE_INT)
 	       || ((current_language->la_language == language_m2)
 		   && (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
-	      && (format == 0 || format == 's'))
+	      && (options->output_format == 0 || options->output_format == 's'))
 	    {
 	      /* If requested, look for the first null char and only print
 	         elements up to it.  */
-	      if (stop_print_at_null)
+	      if (options->stop_print_at_null)
 		{
 		  unsigned int temp_len;
 
 		  /* Look for a NULL char. */
 		  for (temp_len = 0;
 		       (valaddr + embedded_offset)[temp_len]
-			 && temp_len < len && temp_len < print_max;
+			 && temp_len < len && temp_len < options->print_max;
 		       temp_len++);
 		  len = temp_len;
 		}
 
-	      LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0);
+	      LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0,
+			       options);
 	      i = len;
 	    }
 	  else
 	    {
 	      fprintf_filtered (stream, "{");
 	      val_print_array_elements (type, valaddr + embedded_offset,
-					address, stream, format, deref_ref,
-					recurse, pretty, 0);
+					address, stream, recurse, options, 0);
 	      fprintf_filtered (stream, "}");
 	    }
 	  break;
 	}
       /* Array of unspecified length: treat like pointer to first elt.  */
-      print_unpacked_pointer (type, address, address, format, stream);
+      print_unpacked_pointer (type, address, address, options, stream);
       break;
 
     case TYPE_CODE_PTR:
       if (TYPE_CONST (type))
 	print_variable_at_address (type, valaddr + embedded_offset,
-				   stream, format, deref_ref, recurse,
-				   pretty);
-      else if (format && format != 's')
-	print_scalar_formatted (valaddr + embedded_offset, type, format,
-				0, stream);
+				   stream, recurse, options);
+      else if (options->output_format && options->output_format != 's')
+	print_scalar_formatted (valaddr + embedded_offset, type,
+				options->output_format, 0, stream);
       else
 	{
 	  addr = unpack_pointer (type, valaddr + embedded_offset);
-	  print_unpacked_pointer (type, addr, address, format, stream);
+	  print_unpacked_pointer (type, addr, address, options, stream);
 	}
       break;
 
     case TYPE_CODE_REF:
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
-      if (addressprint)
+      if (options->addressprint)
 	{
 	  CORE_ADDR addr
 	    = extract_typed_address (valaddr + embedded_offset, type);
 	  fprintf_filtered (stream, "@");
 	  fputs_filtered (paddress (addr), stream);
-	  if (deref_ref)
+	  if (options->deref_ref)
 	    fputs_filtered (": ", stream);
 	}
       /* De-reference the reference.  */
-      if (deref_ref)
+      if (options->deref_ref)
 	{
 	  if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
 	    {
@@ -418,8 +416,8 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
 		value_at
 		(TYPE_TARGET_TYPE (type),
 		 unpack_pointer (type, valaddr + embedded_offset));
-	      common_val_print (deref_val, stream, format, deref_ref,
-				recurse, pretty, current_language);
+	      common_val_print (deref_val, stream, recurse, options,
+				current_language);
 	    }
 	  else
 	    fputs_filtered ("???", stream);
@@ -427,7 +425,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_UNION:
-      if (recurse && !unionprint)
+      if (recurse && !options->unionprint)
 	{
 	  fprintf_filtered (stream, "{...}");
 	  break;
@@ -436,22 +434,20 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
     case TYPE_CODE_STRUCT:
       if (m2_is_long_set (type))
 	m2_print_long_set (type, valaddr, embedded_offset, address,
-			   stream, format, pretty);
+			   stream);
       else if (m2_is_unbounded_array (type))
 	m2_print_unbounded_array (type, valaddr, embedded_offset,
-				  address, stream, format, deref_ref,
-				  pretty, recurse);
+				  address, stream, recurse, options);
       else
 	cp_print_value_fields (type, type, valaddr, embedded_offset,
-			       address, stream, format,
-			       recurse, pretty, NULL, 0);
+			       address, stream, recurse, options, NULL, 0);
       break;
 
     case TYPE_CODE_ENUM:
-      if (format)
+      if (options->output_format)
 	{
 	  print_scalar_formatted (valaddr + embedded_offset, type,
-				  format, 0, stream);
+				  options->output_format, 0, stream);
 	  break;
 	}
       len = TYPE_NFIELDS (type);
@@ -475,10 +471,10 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_FUNC:
-      if (format)
+      if (options->output_format)
 	{
 	  print_scalar_formatted (valaddr + embedded_offset, type,
-				  format, 0, stream);
+				  options->output_format, 0, stream);
 	  break;
 	}
       /* FIXME, we should consider, at least for ANSI C language, eliminating
@@ -491,10 +487,9 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_BOOL:
-      format = format ? format : output_format;
-      if (format)
+      if (options->output_format)
 	print_scalar_formatted (valaddr + embedded_offset, type,
-				format, 0, stream);
+				options->output_format, 0, stream);
       else
 	{
 	  val = unpack_long (type, valaddr + embedded_offset);
@@ -511,7 +506,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
 	{
 	  m2_val_print (TYPE_TARGET_TYPE (type), valaddr, embedded_offset,
-			address, stream, format, deref_ref, recurse, pretty);
+			address, stream, recurse, options);
 	  break;
 	}
       /* FIXME: create_range_type does not set the unsigned bit in a
@@ -524,19 +519,17 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       /* FALLTHROUGH */
 
     case TYPE_CODE_INT:
-      format = format ? format : output_format;
-      if (format)
-	print_scalar_formatted (valaddr + embedded_offset, type, format,
-				0, stream);
+      if (options->output_format)
+	print_scalar_formatted (valaddr + embedded_offset, type,
+				options->output_format, 0, stream);
       else
 	val_print_type_code_int (type, valaddr + embedded_offset, stream);
       break;
 
     case TYPE_CODE_CHAR:
-      format = format ? format : output_format;
-      if (format)
+      if (options->output_format)
 	print_scalar_formatted (valaddr + embedded_offset, type,
-				format, 0, stream);
+				options->output_format, 0, stream);
       else
 	{
 	  val = unpack_long (type, valaddr + embedded_offset);
@@ -550,9 +543,9 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
       break;
 
     case TYPE_CODE_FLT:
-      if (format)
+      if (options->output_format)
 	print_scalar_formatted (valaddr + embedded_offset, type,
-				format, 0, stream);
+				options->output_format, 0, stream);
       else
 	print_floating (valaddr + embedded_offset, type, stream);
       break;
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index baf9b6d..9c55b4b 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -30,6 +30,7 @@
 #include "dictionary.h"
 #include "gdb_string.h"
 #include "language.h"
+#include "valprint.h"
 
 static void list_args_or_locals (int locals, int values, struct frame_info *fi);
 
@@ -280,21 +281,27 @@ list_args_or_locals (int locals, int values, struct frame_info *fi)
 		      && TYPE_CODE (type) != TYPE_CODE_STRUCT
 		      && TYPE_CODE (type) != TYPE_CODE_UNION)
 		    {
+		      struct value_print_options opts;
 		      val = read_var_value (sym2, fi);
+		      get_raw_print_options (&opts);
 		      common_val_print
-			(val, stb->stream, 0, 1, 0, Val_no_prettyprint,
+			(val, stb->stream, 0, &opts,
 			 language_def (SYMBOL_LANGUAGE (sym2)));
 		      ui_out_field_stream (uiout, "value", stb);
 		    }
 		  do_cleanups (cleanup_tuple);
 		  break;
 		case PRINT_ALL_VALUES:
-		  val = read_var_value (sym2, fi);
-		  common_val_print
-		    (val, stb->stream, 0, 1, 0, Val_no_prettyprint,
-		     language_def (SYMBOL_LANGUAGE (sym2)));
-		  ui_out_field_stream (uiout, "value", stb);
-		  do_cleanups (cleanup_tuple);
+		  {
+		    struct value_print_options opts;
+		    val = read_var_value (sym2, fi);
+		    get_raw_print_options (&opts);
+		    common_val_print
+		      (val, stb->stream, 0, &opts,
+		       language_def (SYMBOL_LANGUAGE (sym2)));
+		    ui_out_field_stream (uiout, "value", stb);
+		    do_cleanups (cleanup_tuple);
+		  }
 		  break;
 		}
 	    }
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 7780207..4fdbdb5 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -45,6 +45,7 @@
 #include "frame.h"
 #include "mi-main.h"
 #include "language.h"
+#include "valprint.h"
 
 #include <ctype.h>
 #include <sys/time.h>
@@ -500,8 +501,7 @@ get_register (int regnum, int format)
   else
     {
       val_print (register_type (current_gdbarch, regnum), buffer, 0, 0,
-		 stb->stream, format, 1, 0, Val_pretty_default,
-		 current_language);
+		 stb->stream, 0, &user_print_options, current_language);
       ui_out_field_stream (uiout, "value", stb);
       ui_out_stream_delete (stb);
     }
@@ -588,7 +588,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc)
   /* Print the result of the expression evaluation.  */
   val_print (value_type (val), value_contents (val),
 	     value_embedded_offset (val), VALUE_ADDRESS (val),
-	     stb->stream, 0, 0, 0, 0, current_language);
+	     stb->stream, 0, &user_print_options, current_language);
 
   ui_out_field_stream (uiout, "value", stb);
   ui_out_stream_delete (stb);
diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c
index da4afe3..ae6f382 100644
--- a/gdb/mt-tdep.c
+++ b/gdb/mt-tdep.c
@@ -37,6 +37,7 @@
 #include "infcall.h"
 #include "gdb_assert.h"
 #include "language.h"
+#include "valprint.h"
 
 enum mt_arch_constants
 {
@@ -675,6 +676,7 @@ mt_registers_info (struct gdbarch *gdbarch,
 	{
 	  /* Special output handling for the 'coprocessor' register.  */
 	  gdb_byte *buf;
+	  struct value_print_options opts;
 
 	  buf = alloca (register_size (gdbarch, MT_COPRO_REGNUM));
 	  frame_register_read (frame, MT_COPRO_REGNUM, buf);
@@ -685,8 +687,9 @@ mt_registers_info (struct gdbarch *gdbarch,
 	  print_spaces_filtered (15 - strlen (gdbarch_register_name
 					        (gdbarch, regnum)),
 				 file);
+	  get_raw_print_options (&opts);
 	  val_print (register_type (gdbarch, regnum), buf,
-		     0, 0, file, 0, 1, 0, Val_no_prettyprint,
+		     0, 0, file, 0, &opts,
 		     current_language);
 	  fputs_filtered ("\n", file);
 	}
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 7d287a0..3a952f5 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -341,7 +341,8 @@ objc_printchar (int c, struct ui_file *stream)
 
 static void
 objc_printstr (struct ui_file *stream, const gdb_byte *string, 
-	       unsigned int length, int width, int force_ellipses)
+	       unsigned int length, int width, int force_ellipses,
+	       const struct value_print_options *options)
 {
   unsigned int i;
   unsigned int things_printed = 0;
@@ -360,7 +361,7 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string,
       return;
     }
 
-  for (i = 0; i < length && things_printed < print_max; ++i)
+  for (i = 0; i < length && things_printed < options->print_max; ++i)
     {
       /* Position of the character we are examining to see whether it
 	 is repeated.  */
@@ -384,11 +385,11 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string,
 	  ++reps;
 	}
 
-      if (reps > repeat_count_threshold)
+      if (reps > options->repeat_count_threshold)
 	{
 	  if (in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\\", ", stream);
 	      else
 		fputs_filtered ("\", ", stream);
@@ -397,14 +398,14 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string,
 	  objc_printchar (string[i], stream);
 	  fprintf_filtered (stream, " <repeats %u times>", reps);
 	  i = rep1 - 1;
-	  things_printed += repeat_count_threshold;
+	  things_printed += options->repeat_count_threshold;
 	  need_comma = 1;
 	}
       else
 	{
 	  if (!in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\\"", stream);
 	      else
 		fputs_filtered ("\"", stream);
@@ -418,7 +419,7 @@ objc_printstr (struct ui_file *stream, const gdb_byte *string,
   /* Terminate the quotes if necessary.  */
   if (in_quotes)
     {
-      if (inspect_it)
+      if (options->inspect_it)
 	fputs_filtered ("\\\"", stream);
       else
 	fputs_filtered ("\"", stream);
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 7ecdd8d..cd4285d 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -207,7 +207,8 @@ pascal_printchar (int c, struct ui_file *stream)
 
 void
 pascal_printstr (struct ui_file *stream, const gdb_byte *string,
-		 unsigned int length, int width, int force_ellipses)
+		 unsigned int length, int width, int force_ellipses,
+		 const struct value_print_options *options)
 {
   unsigned int i;
   unsigned int things_printed = 0;
@@ -226,7 +227,7 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
       return;
     }
 
-  for (i = 0; i < length && things_printed < print_max; ++i)
+  for (i = 0; i < length && things_printed < options->print_max; ++i)
     {
       /* Position of the character we are examining
          to see whether it is repeated.  */
@@ -250,11 +251,11 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
 	  ++reps;
 	}
 
-      if (reps > repeat_count_threshold)
+      if (reps > options->repeat_count_threshold)
 	{
 	  if (in_quotes)
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\', ", stream);
 	      else
 		fputs_filtered ("', ", stream);
@@ -263,7 +264,7 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
 	  pascal_printchar (string[i], stream);
 	  fprintf_filtered (stream, " <repeats %u times>", reps);
 	  i = rep1 - 1;
-	  things_printed += repeat_count_threshold;
+	  things_printed += options->repeat_count_threshold;
 	  need_comma = 1;
 	}
       else
@@ -271,7 +272,7 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
 	  int c = string[i];
 	  if ((!in_quotes) && (PRINT_LITERAL_FORM (c)))
 	    {
-	      if (inspect_it)
+	      if (options->inspect_it)
 		fputs_filtered ("\\'", stream);
 	      else
 		fputs_filtered ("'", stream);
@@ -285,7 +286,7 @@ pascal_printstr (struct ui_file *stream, const gdb_byte *string,
   /* Terminate the quotes if necessary.  */
   if (in_quotes)
     {
-      if (inspect_it)
+      if (options->inspect_it)
 	fputs_filtered ("\\'", stream);
       else
 	fputs_filtered ("'", stream);
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index a4f878f..4ebfbc1 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -35,10 +35,11 @@ extern void pascal_print_typedef (struct type *, struct symbol *,
 				  struct ui_file *);
 
 extern int pascal_val_print (struct type *, const gdb_byte *, int,
-			     CORE_ADDR, struct ui_file *, int, int,
-			     int, enum val_prettyprint);
+			     CORE_ADDR, struct ui_file *, int,
+			     const struct value_print_options *);
 
-extern int pascal_value_print (struct value *, struct ui_file *, int, enum val_prettyprint);
+extern int pascal_value_print (struct value *, struct ui_file *,
+			       const struct value_print_options *);
 
 extern void pascal_type_print_method_args (char *, char *,
 					   struct ui_file *);
@@ -51,7 +52,8 @@ extern int
 extern void pascal_printchar (int, struct ui_file *);
 
 extern void pascal_printstr (struct ui_file *, const gdb_byte *,
-			     unsigned int, int, int);
+			     unsigned int, int, int,
+			     const struct value_print_options *);
 
 extern struct type **const (pascal_builtin_types[]);
 
@@ -63,15 +65,10 @@ extern void
 extern void
   pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int);
 
-/* These are in cp-valprint.c */
-
-extern int vtblprint;		/* Controls printing of vtbl's */
-
-extern int static_field_print;
-
 extern void pascal_object_print_value_fields (struct type *, const gdb_byte *,
 					      CORE_ADDR, struct ui_file *,
-					      int, int, enum val_prettyprint,
+					      int,
+					      const struct value_print_options *,
 					      struct type **, int);
 
 extern int pascal_object_is_vtbl_ptr_type (struct type *);
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index bc4fbe1..e074413 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -59,8 +59,8 @@
 int
 pascal_val_print (struct type *type, const gdb_byte *valaddr,
 		  int embedded_offset, CORE_ADDR address,
-		  struct ui_file *stream, int format, int deref_ref,
-		  int recurse, enum val_prettyprint pretty)
+		  struct ui_file *stream, int recurse,
+		  const struct value_print_options *options)
 {
   unsigned int i = 0;	/* Number of characters printed */
   unsigned len;
@@ -80,7 +80,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 	  elttype = check_typedef (TYPE_TARGET_TYPE (type));
 	  eltlen = TYPE_LENGTH (elttype);
 	  len = TYPE_LENGTH (type) / eltlen;
-	  if (prettyprint_arrays)
+	  if (options->prettyprint_arrays)
 	    {
 	      print_spaces_filtered (2 + 2 * recurse, stream);
 	    }
@@ -89,23 +89,24 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 	      && ((TYPE_CODE (elttype) == TYPE_CODE_INT)
 	       || ((current_language->la_language == language_pascal)
 		   && (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
-	      && (format == 0 || format == 's'))
+	      && (options->output_format == 0 || options->output_format == 's'))
 	    {
 	      /* If requested, look for the first null char and only print
 	         elements up to it.  */
-	      if (stop_print_at_null)
+	      if (options->stop_print_at_null)
 		{
 		  unsigned int temp_len;
 
 		  /* Look for a NULL char. */
 		  for (temp_len = 0;
 		       (valaddr + embedded_offset)[temp_len]
-		       && temp_len < len && temp_len < print_max;
+		       && temp_len < len && temp_len < options->print_max;
 		       temp_len++);
 		  len = temp_len;
 		}
 
-	      LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0);
+	      LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0,
+			       options);
 	      i = len;
 	    }
 	  else
@@ -123,7 +124,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 		  i = 0;
 		}
 	      val_print_array_elements (type, valaddr + embedded_offset, address, stream,
-				     format, deref_ref, recurse, pretty, i);
+					recurse, options, i);
 	      fprintf_filtered (stream, "}");
 	    }
 	  break;
@@ -133,12 +134,13 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       goto print_unpacked_pointer;
 
     case TYPE_CODE_PTR:
-      if (format && format != 's')
+      if (options->output_format && options->output_format != 's')
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	  break;
 	}
-      if (vtblprint && pascal_object_is_vtbl_ptr_type (type))
+      if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
 	{
 	  /* Print the unmangled name if desired.  */
 	  /* Print vtable entry - we only get here if we ARE using
@@ -162,7 +164,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 	      return (0);
 	    }
 
-	  if (addressprint && format != 's')
+	  if (options->addressprint && options->output_format != 's')
 	    {
 	      fputs_filtered (paddress (addr), stream);
 	    }
@@ -172,11 +174,11 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 	  if (TYPE_LENGTH (elttype) == 1
 	      && (TYPE_CODE (elttype) == TYPE_CODE_INT
 		  || TYPE_CODE(elttype) == TYPE_CODE_CHAR)
-	      && (format == 0 || format == 's')
+	      && (options->output_format == 0 || options->output_format == 's')
 	      && addr != 0)
 	    {
 	      /* no wide string yet */
-	      i = val_print_string (addr, -1, 1, stream);
+	      i = val_print_string (addr, -1, 1, stream, options);
 	    }
 	  /* also for pointers to pascal strings */
 	  /* Note: this is Free Pascal specific:
@@ -193,7 +195,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
               read_memory (addr + length_pos, buffer, length_size);
 	      string_length = extract_unsigned_integer (buffer, length_size);
               xfree (buffer);
-              i = val_print_string (addr + string_pos, string_length, char_size, stream);
+              i = val_print_string (addr + string_pos, string_length, char_size, stream, options);
 	    }
 	  else if (pascal_object_is_vtbl_member (type))
 	    {
@@ -209,7 +211,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 		  fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
 		  fputs_filtered (">", stream);
 		}
-	      if (vt_address && vtblprint)
+	      if (vt_address && options->vtblprint)
 		{
 		  struct value *vt_val;
 		  struct symbol *wsym = (struct symbol *) NULL;
@@ -230,9 +232,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 		      wtype = TYPE_TARGET_TYPE (type);
 		    }
 		  vt_val = value_at (wtype, vt_address);
-		  common_val_print (vt_val, stream, format, deref_ref,
-				    recurse + 1, pretty, current_language);
-		  if (pretty)
+		  common_val_print (vt_val, stream, recurse + 1, options,
+				    current_language);
+		  if (options->pretty)
 		    {
 		      fprintf_filtered (stream, "\n");
 		      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -249,18 +251,18 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 
     case TYPE_CODE_REF:
       elttype = check_typedef (TYPE_TARGET_TYPE (type));
-      if (addressprint)
+      if (options->addressprint)
 	{
 	  fprintf_filtered (stream, "@");
 	  /* Extract the address, assume that it is unsigned.  */
 	  fputs_filtered (paddress (
 	    extract_unsigned_integer (valaddr + embedded_offset,
 	       gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT)), stream);
-	  if (deref_ref)
+	  if (options->deref_ref)
 	    fputs_filtered (": ", stream);
 	}
       /* De-reference the reference.  */
-      if (deref_ref)
+      if (options->deref_ref)
 	{
 	  if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
 	    {
@@ -268,8 +270,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 	      value_at
 	      (TYPE_TARGET_TYPE (type),
 	       unpack_pointer (type, valaddr + embedded_offset));
-	      common_val_print (deref_val, stream, format, deref_ref,
-				recurse + 1, pretty, current_language);
+	      common_val_print (deref_val, stream, recurse + 1, options,
+				current_language);
 	    }
 	  else
 	    fputs_filtered ("???", stream);
@@ -277,14 +279,14 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_UNION:
-      if (recurse && !unionprint)
+      if (recurse && !options->unionprint)
 	{
 	  fprintf_filtered (stream, "{...}");
 	  break;
 	}
       /* Fall through.  */
     case TYPE_CODE_STRUCT:
-      if (vtblprint && pascal_object_is_vtbl_ptr_type (type))
+      if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
 	{
 	  /* Print the unmangled name if desired.  */
 	  /* Print vtable entry - we only get here if NOT using
@@ -301,18 +303,19 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
                                      &string_pos, &char_size, NULL))
 	    {
 	      len = extract_unsigned_integer (valaddr + embedded_offset + length_pos, length_size);
-	      LA_PRINT_STRING (stream, valaddr + embedded_offset + string_pos, len, char_size, 0);
+	      LA_PRINT_STRING (stream, valaddr + embedded_offset + string_pos, len, char_size, 0, options);
 	    }
 	  else
-	    pascal_object_print_value_fields (type, valaddr + embedded_offset, address, stream, format,
-					      recurse, pretty, NULL, 0);
+	    pascal_object_print_value_fields (type, valaddr + embedded_offset, address, stream,
+					      recurse, options, NULL, 0);
 	}
       break;
 
     case TYPE_CODE_ENUM:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	  break;
 	}
       len = TYPE_NFIELDS (type);
@@ -336,16 +339,18 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_FLAGS:
-      if (format)
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+      if (options->output_format)
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
       else
 	val_print_type_code_flags (type, valaddr + embedded_offset, stream);
       break;
 
     case TYPE_CODE_FUNC:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	  break;
 	}
       /* FIXME, we should consider, at least for ANSI C language, eliminating
@@ -358,9 +363,9 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_BOOL:
-      format = format ? format : output_format;
-      if (format)
-	print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+      if (options->output_format)
+	print_scalar_formatted (valaddr + embedded_offset, type,
+				options->output_format, 0, stream);
       else
 	{
 	  val = unpack_long (type, valaddr + embedded_offset);
@@ -387,10 +392,10 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       /* FALLTHROUGH */
 
     case TYPE_CODE_INT:
-      format = format ? format : output_format;
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	}
       else
 	{
@@ -399,10 +404,10 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_CHAR:
-      format = format ? format : output_format;
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	}
       else
 	{
@@ -417,9 +422,10 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
       break;
 
     case TYPE_CODE_FLT:
-      if (format)
+      if (options->output_format)
 	{
-	  print_scalar_formatted (valaddr + embedded_offset, type, format, 0, stream);
+	  print_scalar_formatted (valaddr + embedded_offset, type,
+				  options->output_format, 0, stream);
 	}
       else
 	{
@@ -517,8 +523,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
 }
 \f
 int
-pascal_value_print (struct value *val, struct ui_file *stream, int format,
-		    enum val_prettyprint pretty)
+pascal_value_print (struct value *val, struct ui_file *stream,
+		    const struct value_print_options *options)
 {
   struct type *type = value_type (val);
 
@@ -547,19 +553,10 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format,
 	  fprintf_filtered (stream, ") ");
 	}
     }
-  return common_val_print (val, stream, format, 1, 0, pretty,
-			   current_language);
+  return common_val_print (val, stream, 0, options, current_language);
 }
 
 
-/******************************************************************************
-                    Inserted from cp-valprint
-******************************************************************************/
-
-extern int vtblprint;		/* Controls printing of vtbl's */
-extern int objectprint;		/* Controls looking up an object's derived type
-				   using what we find in its vtables.  */
-static int pascal_static_field_print;	/* Controls printing of static fields. */
 static void
 show_pascal_static_field_print (struct ui_file *file, int from_tty,
 				struct cmd_list_element *c, const char *value)
@@ -572,12 +569,12 @@ static struct obstack dont_print_vb_obstack;
 static struct obstack dont_print_statmem_obstack;
 
 static void pascal_object_print_static_field (struct value *,
-					      struct ui_file *, int, int,
-					      enum val_prettyprint);
+					      struct ui_file *, int,
+					      const struct value_print_options *);
 
 static void pascal_object_print_value (struct type *, const gdb_byte *,
-				       CORE_ADDR, struct ui_file *,
-				       int, int, enum val_prettyprint,
+				       CORE_ADDR, struct ui_file *, int,
+				       const struct value_print_options *,
 				       struct type **);
 
 /* It was changed to this after 2.4.5.  */
@@ -633,8 +630,8 @@ pascal_object_is_vtbl_member (struct type *type)
 void
 pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 				  CORE_ADDR address, struct ui_file *stream,
-				  int format, int recurse,
-				  enum val_prettyprint pretty,
+				  int recurse,
+				  const struct value_print_options *options,
 				  struct type **dont_print_vb,
 				  int dont_print_statmem)
 {
@@ -651,7 +648,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
      duplicates of virtual baseclasses.  */
   if (n_baseclasses > 0)
     pascal_object_print_value (type, valaddr, address, stream,
-			       format, recurse + 1, pretty, dont_print_vb);
+			       recurse + 1, options, dont_print_vb);
 
   if (!len && n_baseclasses == 1)
     fprintf_filtered (stream, "<No data fields>");
@@ -671,14 +668,14 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
       for (i = n_baseclasses; i < len; i++)
 	{
 	  /* If requested, skip printing of static fields.  */
-	  if (!pascal_static_field_print
+	  if (!options->pascal_static_field_print
 	      && field_is_static (&TYPE_FIELD (type, i)))
 	    continue;
 	  if (fields_seen)
 	    fprintf_filtered (stream, ", ");
 	  else if (n_baseclasses > 0)
 	    {
-	      if (pretty)
+	      if (options->pretty)
 		{
 		  fprintf_filtered (stream, "\n");
 		  print_spaces_filtered (2 + 2 * recurse, stream);
@@ -689,7 +686,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 	    }
 	  fields_seen = 1;
 
-	  if (pretty)
+	  if (options->pretty)
 	    {
 	      fprintf_filtered (stream, "\n");
 	      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -698,7 +695,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 	    {
 	      wrap_here (n_spaces (2 + 2 * recurse));
 	    }
-	  if (inspect_it)
+	  if (options->inspect_it)
 	    {
 	      if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
 		fputs_filtered ("\"( ptr \"", stream);
@@ -745,8 +742,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 		  v = value_from_longest (TYPE_FIELD_TYPE (type, i),
 				   unpack_field_as_long (type, valaddr, i));
 
-		  common_val_print (v, stream, format, 0, recurse + 1,
-				    pretty, current_language);
+		  common_val_print (v, stream, recurse + 1, options,
+				    current_language);
 		}
 	    }
 	  else
@@ -765,8 +762,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 		  if (v == NULL)
 		    fputs_filtered ("<optimized out>", stream);
 		  else
-		    pascal_object_print_static_field (v, stream, format,
-						      recurse + 1, pretty);
+		    pascal_object_print_static_field (v, stream, recurse + 1,
+						      options);
 		}
 	      else
 		{
@@ -777,7 +774,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 		  val_print (TYPE_FIELD_TYPE (type, i),
 			     valaddr, TYPE_FIELD_BITPOS (type, i) / 8,
 			     address + TYPE_FIELD_BITPOS (type, i) / 8,
-			     stream, format, 0, recurse + 1, pretty,
+			     stream, recurse + 1, options,
 			     current_language);
 		}
 	    }
@@ -792,7 +789,7 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 	  dont_print_statmem_obstack = tmp_obstack;
 	}
 
-      if (pretty)
+      if (options->pretty)
 	{
 	  fprintf_filtered (stream, "\n");
 	  print_spaces_filtered (2 * recurse, stream);
@@ -807,8 +804,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
 static void
 pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 			   CORE_ADDR address, struct ui_file *stream,
-			   int format, int recurse,
-			   enum val_prettyprint pretty,
+			   int recurse,
+			   const struct value_print_options *options,
 			   struct type **dont_print_vb)
 {
   struct type **last_dont_print
@@ -849,7 +846,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 
       boffset = baseclass_offset (type, i, valaddr, address);
 
-      if (pretty)
+      if (options->pretty)
 	{
 	  fprintf_filtered (stream, "\n");
 	  print_spaces_filtered (2 * recurse, stream);
@@ -881,7 +878,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 	fprintf_filtered (stream, "<invalid address>");
       else
 	pascal_object_print_value_fields (baseclass, base_valaddr, address + boffset,
-					  stream, format, recurse, pretty,
+					  stream, recurse, options,
 		     (struct type **) obstack_base (&dont_print_vb_obstack),
 					  0);
       fputs_filtered (", ", stream);
@@ -912,8 +909,9 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
 
 static void
 pascal_object_print_static_field (struct value *val,
-				  struct ui_file *stream, int format,
-				  int recurse, enum val_prettyprint pretty)
+				  struct ui_file *stream,
+				  int recurse,
+				  const struct value_print_options *options)
 {
   struct type *type = value_type (val);
 
@@ -942,11 +940,10 @@ pascal_object_print_static_field (struct value *val,
 
       CHECK_TYPEDEF (type);
       pascal_object_print_value_fields (type, value_contents (val), VALUE_ADDRESS (val),
-				  stream, format, recurse, pretty, NULL, 1);
+					stream, recurse, options, NULL, 1);
       return;
     }
-  common_val_print (val, stream, format, 0, recurse, pretty,
-		    current_language);
+  common_val_print (val, stream, recurse, options, current_language);
 }
 
 extern initialize_file_ftype _initialize_pascal_valprint; /* -Wmissing-prototypes */
@@ -955,13 +952,10 @@ void
 _initialize_pascal_valprint (void)
 {
   add_setshow_boolean_cmd ("pascal_static-members", class_support,
-			   &pascal_static_field_print, _("\
+			   &user_print_options.pascal_static_field_print, _("\
 Set printing of pascal static members."), _("\
 Show printing of pascal static members."), NULL,
 			   NULL,
 			   show_pascal_static_field_print,
 			   &setprintlist, &showprintlist);
-  /* Turn on printing of static fields.  */
-  pascal_static_field_print = 1;
-
 }
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 021e191..2de3ef3 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -42,6 +42,7 @@
 #include "block.h"
 #include "disasm.h"
 #include "dfp.h"
+#include "valprint.h"
 
 #ifdef TUI
 #include "tui/tui.h"		/* For tui_active et.al.   */
@@ -55,7 +56,6 @@
 #endif
 
 extern int asm_demangle;	/* Whether to demangle syms in asm printouts */
-extern int addressprint;	/* Whether to print hex addresses in HLL " */
 
 struct format_data
   {
@@ -120,13 +120,6 @@ Printing of source filename and line number with <symbol> is %s.\n"),
 
 int current_display_number;
 
-/* Flag to low-level print routines that this value is being printed
-   in an epoch window.  We'd like to pass this as a parameter, but
-   every routine would need to take it.  Perhaps we can encapsulate
-   this in the I/O stream once we have GNU stdio. */
-
-int inspect_it = 0;
-
 struct display
   {
     /* Chain link to next auto-display item.  */
@@ -278,7 +271,8 @@ print_formatted (struct value *val, int format, int size,
 	case 's':
 	  /* FIXME: Need to handle wchar_t's here... */
 	  next_address = VALUE_ADDRESS (val)
-	    + val_print_string (VALUE_ADDRESS (val), -1, 1, stream);
+	    + val_print_string (VALUE_ADDRESS (val), -1, 1, stream,
+				&user_print_options);
 	  return;
 
 	case 'i':
@@ -298,10 +292,14 @@ print_formatted (struct value *val, int format, int size,
       || TYPE_CODE (type) == TYPE_CODE_STRUCT
       || TYPE_CODE (type) == TYPE_CODE_UNION
       || TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
-    /* If format is 0, use the 'natural' format for that type of
-       value.  If the type is non-scalar, we have to use language
-       rules to print it as a series of scalars.  */
-    value_print (val, stream, format, Val_pretty_default);
+    {
+      /* If format is 0, use the 'natural' format for that type of
+	 value.  If the type is non-scalar, we have to use language
+	 rules to print it as a series of scalars.  */
+      struct value_print_options options = user_print_options;
+      options.output_format = format;
+      value_print (val, stream, &options);
+    }
   else
     /* User specified format, so don't look to the the type to
        tell us what to do.  */
@@ -347,7 +345,7 @@ print_scalar_formatted (const void *valaddr, struct type *type,
      again.  */
   if (format == 's')
     {
-      val_print (type, valaddr, 0, 0, stream, 0, 0, 0, Val_pretty_default,
+      val_print (type, valaddr, 0, 0, stream, 0, &user_print_options,
 		 current_language);
       return;
     }
@@ -445,10 +443,10 @@ print_scalar_formatted (const void *valaddr, struct type *type,
       if (TYPE_UNSIGNED (type))
 	value_print (value_from_longest (builtin_type_true_unsigned_char,
 					 val_long),
-		     stream, 0, Val_pretty_default);
+		     stream, &user_print_options);
       else
 	value_print (value_from_longest (builtin_type_true_char, val_long),
-		     stream, 0, Val_pretty_default);
+		     stream, &user_print_options);
       break;
 
     case 'f':
@@ -711,7 +709,7 @@ print_address_demangle (CORE_ADDR addr, struct ui_file *stream,
     {
       fprintf_filtered (stream, "0");
     }
-  else if (addressprint)
+  else if (user_print_options.addressprint)
     {
       fputs_filtered (paddress (addr), stream);
       print_address_symbolic (addr, stream, do_demangle, " ");
@@ -846,10 +844,10 @@ print_command_1 (char *exp, int inspect, int voidprint)
   struct value *val;
   struct format_data fmt;
   int cleanup = 0;
+  struct value_print_options opts;
 
-  /* Pass inspect flag to the rest of the print routines in a global
-     (sigh).  */
-  inspect_it = inspect;
+  opts = user_print_options;
+  opts.inspect_it = inspect;
 
   if (exp && *exp == '/')
     {
@@ -909,7 +907,6 @@ print_command_1 (char *exp, int inspect, int voidprint)
 
   if (cleanup)
     do_cleanups (old_chain);
-  inspect_it = 0;		/* Reset print routines to normal.  */
 }
 
 static void
@@ -1678,7 +1675,7 @@ print_variable_value (struct symbol *var, struct frame_info *frame,
 {
   struct value *val = read_var_value (var, frame);
 
-  value_print (val, stream, 0, Val_pretty_default);
+  value_print (val, stream, &user_print_options);
 }
 
 static void
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 6c4be54..69179b6 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -23,6 +23,7 @@
 #include "exceptions.h"
 #include "language.h"
 #include "dfp.h"
+#include "valprint.h"
 
 /* List of all values which are currently exposed to Python. It is
    maintained so that when an objfile is discarded, preserve_values
@@ -194,8 +195,8 @@ valpy_str (PyObject *self)
 
   TRY_CATCH (except, RETURN_MASK_ALL)
     {
-      common_val_print (((value_object *) self)->value, stb, 0, 0, 0,
-			Val_pretty_default, current_language);
+      common_val_print (((value_object *) self)->value, stb, 0,
+			&user_print_options, current_language);
       s = ui_file_xstrdup (stb, &dummy);
     }
   GDB_PY_HANDLE_EXCEPTION (except);
diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c
index 42d2502..0b25590 100644
--- a/gdb/scm-lang.c
+++ b/gdb/scm-lang.c
@@ -50,7 +50,8 @@ scm_printchar (int c, struct ui_file *stream)
 
 static void
 scm_printstr (struct ui_file *stream, const gdb_byte *string,
-	      unsigned int length, int width, int force_ellipses)
+	      unsigned int length, int width, int force_ellipses,
+	      const struct value_print_options *options)
 {
   fprintf_filtered (stream, "\"%s\"", string);
 }
diff --git a/gdb/scm-lang.h b/gdb/scm-lang.h
index 654095c..369905b 100644
--- a/gdb/scm-lang.h
+++ b/gdb/scm-lang.h
@@ -46,16 +46,16 @@
 struct value;
 
 extern int scm_value_print (struct value *, struct ui_file *,
-			    int, enum val_prettyprint);
+			    const struct value_print_options *);
 
 extern int scm_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
-			  struct ui_file *, int, int, int,
-			  enum val_prettyprint);
+			  struct ui_file *, int,
+			  const struct value_print_options *);
 
 extern LONGEST scm_get_field (LONGEST, int);
 
-extern void scm_scmval_print (LONGEST, struct ui_file *, int, int, int,
-			      enum val_prettyprint);
+extern void scm_scmval_print (LONGEST, struct ui_file *, int,
+			      const struct value_print_options *);
 
 extern int is_scmvalue_type (struct type *);
 
diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c
index feb43dd..bf2e907 100644
--- a/gdb/scm-valprint.c
+++ b/gdb/scm-valprint.c
@@ -33,18 +33,18 @@
 #include "objfiles.h"
 
 static void scm_ipruk (char *, LONGEST, struct ui_file *);
-static void scm_scmlist_print (LONGEST, struct ui_file *, int, int,
-			       int, enum val_prettyprint);
-static int scm_inferior_print (LONGEST, struct ui_file *, int, int,
-			       int, enum val_prettyprint);
+static void scm_scmlist_print (LONGEST, struct ui_file *, int,
+			       const struct value_print_options *);
+static int scm_inferior_print (LONGEST, struct ui_file *, int,
+			       const struct value_print_options *);
 
 /* Prints the SCM value VALUE by invoking the inferior, if appropraite.
    Returns >= 0 on success;  return -1 if the inferior cannot/should not
    print VALUE. */
 
 static int
-scm_inferior_print (LONGEST value, struct ui_file *stream, int format,
-		    int deref_ref, int recurse, enum val_prettyprint pretty)
+scm_inferior_print (LONGEST value, struct ui_file *stream,
+		    int recurse, const struct value_print_options *options)
 {
   struct objfile *objf;
   struct gdbarch *gdbarch;
@@ -129,17 +129,16 @@ static char *scm_isymnames[] =
 };
 
 static void
-scm_scmlist_print (LONGEST svalue, struct ui_file *stream, int format,
-		   int deref_ref, int recurse, enum val_prettyprint pretty)
+scm_scmlist_print (LONGEST svalue, struct ui_file *stream, int recurse,
+		   const struct value_print_options *options)
 {
-  unsigned int more = print_max;
+  unsigned int more = options->print_max;
   if (recurse > 6)
     {
       fputs_filtered ("...", stream);
       return;
     }
-  scm_scmval_print (SCM_CAR (svalue), stream, format,
-		    deref_ref, recurse + 1, pretty);
+  scm_scmval_print (SCM_CAR (svalue), stream, recurse + 1, options);
   svalue = SCM_CDR (svalue);
   for (; SCM_NIMP (svalue); svalue = SCM_CDR (svalue))
     {
@@ -151,14 +150,12 @@ scm_scmlist_print (LONGEST svalue, struct ui_file *stream, int format,
 	  fputs_filtered ("...", stream);
 	  return;
 	}
-      scm_scmval_print (SCM_CAR (svalue), stream, format,
-			deref_ref, recurse + 1, pretty);
+      scm_scmval_print (SCM_CAR (svalue), stream, recurse + 1, options);
     }
   if (SCM_NNULLP (svalue))
     {
       fputs_filtered (" . ", stream);
-      scm_scmval_print (svalue, stream, format,
-			deref_ref, recurse + 1, pretty);
+      scm_scmval_print (svalue, stream, recurse + 1, options);
     }
 }
 
@@ -174,15 +171,17 @@ scm_ipruk (char *hdr, LONGEST ptr, struct ui_file *stream)
 }
 
 void
-scm_scmval_print (LONGEST svalue, struct ui_file *stream, int format,
-		  int deref_ref, int recurse, enum val_prettyprint pretty)
+scm_scmval_print (LONGEST svalue, struct ui_file *stream,
+		  int recurse, const struct value_print_options *options)
 {
 taloop:
   switch (7 & (int) svalue)
     {
     case 2:
     case 6:
-      print_longest (stream, format ? format : 'd', 1, svalue >> 2);
+      print_longest (stream,
+		     options->output_format ? options->output_format : 'd',
+		     1, svalue >> 2);
       break;
     case 4:
       if (SCM_ICHRP (svalue))
@@ -243,14 +242,12 @@ taloop:
 	case scm_tcs_cons_imcar:
 	case scm_tcs_cons_nimcar:
 	  fputs_filtered ("(", stream);
-	  scm_scmlist_print (svalue, stream, format,
-			     deref_ref, recurse + 1, pretty);
+	  scm_scmlist_print (svalue, stream, recurse + 1, options);
 	  fputs_filtered (")", stream);
 	  break;
 	case scm_tcs_closures:
 	  fputs_filtered ("#<CLOSURE ", stream);
-	  scm_scmlist_print (SCM_CODE (svalue), stream, format,
-			     deref_ref, recurse + 1, pretty);
+	  scm_scmlist_print (SCM_CODE (svalue), stream, recurse + 1, options);
 	  fputs_filtered (">", stream);
 	  break;
 	case scm_tc7_string:
@@ -261,9 +258,9 @@ taloop:
 	    int done = 0;
 	    int buf_size;
 	    gdb_byte buffer[64];
-	    int truncate = print_max && len > (int) print_max;
+	    int truncate = options->print_max && len > (int) options->print_max;
 	    if (truncate)
-	      len = print_max;
+	      len = options->print_max;
 	    fputs_filtered ("\"", stream);
 	    for (; done < len; done += buf_size)
 	      {
@@ -305,8 +302,8 @@ taloop:
 	      {
 		if (i > 0)
 		  fputs_filtered (" ", stream);
-		scm_scmval_print (scm_get_field (elements, i), stream, format,
-				  deref_ref, recurse + 1, pretty);
+		scm_scmval_print (scm_get_field (elements, i), stream,
+				  recurse + 1, options);
 	      }
 	    fputs_filtered (")", stream);
 	  }
@@ -401,21 +398,19 @@ taloop:
 int
 scm_val_print (struct type *type, const gdb_byte *valaddr,
 	       int embedded_offset, CORE_ADDR address,
-	       struct ui_file *stream, int format, int deref_ref,
-	       int recurse, enum val_prettyprint pretty)
+	       struct ui_file *stream, int recurse,
+	       const struct value_print_options *options)
 {
   if (is_scmvalue_type (type))
     {
       LONGEST svalue = extract_signed_integer (valaddr, TYPE_LENGTH (type));
 
-      if (scm_inferior_print (svalue, stream, format,
-			      deref_ref, recurse, pretty) >= 0)
+      if (scm_inferior_print (svalue, stream, recurse, options) >= 0)
 	{
 	}
       else
 	{
-	  scm_scmval_print (svalue, stream, format,
-			    deref_ref, recurse, pretty);
+	  scm_scmval_print (svalue, stream, recurse, options);
 	}
 
       gdb_flush (stream);
@@ -423,15 +418,13 @@ scm_val_print (struct type *type, const gdb_byte *valaddr,
     }
   else
     {
-      return c_val_print (type, valaddr, 0, address, stream, format,
-			  deref_ref, recurse, pretty);
+      return c_val_print (type, valaddr, 0, address, stream, recurse, options);
     }
 }
 
 int
-scm_value_print (struct value *val, struct ui_file *stream, int format,
-		 enum val_prettyprint pretty)
+scm_value_print (struct value *val, struct ui_file *stream,
+		 const struct value_print_options *options)
 {
-  return (common_val_print (val, stream, format, 1, 0, pretty,
-			    current_language));
+  return (common_val_print (val, stream, 0, options, current_language));
 }
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 474d49a..407206d 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -40,6 +40,7 @@
 #include "arch-utils.h"
 #include "regcache.h"
 #include "osabi.h"
+#include "valprint.h"
 
 #include "elf-bfd.h"
 
@@ -2092,6 +2093,7 @@ sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
 		  struct frame_info *frame, int regnum)
 {
   unsigned char raw_buffer[MAX_REGISTER_SIZE];
+  struct value_print_options opts;
 
   fputs_filtered (gdbarch_register_name (gdbarch, regnum), file);
   print_spaces_filtered (15 - strlen (gdbarch_register_name
@@ -2100,12 +2102,14 @@ sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file,
   /* Get the data in raw format.  */
   if (!frame_register_read (frame, regnum, raw_buffer))
     fprintf_filtered (file, "*value not available*\n");
-      
+
+  get_formatted_print_options (&opts, 'x');
   val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
-	     file, 'x', 1, 0, Val_pretty_default, current_language);
+	     file, 0, &opts, current_language);
   fprintf_filtered (file, "\t");
+  get_formatted_print_options (&opts, 0);
   val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
-	     file, 0, 1, 0, Val_pretty_default, current_language);
+	     file, 0, &opts, current_language);
   fprintf_filtered (file, "\n");
 }
 
diff --git a/gdb/stack.c b/gdb/stack.c
index 2c3c0bb..8236ae3 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -368,6 +368,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
 	      if (val)
 	        {
                   const struct language_defn *language;
+		  struct value_print_options opts;
 
                   /* Use the appropriate language to display our symbol,
                      unless the user forced the language to a specific
@@ -377,8 +378,9 @@ print_frame_args (struct symbol *func, struct frame_info *frame,
                   else
                     language = current_language;
 
-		  common_val_print (val, stb->stream, 0, 0, 2,
-				    Val_no_prettyprint, language);
+		  get_raw_print_options (&opts);
+		  common_val_print (val, stb->stream, 2,
+				    &opts, language);
 		  ui_out_field_stream (uiout, "value", stb);
 	        }
 	      else
@@ -555,7 +557,7 @@ print_frame_info (struct frame_info *frame, int print_level,
 		 line. Only the command line really wants this
 		 behavior. Other UIs probably would like the
 		 ability to decide for themselves if it is desired.  */
-	      if (addressprint && mid_statement)
+	      if (user_print_options.addressprint && mid_statement)
 		{
 		  ui_out_field_core_addr (uiout, "addr", get_frame_pc (frame));
 		  ui_out_text (uiout, "\t");
@@ -665,7 +667,7 @@ print_frame (struct frame_info *frame, int print_level,
       ui_out_field_fmt_int (uiout, 2, ui_left, "level",
 			    frame_relative_level (frame));
     }
-  if (addressprint)
+  if (user_print_options.addressprint)
     if (get_frame_pc (frame) != sal.pc || !sal.symtab
 	|| print_what == LOC_AND_ADDRESS)
       {
@@ -1408,7 +1410,7 @@ print_block_frame_labels (struct block *b, int *have_default,
 	  sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 0);
 	  values_printed = 1;
 	  fputs_filtered (SYMBOL_PRINT_NAME (sym), stream);
-	  if (addressprint)
+	  if (user_print_options.addressprint)
 	    {
 	      fprintf_filtered (stream, " ");
 	      fputs_filtered (paddress (SYMBOL_VALUE_ADDRESS (sym)), stream);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 4f5c56a..c859574 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -38,6 +38,7 @@
 #include "dictionary.h"
 #include "observer.h"
 #include "user-regs.h"
+#include "valprint.h"
 
 #include "ax.h"
 #include "ax-gdb.h"
@@ -67,7 +68,6 @@
 extern void (*deprecated_readline_begin_hook) (char *, ...);
 extern char *(*deprecated_readline_hook) (char *);
 extern void (*deprecated_readline_end_hook) (void);
-extern int addressprint;	/* Print machine addresses? */
 
 /* GDB commands implemented in other modules:
  */  
@@ -436,7 +436,7 @@ trace_mention (struct tracepoint *tp)
 {
   printf_filtered ("Tracepoint %d", tp->number);
 
-  if (addressprint || (tp->source_file == NULL))
+  if (user_print_options.addressprint || (tp->source_file == NULL))
     {
       printf_filtered (" at ");
       printf_filtered ("%s", paddress (tp->address));
@@ -467,12 +467,10 @@ tracepoints_info (char *tpnum_exp, int from_tty)
   ALL_TRACEPOINTS (t)
     if (tpnum == -1 || tpnum == t->number)
     {
-      extern int addressprint;	/* Print machine addresses?  */
-
       if (!found_a_tracepoint++)
 	{
 	  printf_filtered ("Num Enb ");
-	  if (addressprint)
+	  if (user_print_options.addressprint)
 	    {
 	      if (gdbarch_addr_bit (current_gdbarch) <= 32)
 		printf_filtered ("Address    ");
@@ -482,7 +480,7 @@ tracepoints_info (char *tpnum_exp, int from_tty)
 	  printf_filtered ("PassC StepC What\n");
 	}
       strcpy (wrap_indent, "                           ");
-      if (addressprint)
+      if (user_print_options.addressprint)
 	{
 	  if (gdbarch_addr_bit (current_gdbarch) <= 32)
 	    strcat (wrap_indent, "           ");
@@ -492,7 +490,7 @@ tracepoints_info (char *tpnum_exp, int from_tty)
 
       printf_filtered ("%-3d %-3s ", t->number,
 		       t->enabled_p ? "y" : "n");
-      if (addressprint)
+      if (user_print_options.addressprint)
 	{
 	  char *tmp;
 
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 44f1a77..af96f10 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -33,12 +33,9 @@
 #include "cp-abi.h"
 #include "typeprint.h"
 #include "gdb_string.h"
+#include "valprint.h"
 #include <errno.h>
 
-/* For real-type printing in whatis_exp() */
-extern int objectprint;		/* Controls looking up an object's derived type
-				   using what we find in its vtables.  */
-
 extern void _initialize_typeprint (void);
 
 static void ptype_command (char *, int);
@@ -107,7 +104,7 @@ whatis_exp (char *exp, int show)
 
   type = value_type (val);
 
-  if (objectprint)
+  if (user_print_options.objectprint)
     {
       if (((TYPE_CODE (type) == TYPE_CODE_PTR)
 	   || (TYPE_CODE (type) == TYPE_CODE_REF))
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 99c376f..7348176 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -60,13 +60,49 @@ static void set_output_radix_1 (int, unsigned);
 
 void _initialize_valprint (void);
 
-/* Maximum number of chars to print for a string pointer value or vector
-   contents, or UINT_MAX for no limit.  Note that "set print elements 0"
-   stores UINT_MAX in print_max, which displays in a show command as
-   "unlimited". */
-
-unsigned int print_max;
 #define PRINT_MAX_DEFAULT 200	/* Start print_max off at this value. */
+
+struct value_print_options user_print_options =
+{
+  Val_pretty_default,		/* pretty */
+  0,				/* prettyprint_arrays */
+  0,				/* prettyprint_structs */
+  0,				/* vtblprint */
+  1,				/* unionprint */
+  1,				/* addressprint */
+  0,				/* objectprint */
+  PRINT_MAX_DEFAULT,		/* print_max */
+  10,				/* repeat_count_threshold */
+  0,				/* output_format */
+  0,				/* stop_print_at_null */
+  0,				/* raw */
+  0,				/* inspect_it */
+  0,				/* print_array_indexes */
+  0,				/* deref_ref */
+  1,				/* static_field_print */
+  1				/* pascal_static_field_print */
+};
+
+/* Initialize *OPTS to be a copy of the user print options, but with
+   pretty-printing disabled.  */
+void
+get_raw_print_options (struct value_print_options *opts)
+{  
+  *opts = user_print_options;
+  opts->pretty = Val_no_prettyprint;
+  opts->raw = 1;
+}
+
+/* Initialize *OPTS to be a copy of the user print options, but using
+   FORMAT as the formatting option.  */
+void
+get_formatted_print_options (struct value_print_options *opts,
+			     char format)
+{
+  *opts = user_print_options;
+  opts->output_format = format;
+}
+
 static void
 show_print_max (struct ui_file *file, int from_tty,
 		struct cmd_list_element *c, const char *value)
@@ -103,7 +139,6 @@ int output_format = 0;
 /* By default we print arrays without printing the index of each element in
    the array.  This behavior can be changed by setting PRINT_ARRAY_INDEXES.  */
 
-static int print_array_indexes = 0;
 static void
 show_print_array_indexes (struct ui_file *file, int from_tty,
 		          struct cmd_list_element *c, const char *value)
@@ -115,7 +150,6 @@ show_print_array_indexes (struct ui_file *file, int from_tty,
    element in an array.  Referenced by the low level language dependent
    print routines. */
 
-unsigned int repeat_count_threshold = 10;
 static void
 show_repeat_count_threshold (struct ui_file *file, int from_tty,
 			     struct cmd_list_element *c, const char *value)
@@ -126,7 +160,6 @@ show_repeat_count_threshold (struct ui_file *file, int from_tty,
 
 /* If nonzero, stops printing of char arrays at first null. */
 
-int stop_print_at_null;
 static void
 show_stop_print_at_null (struct ui_file *file, int from_tty,
 			 struct cmd_list_element *c, const char *value)
@@ -138,7 +171,6 @@ Printing of char arrays to stop at first null char is %s.\n"),
 
 /* Controls pretty printing of structures. */
 
-int prettyprint_structs;
 static void
 show_prettyprint_structs (struct ui_file *file, int from_tty,
 			  struct cmd_list_element *c, const char *value)
@@ -148,7 +180,6 @@ show_prettyprint_structs (struct ui_file *file, int from_tty,
 
 /* Controls pretty printing of arrays.  */
 
-int prettyprint_arrays;
 static void
 show_prettyprint_arrays (struct ui_file *file, int from_tty,
 			 struct cmd_list_element *c, const char *value)
@@ -159,7 +190,6 @@ show_prettyprint_arrays (struct ui_file *file, int from_tty,
 /* If nonzero, causes unions inside structures or other unions to be
    printed. */
 
-int unionprint;			/* Controls printing of nested unions.  */
 static void
 show_unionprint (struct ui_file *file, int from_tty,
 		 struct cmd_list_element *c, const char *value)
@@ -171,7 +201,6 @@ Printing of unions interior to structures is %s.\n"),
 
 /* If nonzero, causes machine addresses to be printed in certain contexts. */
 
-int addressprint;		/* Controls printing of machine addresses */
 static void
 show_addressprint (struct ui_file *file, int from_tty,
 		   struct cmd_list_element *c, const char *value)
@@ -203,17 +232,18 @@ show_addressprint (struct ui_file *file, int from_tty,
 
 int
 val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
-	   CORE_ADDR address, struct ui_file *stream, int format,
-	   int deref_ref, int recurse, enum val_prettyprint pretty,
+	   CORE_ADDR address, struct ui_file *stream, int recurse,
+	   const struct value_print_options *options,
 	   const struct language_defn *language)
 {
   volatile struct gdb_exception except;
-  volatile enum val_prettyprint real_pretty = pretty;
   int ret = 0;
-
+  struct value_print_options local_opts = *options;
   struct type *real_type = check_typedef (type);
-  if (pretty == Val_pretty_default)
-    real_pretty = prettyprint_structs ? Val_prettyprint : Val_no_prettyprint;
+
+  if (local_opts.pretty == Val_pretty_default)
+    local_opts.pretty = (local_opts.prettyprint_structs
+			 ? Val_prettyprint : Val_no_prettyprint);
 
   QUIT;
 
@@ -231,8 +261,7 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
       ret = language->la_val_print (type, valaddr, embedded_offset, address,
-				    stream, format, deref_ref, recurse,
-				    real_pretty);
+				    stream, recurse, &local_opts);
     }
   if (except.reason < 0)
     fprintf_filtered (stream, _("<error reading variable>"));
@@ -277,8 +306,8 @@ value_check_printable (struct value *val, struct ui_file *stream)
    GDB's value mechanism.  */
 
 int
-common_val_print (struct value *val, struct ui_file *stream, int format,
-		  int deref_ref, int recurse, enum val_prettyprint pretty,
+common_val_print (struct value *val, struct ui_file *stream, int recurse,
+		  const struct value_print_options *options,
 		  const struct language_defn *language)
 {
   if (!value_check_printable (val, stream))
@@ -286,8 +315,7 @@ common_val_print (struct value *val, struct ui_file *stream, int format,
 
   return val_print (value_type (val), value_contents_all (val),
 		    value_embedded_offset (val), VALUE_ADDRESS (val),
-		    stream, format, deref_ref, recurse, pretty,
-		    language);
+		    stream, recurse, options, language);
 }
 
 /* Print the value VAL in C-ish syntax on stream STREAM.
@@ -296,13 +324,13 @@ common_val_print (struct value *val, struct ui_file *stream, int format,
    the number of string bytes printed.  */
 
 int
-value_print (struct value *val, struct ui_file *stream, int format,
-	     enum val_prettyprint pretty)
+value_print (struct value *val, struct ui_file *stream,
+	     const struct value_print_options *options)
 {
   if (!value_check_printable (val, stream))
     return 0;
 
-  return LA_VALUE_PRINT (val, stream, format, pretty);
+  return LA_VALUE_PRINT (val, stream, options);
 }
 
 /* Called by various <lang>_val_print routines to print
@@ -928,15 +956,6 @@ print_char_chars (struct ui_file *stream, const gdb_byte *valaddr,
     }
 }
 
-/* Return non-zero if the debugger should print the index of each element
-   when printing array values.  */
-
-int
-print_array_indexes_p (void)
-{              
-  return print_array_indexes;
-} 
-
 /* Assuming TYPE is a simple, non-empty array type, compute its upper
    and lower bound.  Save the low bound into LOW_BOUND if not NULL.
    Save the high bound into HIGH_BOUND if not NULL.
@@ -997,18 +1016,18 @@ get_array_bounds (struct type *type, long *low_bound, long *high_bound)
     
 void  
 maybe_print_array_index (struct type *index_type, LONGEST index,
-                         struct ui_file *stream, int format,
-                         enum val_prettyprint pretty)
+                         struct ui_file *stream,
+			 const struct value_print_options *options)
 {
   struct value *index_value;
 
-  if (!print_array_indexes)
+  if (!options->print_array_indexes)
     return; 
     
   index_value = value_from_longest (index_type, index);
 
-  LA_PRINT_ARRAY_INDEX (index_value, stream, format, pretty);
-}   
+  LA_PRINT_ARRAY_INDEX (index_value, stream, options);
+}
 
 /*  Called by various <lang>_val_print routines to print elements of an
    array in the form "<elem1>, <elem2>, <elem3>, ...".
@@ -1022,8 +1041,8 @@ maybe_print_array_index (struct type *index_type, LONGEST index,
 void
 val_print_array_elements (struct type *type, const gdb_byte *valaddr,
 			  CORE_ADDR address, struct ui_file *stream,
-			  int format, int deref_ref,
-			  int recurse, enum val_prettyprint pretty,
+			  int recurse,
+			  const struct value_print_options *options,
 			  unsigned int i)
 {
   unsigned int things_printed = 0;
@@ -1070,11 +1089,11 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
 
   annotate_array_section_begin (i, elttype);
 
-  for (; i < len && things_printed < print_max; i++)
+  for (; i < len && things_printed < options->print_max; i++)
     {
       if (i != 0)
 	{
-	  if (prettyprint_arrays)
+	  if (options->prettyprint_arrays)
 	    {
 	      fprintf_filtered (stream, ",\n");
 	      print_spaces_filtered (2 + 2 * recurse, stream);
@@ -1086,7 +1105,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
 	}
       wrap_here (n_spaces (2 + 2 * recurse));
       maybe_print_array_index (index_type, i + low_bound_index,
-                               stream, format, pretty);
+                               stream, options);
 
       rep1 = i + 1;
       reps = 1;
@@ -1097,21 +1116,21 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr,
 	  ++rep1;
 	}
 
-      if (reps > repeat_count_threshold)
+      if (reps > options->repeat_count_threshold)
 	{
-	  val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
-		     deref_ref, recurse + 1, pretty, current_language);
+	  val_print (elttype, valaddr + i * eltlen, 0, 0, stream,
+		     recurse + 1, options, current_language);
 	  annotate_elt_rep (reps);
 	  fprintf_filtered (stream, " <repeats %u times>", reps);
 	  annotate_elt_rep_end ();
 
 	  i = rep1 - 1;
-	  things_printed += repeat_count_threshold;
+	  things_printed += options->repeat_count_threshold;
 	}
       else
 	{
-	  val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
-		     deref_ref, recurse + 1, pretty, current_language);
+	  val_print (elttype, valaddr + i * eltlen, 0, 0, stream,
+		     recurse + 1, options, current_language);
 	  annotate_elt ();
 	  things_printed++;
 	}
@@ -1173,7 +1192,8 @@ partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int *errnoptr
 /* FIXME: Use target_read_string.  */
 
 int
-val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
+val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream,
+		  const struct value_print_options *options)
 {
   int force_ellipsis = 0;	/* Force ellipsis to be printed if nonzero. */
   int errcode;			/* Errno returned from bad reads. */
@@ -1194,7 +1214,7 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
      because finding the null byte (or available memory) is what actually
      limits the fetch. */
 
-  fetchlimit = (len == -1 ? print_max : min (len, print_max));
+  fetchlimit = (len == -1 ? options->print_max : min (len, options->print_max));
 
   /* Now decide how large of chunks to try to read in one operation.  This
      is also pretty simple.  If LEN >= zero, then we want fetchlimit chars,
@@ -1317,11 +1337,11 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream)
      and then the error message.  */
   if (errcode == 0 || bufptr > buffer)
     {
-      if (addressprint)
+      if (options->addressprint)
 	{
 	  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, options);
     }
 
   if (errcode != 0)
@@ -1494,7 +1514,8 @@ _initialize_valprint (void)
   add_alias_cmd ("p", "print", no_class, 1, &showlist);
   add_alias_cmd ("pr", "print", no_class, 1, &showlist);
 
-  add_setshow_uinteger_cmd ("elements", no_class, &print_max, _("\
+  add_setshow_uinteger_cmd ("elements", no_class,
+			    &user_print_options.print_max, _("\
 Set limit on string chars or array elements to print."), _("\
 Show limit on string chars or array elements to print."), _("\
 \"set print elements 0\" causes there to be no limit."),
@@ -1502,7 +1523,8 @@ Show limit on string chars or array elements to print."), _("\
 			    show_print_max,
 			    &setprintlist, &showprintlist);
 
-  add_setshow_boolean_cmd ("null-stop", no_class, &stop_print_at_null, _("\
+  add_setshow_boolean_cmd ("null-stop", no_class,
+			   &user_print_options.stop_print_at_null, _("\
 Set printing of char arrays to stop at first null char."), _("\
 Show printing of char arrays to stop at first null char."), NULL,
 			   NULL,
@@ -1510,7 +1532,7 @@ Show printing of char arrays to stop at first null char."), NULL,
 			   &setprintlist, &showprintlist);
 
   add_setshow_uinteger_cmd ("repeats", no_class,
-			    &repeat_count_threshold, _("\
+			    &user_print_options.repeat_count_threshold, _("\
 Set threshold for repeated print elements."), _("\
 Show threshold for repeated print elements."), _("\
 \"set print repeats 0\" causes all elements to be individually printed."),
@@ -1518,28 +1540,32 @@ Show threshold for repeated print elements."), _("\
 			    show_repeat_count_threshold,
 			    &setprintlist, &showprintlist);
 
-  add_setshow_boolean_cmd ("pretty", class_support, &prettyprint_structs, _("\
+  add_setshow_boolean_cmd ("pretty", class_support,
+			   &user_print_options.prettyprint_structs, _("\
 Set prettyprinting of structures."), _("\
 Show prettyprinting of structures."), NULL,
 			   NULL,
 			   show_prettyprint_structs,
 			   &setprintlist, &showprintlist);
 
-  add_setshow_boolean_cmd ("union", class_support, &unionprint, _("\
+  add_setshow_boolean_cmd ("union", class_support,
+			   &user_print_options.unionprint, _("\
 Set printing of unions interior to structures."), _("\
 Show printing of unions interior to structures."), NULL,
 			   NULL,
 			   show_unionprint,
 			   &setprintlist, &showprintlist);
 
-  add_setshow_boolean_cmd ("array", class_support, &prettyprint_arrays, _("\
+  add_setshow_boolean_cmd ("array", class_support,
+			   &user_print_options.prettyprint_arrays, _("\
 Set prettyprinting of arrays."), _("\
 Show prettyprinting of arrays."), NULL,
 			   NULL,
 			   show_prettyprint_arrays,
 			   &setprintlist, &showprintlist);
 
-  add_setshow_boolean_cmd ("address", class_support, &addressprint, _("\
+  add_setshow_boolean_cmd ("address", class_support,
+			   &user_print_options.addressprint, _("\
 Set printing of addresses."), _("\
 Show printing of addresses."), NULL,
 			   NULL,
@@ -1578,15 +1604,8 @@ Use 'show input-radix' or 'show output-radix' to independently show each."),
 	   &showlist);
 
   add_setshow_boolean_cmd ("array-indexes", class_support,
-                           &print_array_indexes, _("\
+                           &user_print_options.print_array_indexes, _("\
 Set printing of array indexes."), _("\
 Show printing of array indexes"), NULL, NULL, show_print_array_indexes,
                            &setprintlist, &showprintlist);
-
-  /* Give people the defaults which they are used to.  */
-  prettyprint_structs = 0;
-  prettyprint_arrays = 0;
-  unionprint = 1;
-  addressprint = 1;
-  print_max = PRINT_MAX_DEFAULT;
 }
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 3b20516..f9d7501 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -21,45 +21,91 @@
 #ifndef VALPRINT_H
 #define VALPRINT_H
 
-extern int prettyprint_arrays;	/* Controls pretty printing of arrays.  */
-extern int prettyprint_structs;	/* Controls pretty printing of structures */
-extern int prettyprint_arrays;	/* Controls pretty printing of arrays.  */
+/* This is used to pass formatting options to various value-printing
+   functions.  */
+struct value_print_options
+{
+  /* Pretty-printing control.  */
+  enum val_prettyprint pretty;
 
-extern int vtblprint;		/* Controls printing of vtbl's */
-extern int unionprint;		/* Controls printing of nested unions.  */
-extern int addressprint;	/* Controls pretty printing of addresses.  */
-extern int objectprint;		/* Controls looking up an object's derived type
-				   using what we find in its vtables.  */
+  /* Controls pretty printing of arrays.  */
+  int prettyprint_arrays;
 
-extern unsigned int print_max;	/* Max # of chars for strings/vectors */
+  /* Controls pretty printing of structures.  */
+  int prettyprint_structs;
 
-/* Flag to low-level print routines that this value is being printed
-   in an epoch window.  We'd like to pass this as a parameter, but
-   every routine would need to take it.  Perhaps we can encapsulate
-   this in the I/O stream once we have GNU stdio. */
-extern int inspect_it;
+  /* Controls printing of virtual tables.  */
+  int vtblprint;
 
-/* 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;
+  /* Controls printing of nested unions.  */
+  int unionprint;
 
-extern int output_format;
+  /* Controls printing of addresses.  */
+  int addressprint;
 
-extern int stop_print_at_null;	/* Stop printing at null char? */
+  /* Controls looking up an object's derived type using what we find
+     in its vtables.  */
+  int objectprint;
+
+  /* Maximum number of chars to print for a string pointer value or vector
+     contents, or UINT_MAX for no limit.  Note that "set print elements 0"
+     stores UINT_MAX in print_max, which displays in a show command as
+     "unlimited". */
+  unsigned int print_max;
+
+  /* Print repeat counts if there are more than this many repetitions
+     of an element in an array.  */
+  unsigned int repeat_count_threshold;
+
+  int output_format;
+
+  /* Stop printing at null character?  */
+  int stop_print_at_null;
+
+  /* If true, print "raw" -- bypass any Python pretty-printers.  */
+  int raw;
+
+  /* True if this value is being printed in an epoch window.  */
+  int inspect_it;
+
+  /* True if we should print the index of each element when printing
+     an array.  */
+  int print_array_indexes;
+
+  /* If nonzero, then dereference references, otherwise just print
+     them like pointers.  */
+  int deref_ref;
+
+  /* If nonzero, print static fields.  */
+  int static_field_print;
+
+  /* If nonzero, print static fields for Pascal.  FIXME: C++ and Java
+     share one flag, why not Pascal too?  */
+  int pascal_static_field_print;
+};
+
+/* The global print options set by the user.  */
+extern struct value_print_options user_print_options;
+
+/* Initialize *OPTS to be a copy of the user print options, but with
+   pretty-printing disabled.  */
+extern void get_raw_print_options (struct value_print_options *opts);
+
+/* Initialize *OPTS to be a copy of the user print options, but using
+   FORMAT as the formatting option.  */
+extern void get_formatted_print_options (struct value_print_options *opts,
+					 char format);
 
-extern int print_array_indexes_p (void);
- 
 extern int get_array_bounds (struct type *type, long *low_bound,
 			     long *high_bound);
 
 extern void maybe_print_array_index (struct type *index_type, LONGEST index,
-                                     struct ui_file *stream, int format,
-                                     enum val_prettyprint pretty);
+                                     struct ui_file *stream,
+				     const struct value_print_options *options);
 
 extern void val_print_array_elements (struct type *, const gdb_byte *,
 				      CORE_ADDR, struct ui_file *, int,
-				      int, int, enum val_prettyprint,
+				      const struct value_print_options *,
 				      unsigned int);
 
 extern void val_print_type_code_int (struct type *, const gdb_byte *,
diff --git a/gdb/value.c b/gdb/value.c
index 0b530f0..514b3fc 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -36,6 +36,7 @@
 #include "block.h"
 #include "dfp.h"
 #include "objfiles.h"
+#include "valprint.h"
 
 #include "python/python.h"
 
@@ -710,7 +711,7 @@ show_values (char *num_exp, int from_tty)
     {
       val = access_value_history (i);
       printf_filtered (("$%d = "), i);
-      value_print (val, gdb_stdout, 0, Val_pretty_default);
+      value_print (val, gdb_stdout, &user_print_options);
       printf_filtered (("\n"));
     }
 
@@ -978,7 +979,7 @@ show_convenience (char *ignore, int from_tty)
 	}
       printf_filtered (("$%s = "), var->name);
       value_print (value_of_internalvar (var), gdb_stdout,
-		   0, Val_pretty_default);
+		   &user_print_options);
       printf_filtered (("\n"));
     }
   if (!varseen)
diff --git a/gdb/value.h b/gdb/value.h
index f53d333..65fea99 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -32,6 +32,7 @@ struct symbol;
 struct type;
 struct ui_file;
 struct language_defn;
+struct value_print_options;
 
 /* The structure which defines the type of a value.  It should never
    be possible for a program lval value to survive over a call to the
@@ -526,8 +527,8 @@ extern void print_floating (const gdb_byte *valaddr, struct type *type,
 extern void print_decimal_floating (const gdb_byte *valaddr, struct type *type,
 				    struct ui_file *stream);
 
-extern int value_print (struct value *val, struct ui_file *stream, int format,
-			enum val_prettyprint pretty);
+extern int value_print (struct value *val, struct ui_file *stream,
+			const struct value_print_options *options);
 
 extern void value_print_array_elements (struct value *val,
 					struct ui_file *stream, int format,
@@ -537,19 +538,18 @@ extern struct value *value_release_to_mark (struct value *mark);
 
 extern int val_print (struct type *type, const gdb_byte *valaddr,
 		      int embedded_offset, CORE_ADDR address,
-		      struct ui_file *stream, int format,
-		      int deref_ref, int recurse,
-		      enum val_prettyprint pretty,
+		      struct ui_file *stream, int recurse,
+		      const struct value_print_options *options,
 		      const struct language_defn *language);
 
 extern int common_val_print (struct value *val,
-			     struct ui_file *stream, int format,
-			     int deref_ref, int recurse,
-			     enum val_prettyprint pretty,
+			     struct ui_file *stream, int recurse,
+			     const struct value_print_options *options,
 			     const struct language_defn *language);
 
 extern int val_print_string (CORE_ADDR addr, int len, int width,
-			     struct ui_file *stream);
+			     struct ui_file *stream,
+			     const struct value_print_options *options);
 
 extern void print_variable_value (struct symbol *var,
 				  struct frame_info *frame,
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 15cbd45..a9b6579 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -25,6 +25,7 @@
 #include "wrapper.h"
 #include "gdbcmd.h"
 #include "block.h"
+#include "valprint.h"
 
 #include "gdb_assert.h"
 #include "gdb_string.h"
@@ -1791,6 +1792,7 @@ value_get_print_value (struct value *value, enum varobj_display_formats format)
   struct ui_file *stb;
   struct cleanup *old_chain;
   char *thevalue;
+  struct value_print_options opts;
 
   if (value == NULL)
     return NULL;
@@ -1798,7 +1800,8 @@ value_get_print_value (struct value *value, enum varobj_display_formats format)
   stb = mem_fileopen ();
   old_chain = make_cleanup_ui_file_delete (stb);
 
-  common_val_print (value, stb, format_code[(int) format], 1, 0, 0,
+  get_formatted_print_options (&opts, format_code[(int) format]);
+  common_val_print (value, stb, 0, &opts,
 		    current_language);
   thevalue = ui_file_xstrdup (stb, &dummy);
 

  parent reply	other threads:[~2008-10-21 19:33 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09 14:05 Joel Brobecker
2008-10-09 16:13 ` Tom Tromey
2008-10-09 22:20   ` Joel Brobecker
2008-10-20 16:16 ` Joel Brobecker
2008-10-20 19:03   ` Thiago Jung Bauermann
2008-10-21  0:47     ` Daniel Jacobowitz
2008-10-21 18:06       ` Ulrich Weigand
2008-10-21 18:18         ` Daniel Jacobowitz
2008-10-22  1:40           ` Joel Brobecker
2008-10-22 20:15             ` Tom Tromey
2008-10-22 20:36               ` Joel Brobecker
2008-10-21  1:22   ` Tom Tromey
2008-10-21  7:07     ` Joel Brobecker
2008-10-21 18:12     ` Ulrich Weigand
2008-10-21 18:58       ` Tom Tromey
2008-10-21 19:33       ` Tom Tromey [this message]
2008-10-22 18:03         ` Ulrich Weigand
2008-10-22 18:54           ` Tom Tromey
2008-10-22 22:24             ` Ulrich Weigand
2008-10-23  1:02               ` Tom Tromey
2008-10-23 19:50                 ` Ulrich Weigand
2008-10-23 21:29                   ` Tom Tromey
2008-10-24 13:01                     ` Ulrich Weigand
2008-10-25 16:05                       ` Tom Tromey
2008-10-27 17:07                       ` Tom Tromey
2008-10-28 16:27                         ` Ulrich Weigand
2008-10-28 18:17                           ` Tom Tromey
2008-10-28 20:00                             ` Ulrich Weigand
2008-10-25 16:25                     ` Joel Brobecker
2008-10-25 16:46                       ` Tom Tromey
2008-10-26 15:19                         ` Joel Brobecker
2008-10-21 18:05 ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m37i819232.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox