aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog48
-rw-r--r--gdb/ada-lang.c9
-rw-r--r--gdb/ada-lang.h3
-rw-r--r--gdb/ada-typeprint.c87
-rw-r--r--gdb/c-exp.y4
-rw-r--r--gdb/c-lang.h6
-rw-r--r--gdb/c-typeprint.c67
-rw-r--r--gdb/cp-valprint.c3
-rw-r--r--gdb/dwarf2read.c7
-rw-r--r--gdb/f-lang.h4
-rw-r--r--gdb/f-typeprint.c2
-rw-r--r--gdb/gnu-v3-abi.c3
-rw-r--r--gdb/go-lang.h5
-rw-r--r--gdb/go-typeprint.c5
-rw-r--r--gdb/jv-lang.h4
-rw-r--r--gdb/jv-typeprint.c19
-rw-r--r--gdb/language.c6
-rw-r--r--gdb/language.h7
-rw-r--r--gdb/m2-lang.h4
-rw-r--r--gdb/m2-typeprint.c86
-rw-r--r--gdb/p-lang.h8
-rw-r--r--gdb/p-typeprint.c65
-rw-r--r--gdb/symmisc.c10
-rw-r--r--gdb/typeprint.c13
-rw-r--r--gdb/typeprint.h14
25 files changed, 314 insertions, 175 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 91558cd..b43cebd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,51 @@
+2012-11-12 Tom Tromey <tromey@redhat.com>
+
+ * ada-lang.c (user_select_syms, ada_print_subexp): Pass flags
+ to type-printing functions.
+ * ada-lang.h (ada_print_type): Add argument.
+ * ada-typeprint.c (print_array_type, print_variant_clauses,
+ print_variant_part, print_selected_record_field_types,
+ print_record_field_types, print_unchecked_union_type,
+ print_func_type, ada_print_type): Add flags argument.
+ (ada_print_typedef): Update.
+ * c-exp.y (OPERATOR conversion_type_id): Update.
+ * c-lang.h (c_print_type, c_type_print_base): Update.
+ * c-typeprint.c (c_print_type, c_type_print_varspec_prefix,
+ c_type_print_modifier, c_type_print_args,
+ c_type_print_varspec_suffix, c_type_print_base): Add flags
+ argument.
+ * cp-valprint.c (cp_print_class_member): Update.
+ * dwarf2read.c (dwarf2_compute_name): Update.
+ * f-lang.h (f_print_type): Add argument.
+ * f-typeprint.c (f_print_type): Add flags argument.
+ * gnu-v3-abi.c (gnuv3_print_method_ptr): Update.
+ * go-lang.h (go_print_type): Add argument.
+ * go-typeprint.c (go_print_type): Add flags argument.
+ * jv-lang.h (java_print_type): Add argument.
+ * jv-typeprint.c (java_type_print_base, java_print_type): Add
+ flags argument.
+ * language.c (unk_lang_print_type): Add flags argument.
+ * language.h (struct language_defn) <la_print_type>: Add flags
+ argument.
+ (LA_PRINT_TYPE): Likewise.
+ * m2-lang.h (m2_print_type): Add argument.
+ * m2-typeprint.c (m2_print_type, m2_range, m2_typedef,
+ m2_array, m2_pointer, m2_ref, m2_procedure, m2_long_set,
+ m2_unbounded_array, m2_record_fields): Add flags argument.
+ * p-lang.h (pascal_print_type, pascal_type_print_base,
+ pascal_type_print_varspec_prefix): Add argument.
+ * p-typeprint.c (pascal_print_type,
+ pascal_type_print_varspec_prefix, pascal_print_func_args,
+ pascal_type_print_varspec_suffix, pascal_type_print_base): Add
+ flags argument.
+ * symmisc.c (print_symbol): Update.
+ * typeprint.c (type_print_raw_options, default_ptype_flags):
+ New globals.
+ (type_print): Update.
+ * typeprint.h (struct type_print_options): New.
+ (type_print_raw_options): Declare.
+ (c_type_print_varspec_suffix, c_type_print_args): Add argument.
+
2012-11-10 Keith Seitz <keiths@redhat.com>
* breakpoint.c (clear_command): Add cleanup for
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 2dde814..e1dced5 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -58,6 +58,7 @@
#include "vec.h"
#include "stack.h"
#include "gdb_vecs.h"
+#include "typeprint.h"
#include "psymtab.h"
#include "value.h"
@@ -3594,7 +3595,7 @@ See set/show multiple-symbol."));
{
printf_unfiltered (("[%d] "), i + first_choice);
ada_print_type (SYMBOL_TYPE (syms[i].sym), NULL,
- gdb_stdout, -1, 0);
+ gdb_stdout, -1, 0, &type_print_raw_options);
printf_unfiltered (_("'(%s) (enumeral)\n"),
SYMBOL_PRINT_NAME (syms[i].sym));
}
@@ -12346,7 +12347,8 @@ ada_print_subexp (struct expression *exp, int *pos,
if (exp->elts[*pos].opcode == OP_TYPE)
{
if (TYPE_CODE (exp->elts[*pos + 1].type) != TYPE_CODE_VOID)
- LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0);
+ LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0,
+ &type_print_raw_options);
*pos += 3;
}
else
@@ -12376,7 +12378,8 @@ ada_print_subexp (struct expression *exp, int *pos,
/* XXX: sprint_subexp */
print_subexp (exp, pos, stream, PREC_SUFFIX);
fputs_filtered (" in ", stream);
- LA_PRINT_TYPE (exp->elts[pc + 1].type, "", stream, 1, 0);
+ LA_PRINT_TYPE (exp->elts[pc + 1].type, "", stream, 1, 0,
+ &type_print_raw_options);
return;
case OP_DISCRETE_RANGE:
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index b56d453..fa6934b 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -23,6 +23,7 @@
struct frame_info;
struct inferior;
+struct type_print_options;
#include "value.h"
#include "gdbtypes.h"
@@ -164,7 +165,7 @@ extern void ada_error (char *); /* Defined in ada-exp.y */
/* Defined in ada-typeprint.c */
extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
- int);
+ int, const struct type_print_options *);
extern void ada_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream);
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index 40f3058..2e28b55 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -40,12 +40,15 @@
static int print_selected_record_field_types (struct type *, struct type *,
int, int,
- struct ui_file *, int, int);
+ struct ui_file *, int, int,
+ const struct type_print_options *);
static int print_record_field_types (struct type *, struct type *,
- struct ui_file *, int, int);
+ struct ui_file *, int, int,
+ const struct type_print_options *);
-static void print_array_type (struct type *, struct ui_file *, int, int);
+static void print_array_type (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
static int print_choices (struct type *, int, struct ui_file *,
struct type *);
@@ -324,7 +327,7 @@ print_fixed_point_type (struct type *type, struct ui_file *stream)
static void
print_array_type (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
int bitsize;
int n_indices;
@@ -392,7 +395,7 @@ print_array_type (struct type *type, struct ui_file *stream, int show,
fprintf_filtered (stream, ") of ");
wrap_here ("");
ada_print_type (ada_array_element_type (type, n_indices), "", stream,
- show == 0 ? 0 : show - 1, level + 1);
+ show == 0 ? 0 : show - 1, level + 1, flags);
if (bitsize > 0)
fprintf_filtered (stream, " <packed: %d-bit elements>", bitsize);
}
@@ -488,7 +491,8 @@ Huh:
static void
print_variant_clauses (struct type *type, int field_num,
struct type *outer_type, struct ui_file *stream,
- int show, int level)
+ int show, int level,
+ const struct type_print_options *flags)
{
int i;
struct type *var_type, *par_type;
@@ -514,13 +518,14 @@ print_variant_clauses (struct type *type, int field_num,
if (print_choices (var_type, i, stream, discr_type))
{
if (print_record_field_types (TYPE_FIELD_TYPE (var_type, i),
- outer_type, stream, show, level + 4)
+ outer_type, stream, show, level + 4,
+ flags)
<= 0)
fprintf_filtered (stream, " null;");
}
else
print_selected_record_field_types (var_type, outer_type, i, i,
- stream, show, level + 4);
+ stream, show, level + 4, flags);
}
}
@@ -534,13 +539,14 @@ print_variant_clauses (struct type *type, int field_num,
static void
print_variant_part (struct type *type, int field_num, struct type *outer_type,
- struct ui_file *stream, int show, int level)
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
fprintf_filtered (stream, "\n%*scase %s is", level + 4, "",
ada_variant_discrim_name
(TYPE_FIELD_TYPE (type, field_num)));
print_variant_clauses (type, field_num, outer_type, stream, show,
- level + 4);
+ level + 4, flags);
fprintf_filtered (stream, "\n%*send case;", level + 4, "");
}
@@ -556,7 +562,8 @@ print_variant_part (struct type *type, int field_num, struct type *outer_type,
static int
print_selected_record_field_types (struct type *type, struct type *outer_type,
int fld0, int fld1,
- struct ui_file *stream, int show, int level)
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
int i, flds;
@@ -573,10 +580,10 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
;
else if (ada_is_wrapper_field (type, i))
flds += print_record_field_types (TYPE_FIELD_TYPE (type, i), type,
- stream, show, level);
+ stream, show, level, flags);
else if (ada_is_variant_part (type, i))
{
- print_variant_part (type, i, outer_type, stream, show, level);
+ print_variant_part (type, i, outer_type, stream, show, level, flags);
flds = 1;
}
else
@@ -585,7 +592,7 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
fprintf_filtered (stream, "\n%*s", level + 4, "");
ada_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
+ stream, show - 1, level + 4, flags);
fprintf_filtered (stream, ";");
}
}
@@ -598,11 +605,12 @@ print_selected_record_field_types (struct type *type, struct type *outer_type,
static int
print_record_field_types (struct type *type, struct type *outer_type,
- struct ui_file *stream, int show, int level)
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
return print_selected_record_field_types (type, outer_type,
0, TYPE_NFIELDS (type) - 1,
- stream, show, level);
+ stream, show, level, flags);
}
@@ -612,7 +620,7 @@ print_record_field_types (struct type *type, struct type *outer_type,
static void
print_record_type (struct type *type0, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
struct type *parent_type;
struct type *type;
@@ -648,8 +656,9 @@ print_record_type (struct type *type0, struct ui_file *stream, int show,
flds = 0;
if (parent_type != NULL && ada_type_name (parent_type) == NULL)
flds += print_record_field_types (parent_type, parent_type,
- stream, show, level);
- flds += print_record_field_types (type, type, stream, show, level);
+ stream, show, level, flags);
+ flds += print_record_field_types (type, type, stream, show, level,
+ flags);
if (flds > 0)
fprintf_filtered (stream, "\n%*send record", level, "");
@@ -666,7 +675,8 @@ print_record_type (struct type *type0, struct ui_file *stream, int show,
number of levels of internal structure to show (see ada_print_type). */
static void
print_unchecked_union_type (struct type *type, struct ui_file *stream,
- int show, int level)
+ int show, int level,
+ const struct type_print_options *flags)
{
if (show < 0)
fprintf_filtered (stream, "record (?) is ... end record");
@@ -684,7 +694,7 @@ print_unchecked_union_type (struct type *type, struct ui_file *stream,
level + 12, "");
ada_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 12);
+ stream, show - 1, level + 12, flags);
fprintf_filtered (stream, ";");
}
@@ -699,7 +709,8 @@ print_unchecked_union_type (struct type *type, struct ui_file *stream,
for function or procedure NAME if NAME is not null. */
static void
-print_func_type (struct type *type, struct ui_file *stream, const char *name)
+print_func_type (struct type *type, struct ui_file *stream, const char *name,
+ const struct type_print_options *flags)
{
int i, len = TYPE_NFIELDS (type);
@@ -722,7 +733,8 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name)
wrap_here (" ");
}
fprintf_filtered (stream, "a%d: ", i + 1);
- ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
+ ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0,
+ flags);
}
fprintf_filtered (stream, ")");
}
@@ -730,7 +742,7 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name)
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
{
fprintf_filtered (stream, " return ");
- ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0);
+ ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags);
}
}
@@ -750,7 +762,8 @@ print_func_type (struct type *type, struct ui_file *stream, const char *name)
void
ada_print_type (struct type *type0, const char *varstring,
- struct ui_file *stream, int show, int level)
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
struct type *type = ada_check_typedef (ada_get_base_type (type0));
char *type_name = decoded_type_name (type0);
@@ -780,29 +793,31 @@ ada_print_type (struct type *type0, const char *varstring,
}
if (ada_is_aligner_type (type))
- ada_print_type (ada_aligned_type (type), "", stream, show, level);
+ ada_print_type (ada_aligned_type (type), "", stream, show, level, flags);
else if (ada_is_constrained_packed_array_type (type)
&& TYPE_CODE (type) != TYPE_CODE_PTR)
- print_array_type (type, stream, show, level);
+ print_array_type (type, stream, show, level, flags);
else
switch (TYPE_CODE (type))
{
default:
fprintf_filtered (stream, "<");
- c_print_type (type, "", stream, show, level);
+ c_print_type (type, "", stream, show, level, flags);
fprintf_filtered (stream, ">");
break;
case TYPE_CODE_PTR:
case TYPE_CODE_TYPEDEF:
fprintf_filtered (stream, "access ");
- ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
+ ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level,
+ flags);
break;
case TYPE_CODE_REF:
fprintf_filtered (stream, "<ref> ");
- ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
+ ada_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level,
+ flags);
break;
case TYPE_CODE_ARRAY:
- print_array_type (type, stream, show, level);
+ print_array_type (type, stream, show, level, flags);
break;
case TYPE_CODE_BOOL:
fprintf_filtered (stream, "(false, true)");
@@ -847,18 +862,18 @@ ada_print_type (struct type *type0, const char *varstring,
break;
case TYPE_CODE_STRUCT:
if (ada_is_array_descriptor_type (type))
- print_array_type (type, stream, show, level);
+ print_array_type (type, stream, show, level, flags);
else if (ada_is_bogus_array_descriptor (type))
fprintf_filtered (stream,
_("array (?) of ? (<mal-formed descriptor>)"));
else
- print_record_type (type, stream, show, level);
+ print_record_type (type, stream, show, level, flags);
break;
case TYPE_CODE_UNION:
- print_unchecked_union_type (type, stream, show, level);
+ print_unchecked_union_type (type, stream, show, level, flags);
break;
case TYPE_CODE_FUNC:
- print_func_type (type, stream, varstring);
+ print_func_type (type, stream, varstring, flags);
break;
}
}
@@ -870,6 +885,6 @@ ada_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream)
{
type = ada_check_typedef (type);
- ada_print_type (type, "", stream, 0, 0);
+ ada_print_type (type, "", stream, 0, 0, &type_print_raw_options);
fprintf_filtered (stream, "\n");
}
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index e5b6d94..11eaadb 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -54,6 +54,7 @@
#include "gdb_assert.h"
#include "macroscope.h"
#include "objc-lang.h"
+#include "typeprint.h"
#define parse_type builtin_type (parse_gdbarch)
@@ -1502,7 +1503,8 @@ operator: OPERATOR NEW
long length;
struct ui_file *buf = mem_fileopen ();
- c_print_type ($2, NULL, buf, -1, 0);
+ c_print_type ($2, NULL, buf, -1, 0,
+ &type_print_raw_options);
name = ui_file_xstrdup (buf, &length);
ui_file_delete (buf);
$$ = operator_stoken (name);
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index 5cbe34d..38edc3e 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -24,6 +24,7 @@
struct ui_file;
struct language_arch_info;
+struct type_print_options;
#include "value.h"
#include "macroexp.h"
@@ -65,7 +66,8 @@ extern int c_parse_escape (char **, struct obstack *);
/* Defined in c-typeprint.c */
extern void c_print_type (struct type *, const char *,
- struct ui_file *, int, int);
+ struct ui_file *, int, int,
+ const struct type_print_options *);
extern void c_print_typedef (struct type *,
struct symbol *,
@@ -110,7 +112,7 @@ extern const struct op_print c_op_print_tab[];
/* These are in c-typeprint.c: */
extern void c_type_print_base (struct type *, struct ui_file *,
- int, int);
+ int, int, const struct type_print_options *);
/* These are in cp-valprint.c */
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index a43dfce..def80b2 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -37,7 +37,8 @@
static void c_type_print_varspec_prefix (struct type *,
struct ui_file *,
- int, int, int);
+ int, int, int,
+ const struct type_print_options *);
/* Print "const", "volatile", or address space modifiers. */
static void c_type_print_modifier (struct type *,
@@ -50,7 +51,8 @@ void
c_print_type (struct type *type,
const char *varstring,
struct ui_file *stream,
- int show, int level)
+ int show, int level,
+ const struct type_print_options *flags)
{
enum type_code code;
int demangled_args;
@@ -59,7 +61,7 @@ c_print_type (struct type *type,
if (show > 0)
CHECK_TYPEDEF (type);
- c_type_print_base (type, stream, show, level);
+ c_type_print_base (type, stream, show, level, flags);
code = TYPE_CODE (type);
if ((varstring != NULL && *varstring != '\0')
/* Need a space if going to print stars or brackets;
@@ -74,7 +76,8 @@ c_print_type (struct type *type,
|| code == TYPE_CODE_REF)))
fputs_filtered (" ", stream);
need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
- c_type_print_varspec_prefix (type, stream, show, 0, need_post_space);
+ c_type_print_varspec_prefix (type, stream, show, 0, need_post_space,
+ flags);
if (varstring != NULL)
{
@@ -85,7 +88,7 @@ c_print_type (struct type *type,
demangled_args = strchr (varstring, '(') != NULL;
c_type_print_varspec_suffix (type, stream, show,
- 0, demangled_args);
+ 0, demangled_args, flags);
}
}
@@ -232,7 +235,8 @@ static void
c_type_print_varspec_prefix (struct type *type,
struct ui_file *stream,
int show, int passed_a_ptr,
- int need_post_space)
+ int need_post_space,
+ const struct type_print_options *flags)
{
const char *name;
@@ -248,39 +252,39 @@ c_type_print_varspec_prefix (struct type *type,
{
case TYPE_CODE_PTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 1, 1);
+ stream, show, 1, 1, flags);
fprintf_filtered (stream, "*");
c_type_print_modifier (type, stream, 1, need_post_space);
break;
case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0);
+ stream, show, 0, 0, flags);
name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
if (name)
fputs_filtered (name, stream);
else
c_type_print_base (TYPE_DOMAIN_TYPE (type),
- stream, -1, passed_a_ptr);
+ stream, -1, passed_a_ptr, flags);
fprintf_filtered (stream, "::*");
break;
case TYPE_CODE_METHODPTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0);
+ stream, show, 0, 0, flags);
fprintf_filtered (stream, "(");
name = type_name_no_tag (TYPE_DOMAIN_TYPE (type));
if (name)
fputs_filtered (name, stream);
else
c_type_print_base (TYPE_DOMAIN_TYPE (type),
- stream, -1, passed_a_ptr);
+ stream, -1, passed_a_ptr, flags);
fprintf_filtered (stream, "::*");
break;
case TYPE_CODE_REF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 1, 0);
+ stream, show, 1, 0, flags);
fprintf_filtered (stream, "&");
c_type_print_modifier (type, stream, 1, need_post_space);
break;
@@ -288,21 +292,21 @@ c_type_print_varspec_prefix (struct type *type,
case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0);
+ stream, show, 0, 0, flags);
if (passed_a_ptr)
fprintf_filtered (stream, "(");
break;
case TYPE_CODE_ARRAY:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, 0, 0);
+ stream, show, 0, 0, flags);
if (passed_a_ptr)
fprintf_filtered (stream, "(");
break;
case TYPE_CODE_TYPEDEF:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, show, passed_a_ptr, 0);
+ stream, show, passed_a_ptr, 0, flags);
break;
case TYPE_CODE_UNDEF:
@@ -390,7 +394,8 @@ c_type_print_modifier (struct type *type, struct ui_file *stream,
void
c_type_print_args (struct type *type, struct ui_file *stream,
- int linkage_name, enum language language)
+ int linkage_name, enum language language,
+ const struct type_print_options *flags)
{
int i, len;
struct field *args;
@@ -428,9 +433,9 @@ c_type_print_args (struct type *type, struct ui_file *stream,
}
if (language == language_java)
- java_print_type (param_type, "", stream, -1, 0);
+ java_print_type (param_type, "", stream, -1, 0, flags);
else
- c_print_type (param_type, "", stream, -1, 0);
+ c_print_type (param_type, "", stream, -1, 0, flags);
printed_any = 1;
}
@@ -599,7 +604,8 @@ void
c_type_print_varspec_suffix (struct type *type,
struct ui_file *stream,
int show, int passed_a_ptr,
- int demangled_args)
+ int demangled_args,
+ const struct type_print_options *flags)
{
if (type == 0)
return;
@@ -627,25 +633,25 @@ c_type_print_varspec_suffix (struct type *type,
fprintf_filtered (stream, (is_vector ? ")))" : "]"));
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0);
+ show, 0, 0, flags);
}
break;
case TYPE_CODE_MEMBERPTR:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0);
+ show, 0, 0, flags);
break;
case TYPE_CODE_METHODPTR:
fprintf_filtered (stream, ")");
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 0, 0);
+ show, 0, 0, flags);
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, 1, 0);
+ show, 1, 0, flags);
break;
case TYPE_CODE_METHOD:
@@ -653,14 +659,15 @@ c_type_print_varspec_suffix (struct type *type,
if (passed_a_ptr)
fprintf_filtered (stream, ")");
if (!demangled_args)
- c_type_print_args (type, stream, 0, current_language->la_language);
+ c_type_print_args (type, stream, 0, current_language->la_language,
+ flags);
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, passed_a_ptr, 0);
+ show, passed_a_ptr, 0, flags);
break;
case TYPE_CODE_TYPEDEF:
c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream,
- show, passed_a_ptr, 0);
+ show, passed_a_ptr, 0, flags);
break;
case TYPE_CODE_UNDEF:
@@ -709,7 +716,7 @@ c_type_print_varspec_suffix (struct type *type,
void
c_type_print_base (struct type *type, struct ui_file *stream,
- int show, int level)
+ int show, int level, const struct type_print_options *flags)
{
int i;
int len, real_len;
@@ -765,7 +772,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
case TYPE_CODE_METHOD:
case TYPE_CODE_METHODPTR:
c_type_print_base (TYPE_TARGET_TYPE (type),
- stream, show, level);
+ stream, show, level, flags);
break;
case TYPE_CODE_STRUCT:
@@ -943,7 +950,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
fprintf_filtered (stream, "static ");
c_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
+ stream, show - 1, level + 4, flags);
if (!field_is_static (&TYPE_FIELD (type, i))
&& TYPE_FIELD_PACKED (type, i))
{
@@ -1144,7 +1151,7 @@ c_type_print_base (struct type *type, struct ui_file *stream,
print_spaces_filtered (level + 4, stream);
fprintf_filtered (stream, "typedef ");
c_print_type (target, TYPE_TYPEDEF_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
+ stream, show - 1, level + 4, flags);
fprintf_filtered (stream, ";\n");
}
}
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index e6a99ec..4586da2 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -37,6 +37,7 @@
#include "language.h"
#include "python/python.h"
#include "exceptions.h"
+#include "typeprint.h"
/* Controls printing of vtbl's. */
static void
@@ -822,7 +823,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type,
if (name)
fputs_filtered (name, stream);
else
- c_type_print_base (domain, stream, 0, 0);
+ c_type_print_base (domain, stream, 0, 0, &type_print_raw_options);
fprintf_filtered (stream, "::");
fputs_filtered (TYPE_FIELD_NAME (domain, fieldno), stream);
}
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 1cc8f8a..8cdecde 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -7396,7 +7396,7 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
if (child->tag == DW_TAG_template_type_param)
{
- c_print_type (type, "", buf, -1, 0);
+ c_print_type (type, "", buf, -1, 0, &type_print_raw_options);
continue;
}
@@ -7470,7 +7470,8 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
{
struct type *type = read_type_die (die, cu);
- c_type_print_args (type, buf, 1, cu->language);
+ c_type_print_args (type, buf, 1, cu->language,
+ &type_print_raw_options);
if (cu->language == language_java)
{
@@ -7478,7 +7479,7 @@ dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
names. */
if (die->tag == DW_TAG_subprogram)
java_print_type (TYPE_TARGET_TYPE (type), "", buf,
- 0, 0);
+ 0, 0, &type_print_raw_options);
}
else if (cu->language == language_cplus)
{
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 895e937..1bcfd34 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -21,12 +21,14 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+struct type_print_options;
+
extern int f_parse (void);
extern void f_error (char *); /* Defined in f-exp.y */
extern void f_print_type (struct type *, const char *, struct ui_file *, int,
- int);
+ int, const struct type_print_options *);
extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int,
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index c59e639..a9940cc 100644
--- a/gdb/f-typeprint.c
+++ b/gdb/f-typeprint.c
@@ -52,7 +52,7 @@ void f_type_print_base (struct type *, struct ui_file *, int, int);
void
f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
- int show, int level)
+ int show, int level, const struct type_print_options *flags)
{
enum type_code code;
int demangled_args;
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index 3a83e2d..c025a7b 100644
--- a/gdb/gnu-v3-abi.c
+++ b/gdb/gnu-v3-abi.c
@@ -27,6 +27,7 @@
#include "valprint.h"
#include "c-lang.h"
#include "exceptions.h"
+#include "typeprint.h"
#include "gdb_assert.h"
#include "gdb_string.h"
@@ -610,7 +611,7 @@ gnuv3_print_method_ptr (const gdb_byte *contents,
{
/* Found a non-virtual function: print out the type. */
fputs_filtered ("(", stream);
- c_print_type (type, "", stream, -1, 0);
+ c_print_type (type, "", stream, -1, 0, &type_print_raw_options);
fputs_filtered (") ", stream);
}
diff --git a/gdb/go-lang.h b/gdb/go-lang.h
index 67b5d93..bdb6dee 100644
--- a/gdb/go-lang.h
+++ b/gdb/go-lang.h
@@ -20,6 +20,8 @@
#if !defined (GO_LANG_H)
#define GO_LANG_H 1
+struct type_print_options;
+
#include "gdbtypes.h"
#include "symtab.h"
#include "value.h"
@@ -75,7 +77,8 @@ extern const struct builtin_go_type *builtin_go_type (struct gdbarch *);
/* Defined in go-typeprint.c. */
extern void go_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level);
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags);
/* Defined in go-valprint.c. */
diff --git a/gdb/go-typeprint.c b/gdb/go-typeprint.c
index a76c3dc..5ab9a15 100644
--- a/gdb/go-typeprint.c
+++ b/gdb/go-typeprint.c
@@ -43,7 +43,8 @@
void
go_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level)
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
/* Borrowed from c-typeprint.c. */
if (show > 0)
@@ -58,5 +59,5 @@ go_print_type (struct type *type, const char *varstring,
}
/* Punt the rest to C for now. */
- c_print_type (type, varstring, stream, show, level);
+ c_print_type (type, varstring, stream, show, level, flags);
}
diff --git a/gdb/jv-lang.h b/gdb/jv-lang.h
index 8ea9c3c..74c77d4 100644
--- a/gdb/jv-lang.h
+++ b/gdb/jv-lang.h
@@ -22,6 +22,7 @@
#define JV_LANG_H
struct value;
+struct type_print_options;
extern int java_parse (void); /* Defined in jv-exp.y */
@@ -70,7 +71,8 @@ extern int is_object_type (struct type *);
/* Defined in jv-typeprint.c */
extern void java_print_type (struct type *, const char *,
- struct ui_file *, int, int);
+ struct ui_file *, int, int,
+ const struct type_print_options *);
extern char *java_demangle_type_signature (const char *);
diff --git a/gdb/jv-typeprint.c b/gdb/jv-typeprint.c
index 6d8ecdf..f0d3448 100644
--- a/gdb/jv-typeprint.c
+++ b/gdb/jv-typeprint.c
@@ -34,7 +34,8 @@
static void java_type_print_base (struct type * type,
struct ui_file *stream, int show,
- int level);
+ int level,
+ const struct type_print_options *flags);
static void
java_type_print_derivation_info (struct ui_file *stream, struct type *type)
@@ -84,7 +85,7 @@ java_type_print_derivation_info (struct ui_file *stream, struct type *type)
static void
java_type_print_base (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
int i;
int len;
@@ -115,7 +116,8 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
switch (TYPE_CODE (type))
{
case TYPE_CODE_PTR:
- java_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ java_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level,
+ flags);
break;
case TYPE_CODE_STRUCT:
@@ -192,7 +194,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
java_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
+ stream, show - 1, level + 4, flags);
fprintf_filtered (stream, ";\n");
}
@@ -323,7 +325,7 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
break;
default:
- c_type_print_base (type, stream, show, level);
+ c_type_print_base (type, stream, show, level, flags);
}
}
@@ -331,11 +333,12 @@ java_type_print_base (struct type *type, struct ui_file *stream, int show,
void
java_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level)
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
int demangled_args;
- java_type_print_base (type, stream, show, level);
+ java_type_print_base (type, stream, show, level, flags);
if (varstring != NULL && *varstring != '\0')
{
@@ -347,5 +350,5 @@ java_print_type (struct type *type, const char *varstring,
so don't print an additional pair of ()'s. */
demangled_args = varstring != NULL && strchr (varstring, '(') != NULL;
- c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
+ c_type_print_varspec_suffix (type, stream, show, 0, demangled_args, flags);
}
diff --git a/gdb/language.c b/gdb/language.c
index 841f2d6..5693419 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -63,9 +63,6 @@ static void unk_lang_emit_char (int c, struct type *type,
static void unk_lang_printchar (int c, struct type *type,
struct ui_file *stream);
-static void unk_lang_print_type (struct type *, const char *, struct ui_file *,
- int, int);
-
static void unk_lang_value_print (struct value *, struct ui_file *,
const struct value_print_options *);
@@ -734,7 +731,8 @@ unk_lang_printstr (struct ui_file *stream, struct type *type,
static void
unk_lang_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level)
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
error (_("internal error - unimplemented "
"function unk_lang_print_type called."));
diff --git a/gdb/language.h b/gdb/language.h
index fb63870..3a1e390 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -31,6 +31,7 @@ struct frame_info;
struct expression;
struct ui_file;
struct value_print_options;
+struct type_print_options;
#define MAX_FORTRAN_DIMS 7 /* Maximum number of F77 array dims. */
@@ -185,7 +186,7 @@ struct language_defn
/* Print a type using syntax appropriate for this language. */
void (*la_print_type) (struct type *, const char *, struct ui_file *, int,
- int);
+ int, const struct type_print_options *);
/* Print a typedef using syntax appropriate for this language.
TYPE is the underlying type. NEW_SYMBOL is the symbol naming
@@ -416,8 +417,8 @@ extern enum language set_language (enum language);
the current setting of working_lang, which the user sets
with the "set language" command. */
-#define LA_PRINT_TYPE(type,varstring,stream,show,level) \
- (current_language->la_print_type(type,varstring,stream,show,level))
+#define LA_PRINT_TYPE(type,varstring,stream,show,level,flags) \
+ (current_language->la_print_type(type,varstring,stream,show,level,flags))
#define LA_PRINT_TYPEDEF(type,new_symbol,stream) \
(current_language->la_print_typedef(type,new_symbol,stream))
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index fc6de34..d2c876c 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -18,13 +18,15 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+struct type_print_options;
+
extern int m2_parse (void); /* Defined in m2-exp.y */
extern void m2_error (char *); /* Defined in m2-exp.y */
/* Defined in m2-typeprint.c */
extern void m2_print_type (struct type *, const char *, struct ui_file *, int,
- int);
+ int, const struct type_print_options *);
extern void m2_print_typedef (struct type *, struct symbol *,
struct ui_file *);
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index c735eb7..89be6cf 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -40,23 +40,30 @@ static void m2_print_bounds (struct type *type,
struct ui_file *stream, int show, int level,
int print_high);
-static void m2_typedef (struct type *, struct ui_file *, int, int);
-static void m2_array (struct type *, struct ui_file *, int, int);
-static void m2_pointer (struct type *, struct ui_file *, int, int);
-static void m2_ref (struct type *, struct ui_file *, int, int);
-static void m2_procedure (struct type *, struct ui_file *, int, int);
+static void m2_typedef (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
+static void m2_array (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
+static void m2_pointer (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
+static void m2_ref (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
+static void m2_procedure (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
static void m2_union (struct type *, struct ui_file *);
static void m2_enum (struct type *, struct ui_file *, int, int);
-static void m2_range (struct type *, struct ui_file *, int, int);
+static void m2_range (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
static void m2_type_name (struct type *type, struct ui_file *stream);
static void m2_short_set (struct type *type, struct ui_file *stream,
int show, int level);
static int m2_long_set (struct type *type, struct ui_file *stream,
- int show, int level);
+ int show, int level, const struct type_print_options *flags);
static int m2_unbounded_array (struct type *type, struct ui_file *stream,
- int show, int level);
+ int show, int level,
+ const struct type_print_options *flags);
static void m2_record_fields (struct type *type, struct ui_file *stream,
- int show, int level);
+ int show, int level, const struct type_print_options *flags);
static void m2_unknown (const char *s, struct type *type,
struct ui_file *stream, int show, int level);
@@ -68,7 +75,8 @@ int m2_is_unbounded_array (struct type *type);
void
m2_print_type (struct type *type, const char *varstring,
struct ui_file *stream,
- int show, int level)
+ int show, int level,
+ const struct type_print_options *flags)
{
enum type_code code;
@@ -91,26 +99,26 @@ m2_print_type (struct type *type, const char *varstring,
break;
case TYPE_CODE_STRUCT:
- if (m2_long_set (type, stream, show, level)
- || m2_unbounded_array (type, stream, show, level))
+ if (m2_long_set (type, stream, show, level, flags)
+ || m2_unbounded_array (type, stream, show, level, flags))
break;
- m2_record_fields (type, stream, show, level);
+ m2_record_fields (type, stream, show, level, flags);
break;
case TYPE_CODE_TYPEDEF:
- m2_typedef (type, stream, show, level);
+ m2_typedef (type, stream, show, level, flags);
break;
case TYPE_CODE_ARRAY:
- m2_array (type, stream, show, level);
+ m2_array (type, stream, show, level, flags);
break;
case TYPE_CODE_PTR:
- m2_pointer (type, stream, show, level);
+ m2_pointer (type, stream, show, level, flags);
break;
case TYPE_CODE_REF:
- m2_ref (type, stream, show, level);
+ m2_ref (type, stream, show, level, flags);
break;
case TYPE_CODE_METHOD:
@@ -118,7 +126,7 @@ m2_print_type (struct type *type, const char *varstring,
break;
case TYPE_CODE_FUNC:
- m2_procedure (type, stream, show, level);
+ m2_procedure (type, stream, show, level, flags);
break;
case TYPE_CODE_UNION:
@@ -142,7 +150,7 @@ m2_print_type (struct type *type, const char *varstring,
break;
case TYPE_CODE_RANGE:
- m2_range (type, stream, show, level);
+ m2_range (type, stream, show, level, flags);
break;
default:
@@ -184,10 +192,11 @@ m2_type_name (struct type *type, struct ui_file *stream)
void
m2_range (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
if (TYPE_HIGH_BOUND (type) == TYPE_LOW_BOUND (type))
- m2_print_type (TYPE_DOMAIN_TYPE (type), "", stream, show, level);
+ m2_print_type (TYPE_DOMAIN_TYPE (type), "", stream, show, level,
+ flags);
else
{
struct type *target = TYPE_TARGET_TYPE (type);
@@ -202,20 +211,20 @@ m2_range (struct type *type, struct ui_file *stream, int show,
static void
m2_typedef (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
if (TYPE_NAME (type) != NULL)
{
fputs_filtered (TYPE_NAME (type), stream);
fputs_filtered (" = ", stream);
}
- m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
+ m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags);
}
/* m2_array - prints out a Modula-2 ARRAY ... OF type. */
static void m2_array (struct type *type, struct ui_file *stream,
- int show, int level)
+ int show, int level, const struct type_print_options *flags)
{
fprintf_filtered (stream, "ARRAY [");
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
@@ -233,27 +242,27 @@ static void m2_array (struct type *type, struct ui_file *stream,
/ TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
}
fprintf_filtered (stream, "] OF ");
- m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
+ m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags);
}
static void
m2_pointer (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
if (TYPE_CONST (type))
fprintf_filtered (stream, "[...] : ");
else
fprintf_filtered (stream, "POINTER TO ");
- m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
+ m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags);
}
static void
m2_ref (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
fprintf_filtered (stream, "VAR");
- m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
+ m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags);
}
static void
@@ -270,7 +279,7 @@ static void m2_union (struct type *type, struct ui_file *stream)
static void
m2_procedure (struct type *type, struct ui_file *stream,
- int show, int level)
+ int show, int level, const struct type_print_options *flags)
{
fprintf_filtered (stream, "PROCEDURE ");
m2_type_name (type, stream);
@@ -286,12 +295,12 @@ m2_procedure (struct type *type, struct ui_file *stream,
fputs_filtered (", ", stream);
wrap_here (" ");
}
- m2_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
+ m2_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0, flags);
}
if (TYPE_TARGET_TYPE (type) != NULL)
{
fprintf_filtered (stream, " : ");
- m2_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0);
+ m2_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags);
}
}
}
@@ -421,7 +430,8 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type)
}
static int
-m2_long_set (struct type *type, struct ui_file *stream, int show, int level)
+m2_long_set (struct type *type, struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
struct type *of_type;
int i;
@@ -452,7 +462,7 @@ m2_long_set (struct type *type, struct ui_file *stream, int show, int level)
fprintf_filtered(stream, "SET OF ");
i = TYPE_N_BASECLASSES (type);
if (m2_is_long_set_of_type (type, &of_type))
- m2_print_type (of_type, "", stream, show - 1, level);
+ m2_print_type (of_type, "", stream, show - 1, level, flags);
else
{
fprintf_filtered(stream, "[");
@@ -509,7 +519,7 @@ m2_is_unbounded_array (struct type *type)
static int
m2_unbounded_array (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
if (m2_is_unbounded_array (type))
{
@@ -517,7 +527,7 @@ m2_unbounded_array (struct type *type, struct ui_file *stream, int show,
{
fputs_filtered ("ARRAY OF ", stream);
m2_print_type (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)),
- "", stream, 0, level);
+ "", stream, 0, level, flags);
}
return 1;
}
@@ -526,7 +536,7 @@ m2_unbounded_array (struct type *type, struct ui_file *stream, int show,
void
m2_record_fields (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
/* Print the tag if it exists. */
if (TYPE_TAG_NAME (type) != NULL)
@@ -566,7 +576,7 @@ m2_record_fields (struct type *type, struct ui_file *stream, int show,
fputs_filtered (" : ", stream);
m2_print_type (TYPE_FIELD_TYPE (type, i),
"",
- stream, 0, level + 4);
+ stream, 0, level + 4, flags);
if (TYPE_FIELD_PACKED (type, i))
{
/* It is a bitfield. This code does not attempt
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index b1e218c..8ff4ca6 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -30,7 +30,7 @@ extern void pascal_error (char *); /* Defined in p-exp.y */
/* Defined in p-typeprint.c */
extern void pascal_print_type (struct type *, const char *, struct ui_file *,
- int, int);
+ int, int, const struct type_print_options *);
extern void pascal_print_typedef (struct type *, struct symbol *,
struct ui_file *);
@@ -63,10 +63,12 @@ extern struct type **const (pascal_builtin_types[]);
/* These are in p-typeprint.c: */
extern void
- pascal_type_print_base (struct type *, struct ui_file *, int, int);
+ pascal_type_print_base (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
extern void
- pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int);
+ pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int,
+ const struct type_print_options *);
extern void pascal_object_print_value_fields (struct type *, const gdb_byte *,
int,
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index 794d09c..9a2a0d8 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -36,20 +36,20 @@
#include <ctype.h>
static void pascal_type_print_varspec_suffix (struct type *, struct ui_file *,
- int, int, int);
+ int, int, int,
+ const struct type_print_options *);
static void pascal_type_print_derivation_info (struct ui_file *,
struct type *);
-void pascal_type_print_varspec_prefix (struct type *, struct ui_file *,
- int, int);
/* LEVEL is the depth to indent lines by. */
void
pascal_print_type (struct type *type, const char *varstring,
- struct ui_file *stream, int show, int level)
+ struct ui_file *stream, int show, int level,
+ const struct type_print_options *flags)
{
enum type_code code;
int demangled_args;
@@ -62,7 +62,7 @@ pascal_print_type (struct type *type, const char *varstring,
if ((code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD))
{
- pascal_type_print_varspec_prefix (type, stream, show, 0);
+ pascal_type_print_varspec_prefix (type, stream, show, 0, flags);
}
/* first the name */
fputs_filtered (varstring, stream);
@@ -77,15 +77,16 @@ pascal_print_type (struct type *type, const char *varstring,
if (!(code == TYPE_CODE_FUNC
|| code == TYPE_CODE_METHOD))
{
- pascal_type_print_varspec_prefix (type, stream, show, 0);
+ pascal_type_print_varspec_prefix (type, stream, show, 0, flags);
}
- pascal_type_print_base (type, stream, show, level);
+ pascal_type_print_base (type, stream, show, level, flags);
/* For demangled function names, we have the arglist as part of the name,
so don't print an additional pair of ()'s. */
demangled_args = varstring ? strchr (varstring, '(') != NULL : 0;
- pascal_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
+ pascal_type_print_varspec_suffix (type, stream, show, 0, demangled_args,
+ flags);
}
@@ -205,7 +206,8 @@ pascal_type_print_method_args (const char *physname, const char *methodname,
void
pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
- int show, int passed_a_ptr)
+ int show, int passed_a_ptr,
+ const struct type_print_options *flags)
{
if (type == 0)
return;
@@ -219,7 +221,8 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
{
case TYPE_CODE_PTR:
fprintf_filtered (stream, "^");
- pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
+ pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1,
+ flags);
break; /* Pointer should be handled normally
in pascal. */
@@ -239,13 +242,14 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
{
fprintf_filtered (stream, " ");
pascal_type_print_base (TYPE_DOMAIN_TYPE (type),
- stream, 0, passed_a_ptr);
+ stream, 0, passed_a_ptr, flags);
fprintf_filtered (stream, "::");
}
break;
case TYPE_CODE_REF:
- pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
+ pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1,
+ flags);
fprintf_filtered (stream, "&");
break;
@@ -301,7 +305,8 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
}
static void
-pascal_print_func_args (struct type *type, struct ui_file *stream)
+pascal_print_func_args (struct type *type, struct ui_file *stream,
+ const struct type_print_options *flags)
{
int i, len = TYPE_NFIELDS (type);
@@ -323,7 +328,7 @@ pascal_print_func_args (struct type *type, struct ui_file *stream)
} */
pascal_print_type (TYPE_FIELD_TYPE (type, i), "" /* TYPE_FIELD_NAME
seems invalid! */
- ,stream, -1, 0);
+ ,stream, -1, 0, flags);
}
if (len)
{
@@ -338,7 +343,8 @@ pascal_print_func_args (struct type *type, struct ui_file *stream)
static void
pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
int show, int passed_a_ptr,
- int demangled_args)
+ int demangled_args,
+ const struct type_print_options *flags)
{
if (type == 0)
return;
@@ -365,32 +371,34 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
{
fprintf_filtered (stream, " : ");
pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, 0, 0);
- pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0);
+ stream, 0, 0, flags);
+ pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0,
+ flags);
pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
- passed_a_ptr, 0);
+ passed_a_ptr, 0, flags);
}
break;
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type),
- stream, 0, 1, 0);
+ stream, 0, 1, 0, flags);
break;
case TYPE_CODE_FUNC:
if (passed_a_ptr)
fprintf_filtered (stream, ")");
if (!demangled_args)
- pascal_print_func_args (type, stream);
+ pascal_print_func_args (type, stream, flags);
if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
{
fprintf_filtered (stream, " : ");
pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
- stream, 0, 0);
- pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0);
+ stream, 0, 0, flags);
+ pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, 0,
+ flags);
pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
- passed_a_ptr, 0);
+ passed_a_ptr, 0, flags);
}
break;
@@ -436,7 +444,7 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
void
pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
- int level)
+ int level, const struct type_print_options *flags)
{
int i;
int len;
@@ -482,7 +490,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
case TYPE_CODE_REF:
/* case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD: */
- pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+ pascal_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level,
+ flags);
break;
case TYPE_CODE_ARRAY:
@@ -492,7 +501,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
stream, show, level);
pascal_type_print_varspec_suffix (TYPE_TARGET_TYPE (type),
stream, 0, 0, 0); */
- pascal_print_type (TYPE_TARGET_TYPE (type), NULL, stream, 0, 0);
+ pascal_print_type (TYPE_TARGET_TYPE (type), NULL, stream, 0, 0, flags);
break;
case TYPE_CODE_FUNC:
@@ -601,7 +610,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
fprintf_filtered (stream, "static ");
pascal_print_type (TYPE_FIELD_TYPE (type, i),
TYPE_FIELD_NAME (type, i),
- stream, show - 1, level + 4);
+ stream, show - 1, level + 4, flags);
if (!field_is_static (&TYPE_FIELD (type, i))
&& TYPE_FIELD_PACKED (type, i))
{
@@ -787,7 +796,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
case TYPE_CODE_SET:
fputs_filtered ("set of ", stream);
pascal_print_type (TYPE_INDEX_TYPE (type), "", stream,
- show - 1, level);
+ show - 1, level, flags);
break;
case TYPE_CODE_STRING:
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 9ce7679..e9bdc24 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -35,6 +35,7 @@
#include "gdb_regex.h"
#include "gdb_stat.h"
#include "dictionary.h"
+#include "typeprint.h"
#include "gdb_string.h"
#include "readline/readline.h"
@@ -480,7 +481,8 @@ print_symbol (void *args)
{
if (TYPE_TAG_NAME (SYMBOL_TYPE (symbol)))
{
- LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
+ LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
+ &type_print_raw_options);
}
else
{
@@ -490,7 +492,8 @@ print_symbol (void *args)
: (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT
? "struct" : "union")),
SYMBOL_LINKAGE_NAME (symbol));
- LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth);
+ LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
+ &type_print_raw_options);
}
fprintf_filtered (outfile, ";\n");
}
@@ -504,7 +507,8 @@ print_symbol (void *args)
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), SYMBOL_PRINT_NAME (symbol),
outfile,
TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM,
- depth);
+ depth,
+ &type_print_raw_options);
fprintf_filtered (outfile, "; ");
}
else
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index c25e705..cc51497 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -45,6 +45,17 @@ static void whatis_command (char *, int);
static void whatis_exp (char *, int);
+const struct type_print_options type_print_raw_options =
+{
+ 1 /* raw */
+};
+
+/* The default flags for 'ptype' and 'whatis'. */
+
+static struct type_print_options default_ptype_flags =
+{
+ 0 /* raw */
+};
/* Print a description of a type in the format of a
typedef for the current language.
@@ -76,7 +87,7 @@ void
type_print (struct type *type, const char *varstring, struct ui_file *stream,
int show)
{
- LA_PRINT_TYPE (type, varstring, stream, show, 0);
+ LA_PRINT_TYPE (type, varstring, stream, show, 0, &default_ptype_flags);
}
/* Print TYPE to a string, returning it. The caller is responsible for
diff --git a/gdb/typeprint.h b/gdb/typeprint.h
index 68ede62..c57c75e 100644
--- a/gdb/typeprint.h
+++ b/gdb/typeprint.h
@@ -23,10 +23,20 @@
enum language;
struct ui_file;
+struct type_print_options
+{
+ /* True means that no special printing flags should apply. */
+ unsigned int raw : 1;
+};
+
+extern const struct type_print_options type_print_raw_options;
+
void print_type_scalar (struct type * type, LONGEST, struct ui_file *);
void c_type_print_varspec_suffix (struct type *, struct ui_file *, int,
- int, int);
+ int, int, const struct type_print_options *);
+
+void c_type_print_args (struct type *, struct ui_file *, int, enum language,
+ const struct type_print_options *);
-void c_type_print_args (struct type *, struct ui_file *, int, enum language);
#endif