Unify gdb printf functions
Now that filtered and unfiltered output can be treated identically, we can unify the printf family of functions. This is done under the name "gdb_printf". Most of this patch was written by script.
This commit is contained in:
parent
a11ac3b3e8
commit
6cb06a8cda
249 changed files with 8449 additions and 8463 deletions
|
@ -87,10 +87,10 @@ pascal_language::print_typedef (struct type *type, struct symbol *new_symbol,
|
|||
struct ui_file *stream) const
|
||||
{
|
||||
type = check_typedef (type);
|
||||
fprintf_filtered (stream, "type ");
|
||||
fprintf_filtered (stream, "%s = ", new_symbol->print_name ());
|
||||
gdb_printf (stream, "type ");
|
||||
gdb_printf (stream, "%s = ", new_symbol->print_name ());
|
||||
type_print (type, "", stream, 0);
|
||||
fprintf_filtered (stream, ";");
|
||||
gdb_printf (stream, ";");
|
||||
}
|
||||
|
||||
/* See p-lang.h. */
|
||||
|
@ -105,11 +105,11 @@ pascal_language::type_print_derivation_info (struct ui_file *stream,
|
|||
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
|
||||
{
|
||||
gdb_puts (i == 0 ? ": " : ", ", stream);
|
||||
fprintf_filtered (stream, "%s%s ",
|
||||
BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
|
||||
BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
|
||||
gdb_printf (stream, "%s%s ",
|
||||
BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
|
||||
BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
|
||||
name = TYPE_BASECLASS (type, i)->name ();
|
||||
fprintf_filtered (stream, "%s", name ? name : "(null)");
|
||||
gdb_printf (stream, "%s", name ? name : "(null)");
|
||||
}
|
||||
if (i > 0)
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ pascal_language::type_print_varspec_prefix (struct type *type,
|
|||
switch (type->code ())
|
||||
{
|
||||
case TYPE_CODE_PTR:
|
||||
fprintf_filtered (stream, "^");
|
||||
gdb_printf (stream, "^");
|
||||
type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1,
|
||||
flags);
|
||||
break; /* Pointer should be handled normally
|
||||
|
@ -191,58 +191,58 @@ pascal_language::type_print_varspec_prefix (struct type *type,
|
|||
|
||||
case TYPE_CODE_METHOD:
|
||||
if (passed_a_ptr)
|
||||
fprintf_filtered (stream, "(");
|
||||
gdb_printf (stream, "(");
|
||||
if (TYPE_TARGET_TYPE (type) != NULL
|
||||
&& TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
|
||||
{
|
||||
fprintf_filtered (stream, "function ");
|
||||
gdb_printf (stream, "function ");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_filtered (stream, "procedure ");
|
||||
gdb_printf (stream, "procedure ");
|
||||
}
|
||||
|
||||
if (passed_a_ptr)
|
||||
{
|
||||
fprintf_filtered (stream, " ");
|
||||
gdb_printf (stream, " ");
|
||||
type_print_base (TYPE_SELF_TYPE (type),
|
||||
stream, 0, passed_a_ptr, flags);
|
||||
fprintf_filtered (stream, "::");
|
||||
gdb_printf (stream, "::");
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_REF:
|
||||
type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1,
|
||||
flags);
|
||||
fprintf_filtered (stream, "&");
|
||||
gdb_printf (stream, "&");
|
||||
break;
|
||||
|
||||
case TYPE_CODE_FUNC:
|
||||
if (passed_a_ptr)
|
||||
fprintf_filtered (stream, "(");
|
||||
gdb_printf (stream, "(");
|
||||
|
||||
if (TYPE_TARGET_TYPE (type) != NULL
|
||||
&& TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
|
||||
{
|
||||
fprintf_filtered (stream, "function ");
|
||||
gdb_printf (stream, "function ");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_filtered (stream, "procedure ");
|
||||
gdb_printf (stream, "procedure ");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TYPE_CODE_ARRAY:
|
||||
if (passed_a_ptr)
|
||||
fprintf_filtered (stream, "(");
|
||||
fprintf_filtered (stream, "array ");
|
||||
gdb_printf (stream, "(");
|
||||
gdb_printf (stream, "array ");
|
||||
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
|
||||
&& type->bounds ()->high.kind () != PROP_UNDEFINED)
|
||||
fprintf_filtered (stream, "[%s..%s] ",
|
||||
plongest (type->bounds ()->low.const_val ()),
|
||||
plongest (type->bounds ()->high.const_val ()));
|
||||
fprintf_filtered (stream, "of ");
|
||||
gdb_printf (stream, "[%s..%s] ",
|
||||
plongest (type->bounds ()->low.const_val ()),
|
||||
plongest (type->bounds ()->high.const_val ()));
|
||||
gdb_printf (stream, "of ");
|
||||
break;
|
||||
|
||||
case TYPE_CODE_UNDEF:
|
||||
|
@ -280,7 +280,7 @@ pascal_language::print_func_args (struct type *type, struct ui_file *stream,
|
|||
|
||||
if (len)
|
||||
{
|
||||
fprintf_filtered (stream, "(");
|
||||
gdb_printf (stream, "(");
|
||||
}
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ pascal_language::print_func_args (struct type *type, struct ui_file *stream,
|
|||
/* Can we find if it is a var parameter ??
|
||||
if ( TYPE_FIELD(type, i) == )
|
||||
{
|
||||
fprintf_filtered (stream, "var ");
|
||||
gdb_printf (stream, "var ");
|
||||
} */
|
||||
print_type (type->field (i).type (), "" /* TYPE_FIELD_NAME
|
||||
seems invalid! */
|
||||
|
@ -300,7 +300,7 @@ pascal_language::print_func_args (struct type *type, struct ui_file *stream,
|
|||
}
|
||||
if (len)
|
||||
{
|
||||
fprintf_filtered (stream, ")");
|
||||
gdb_printf (stream, ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ pascal_language::type_print_func_varspec_suffix (struct type *type,
|
|||
if (TYPE_TARGET_TYPE (type) == NULL
|
||||
|| TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
|
||||
{
|
||||
fprintf_filtered (stream, " : ");
|
||||
gdb_printf (stream, " : ");
|
||||
type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
|
||||
stream, 0, 0, flags);
|
||||
|
||||
|
@ -352,12 +352,12 @@ pascal_language::type_print_varspec_suffix (struct type *type,
|
|||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
if (passed_a_ptr)
|
||||
fprintf_filtered (stream, ")");
|
||||
gdb_printf (stream, ")");
|
||||
break;
|
||||
|
||||
case TYPE_CODE_METHOD:
|
||||
if (passed_a_ptr)
|
||||
fprintf_filtered (stream, ")");
|
||||
gdb_printf (stream, ")");
|
||||
type_print_method_args ("", "", stream);
|
||||
type_print_func_varspec_suffix (type, stream, show,
|
||||
passed_a_ptr, 0, flags);
|
||||
|
@ -371,7 +371,7 @@ pascal_language::type_print_varspec_suffix (struct type *type,
|
|||
|
||||
case TYPE_CODE_FUNC:
|
||||
if (passed_a_ptr)
|
||||
fprintf_filtered (stream, ")");
|
||||
gdb_printf (stream, ")");
|
||||
if (!demangled_args)
|
||||
print_func_args (type, stream, flags);
|
||||
type_print_func_varspec_suffix (type, stream, show,
|
||||
|
@ -470,11 +470,11 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
}
|
||||
if (HAVE_CPLUS_STRUCT (type))
|
||||
{
|
||||
fprintf_filtered (stream, "class ");
|
||||
gdb_printf (stream, "class ");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_filtered (stream, "record ");
|
||||
gdb_printf (stream, "record ");
|
||||
}
|
||||
goto struct_union;
|
||||
|
||||
|
@ -484,7 +484,7 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
gdb_puts (type->name (), stream);
|
||||
gdb_puts (" = ", stream);
|
||||
}
|
||||
fprintf_filtered (stream, "case <?> of ");
|
||||
gdb_printf (stream, "case <?> of ");
|
||||
|
||||
struct_union:
|
||||
stream->wrap_here (4);
|
||||
|
@ -492,21 +492,21 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
{
|
||||
/* If we just printed a tag name, no need to print anything else. */
|
||||
if (type->name () == NULL)
|
||||
fprintf_filtered (stream, "{...}");
|
||||
gdb_printf (stream, "{...}");
|
||||
}
|
||||
else if (show > 0 || type->name () == NULL)
|
||||
{
|
||||
type_print_derivation_info (stream, type);
|
||||
|
||||
fprintf_filtered (stream, "\n");
|
||||
gdb_printf (stream, "\n");
|
||||
if ((type->num_fields () == 0) && (TYPE_NFN_FIELDS (type) == 0))
|
||||
{
|
||||
if (type->is_stub ())
|
||||
fprintf_filtered (stream, "%*s<incomplete type>\n",
|
||||
level + 4, "");
|
||||
gdb_printf (stream, "%*s<incomplete type>\n",
|
||||
level + 4, "");
|
||||
else
|
||||
fprintf_filtered (stream, "%*s<no data fields>\n",
|
||||
level + 4, "");
|
||||
gdb_printf (stream, "%*s<no data fields>\n",
|
||||
level + 4, "");
|
||||
}
|
||||
|
||||
/* Start off with no specific section type, so we can print
|
||||
|
@ -537,8 +537,8 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
if (section_type != s_protected)
|
||||
{
|
||||
section_type = s_protected;
|
||||
fprintf_filtered (stream, "%*sprotected\n",
|
||||
level + 2, "");
|
||||
gdb_printf (stream, "%*sprotected\n",
|
||||
level + 2, "");
|
||||
}
|
||||
}
|
||||
else if (TYPE_FIELD_PRIVATE (type, i))
|
||||
|
@ -546,8 +546,8 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
if (section_type != s_private)
|
||||
{
|
||||
section_type = s_private;
|
||||
fprintf_filtered (stream, "%*sprivate\n",
|
||||
level + 2, "");
|
||||
gdb_printf (stream, "%*sprivate\n",
|
||||
level + 2, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -555,15 +555,15 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
if (section_type != s_public)
|
||||
{
|
||||
section_type = s_public;
|
||||
fprintf_filtered (stream, "%*spublic\n",
|
||||
level + 2, "");
|
||||
gdb_printf (stream, "%*spublic\n",
|
||||
level + 2, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
if (field_is_static (&type->field (i)))
|
||||
fprintf_filtered (stream, "static ");
|
||||
gdb_printf (stream, "static ");
|
||||
print_type (type->field (i).type (),
|
||||
type->field (i).name (),
|
||||
stream, show - 1, level + 4, flags);
|
||||
|
@ -575,16 +575,16 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
unnamed fields. This would lead to misleading
|
||||
results if the compiler does not put out fields
|
||||
for such things (I don't know what it does). */
|
||||
fprintf_filtered (stream, " : %d",
|
||||
TYPE_FIELD_BITSIZE (type, i));
|
||||
gdb_printf (stream, " : %d",
|
||||
TYPE_FIELD_BITSIZE (type, i));
|
||||
}
|
||||
fprintf_filtered (stream, ";\n");
|
||||
gdb_printf (stream, ";\n");
|
||||
}
|
||||
|
||||
/* If there are both fields and methods, put a space between. */
|
||||
len = TYPE_NFN_FIELDS (type);
|
||||
if (len && section_type != s_none)
|
||||
fprintf_filtered (stream, "\n");
|
||||
gdb_printf (stream, "\n");
|
||||
|
||||
/* Object pascal: print out the methods. */
|
||||
|
||||
|
@ -610,8 +610,8 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
if (section_type != s_protected)
|
||||
{
|
||||
section_type = s_protected;
|
||||
fprintf_filtered (stream, "%*sprotected\n",
|
||||
level + 2, "");
|
||||
gdb_printf (stream, "%*sprotected\n",
|
||||
level + 2, "");
|
||||
}
|
||||
}
|
||||
else if (TYPE_FN_FIELD_PRIVATE (f, j))
|
||||
|
@ -619,8 +619,8 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
if (section_type != s_private)
|
||||
{
|
||||
section_type = s_private;
|
||||
fprintf_filtered (stream, "%*sprivate\n",
|
||||
level + 2, "");
|
||||
gdb_printf (stream, "%*sprivate\n",
|
||||
level + 2, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -628,38 +628,38 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
if (section_type != s_public)
|
||||
{
|
||||
section_type = s_public;
|
||||
fprintf_filtered (stream, "%*spublic\n",
|
||||
level + 2, "");
|
||||
gdb_printf (stream, "%*spublic\n",
|
||||
level + 2, "");
|
||||
}
|
||||
}
|
||||
|
||||
print_spaces_filtered (level + 4, stream);
|
||||
if (TYPE_FN_FIELD_STATIC_P (f, j))
|
||||
fprintf_filtered (stream, "static ");
|
||||
gdb_printf (stream, "static ");
|
||||
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
|
||||
{
|
||||
/* Keep GDB from crashing here. */
|
||||
fprintf_filtered (stream, "<undefined type> %s;\n",
|
||||
TYPE_FN_FIELD_PHYSNAME (f, j));
|
||||
gdb_printf (stream, "<undefined type> %s;\n",
|
||||
TYPE_FN_FIELD_PHYSNAME (f, j));
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_constructor)
|
||||
{
|
||||
fprintf_filtered (stream, "constructor ");
|
||||
gdb_printf (stream, "constructor ");
|
||||
}
|
||||
else if (is_destructor)
|
||||
{
|
||||
fprintf_filtered (stream, "destructor ");
|
||||
gdb_printf (stream, "destructor ");
|
||||
}
|
||||
else if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0
|
||||
&& TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID)
|
||||
{
|
||||
fprintf_filtered (stream, "function ");
|
||||
gdb_printf (stream, "function ");
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf_filtered (stream, "procedure ");
|
||||
gdb_printf (stream, "procedure ");
|
||||
}
|
||||
/* This does not work, no idea why !! */
|
||||
|
||||
|
@ -673,12 +673,12 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
"", stream, -1);
|
||||
}
|
||||
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
|
||||
fprintf_filtered (stream, "; virtual");
|
||||
gdb_printf (stream, "; virtual");
|
||||
|
||||
fprintf_filtered (stream, ";\n");
|
||||
gdb_printf (stream, ";\n");
|
||||
}
|
||||
}
|
||||
fprintf_filtered (stream, "%*send", level, "");
|
||||
gdb_printf (stream, "%*send", level, "");
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -691,49 +691,49 @@ pascal_language::type_print_base (struct type *type, struct ui_file *stream, int
|
|||
}
|
||||
/* enum is just defined by
|
||||
type enume_name = (enum_member1,enum_member2,...) */
|
||||
fprintf_filtered (stream, " = ");
|
||||
gdb_printf (stream, " = ");
|
||||
stream->wrap_here (4);
|
||||
if (show < 0)
|
||||
{
|
||||
/* If we just printed a tag name, no need to print anything else. */
|
||||
if (type->name () == NULL)
|
||||
fprintf_filtered (stream, "(...)");
|
||||
gdb_printf (stream, "(...)");
|
||||
}
|
||||
else if (show > 0 || type->name () == NULL)
|
||||
{
|
||||
fprintf_filtered (stream, "(");
|
||||
gdb_printf (stream, "(");
|
||||
len = type->num_fields ();
|
||||
lastval = 0;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
QUIT;
|
||||
if (i)
|
||||
fprintf_filtered (stream, ", ");
|
||||
gdb_printf (stream, ", ");
|
||||
stream->wrap_here (4);
|
||||
gdb_puts (type->field (i).name (), stream);
|
||||
if (lastval != type->field (i).loc_enumval ())
|
||||
{
|
||||
fprintf_filtered (stream,
|
||||
" := %s",
|
||||
plongest (type->field (i).loc_enumval ()));
|
||||
gdb_printf (stream,
|
||||
" := %s",
|
||||
plongest (type->field (i).loc_enumval ()));
|
||||
lastval = type->field (i).loc_enumval ();
|
||||
}
|
||||
lastval++;
|
||||
}
|
||||
fprintf_filtered (stream, ")");
|
||||
gdb_printf (stream, ")");
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_CODE_VOID:
|
||||
fprintf_filtered (stream, "void");
|
||||
gdb_printf (stream, "void");
|
||||
break;
|
||||
|
||||
case TYPE_CODE_UNDEF:
|
||||
fprintf_filtered (stream, "record <unknown>");
|
||||
gdb_printf (stream, "record <unknown>");
|
||||
break;
|
||||
|
||||
case TYPE_CODE_ERROR:
|
||||
fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
|
||||
gdb_printf (stream, "%s", TYPE_ERROR_NAME (type));
|
||||
break;
|
||||
|
||||
/* this probably does not work for enums. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue