1 /* Language independent support for printing types for GDB, the GNU debugger.
3 Copyright (C) 1986-2021 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 #include "gdb_obstack.h"
22 #include "bfd.h" /* Binary File Description */
25 #include "expression.h"
33 #include "typeprint.h"
36 #include "cli/cli-utils.h"
37 #include "extension.h"
38 #include "completer.h"
39 #include "cli/cli-style.h"
41 const struct type_print_options type_print_raw_options
=
44 1, /* print_methods */
45 1, /* print_typedefs */
46 0, /* print_offsets */
48 0, /* print_nested_type_limit */
49 NULL
, /* local_typedefs */
50 NULL
, /* global_table */
51 NULL
/* global_printers */
54 /* The default flags for 'ptype' and 'whatis'. */
56 static struct type_print_options default_ptype_flags
=
59 1, /* print_methods */
60 1, /* print_typedefs */
61 0, /* print_offsets */
63 0, /* print_nested_type_limit */
64 NULL
, /* local_typedefs */
65 NULL
, /* global_table */
66 NULL
/* global_printers */
71 /* See typeprint.h. */
73 const int print_offset_data::indentation
= 27;
75 /* See typeprint.h. */
77 print_offset_data::print_offset_data (const struct type_print_options
*flags
)
80 print_in_hex
= flags
->print_in_hex
;
83 /* See typeprint.h. */
86 print_offset_data::maybe_print_hole (struct ui_file
*stream
,
90 /* We check for END_BITPOS > 0 because there is a specific
91 scenario when END_BITPOS can be zero and BITPOS can be >
92 0: when we are dealing with a struct/class with a virtual method.
93 Because of the vtable, the first field of the struct/class will
94 have an offset of sizeof (void *) (the size of the vtable). If
95 we do not check for END_BITPOS > 0 here, GDB will report
96 a hole before the first field, which is not accurate. */
97 if (end_bitpos
> 0 && end_bitpos
< bitpos
)
99 /* If END_BITPOS is smaller than the current type's
100 bitpos, it means there's a hole in the struct, so we report
102 unsigned int hole
= bitpos
- end_bitpos
;
103 unsigned int hole_byte
= hole
/ TARGET_CHAR_BIT
;
104 unsigned int hole_bit
= hole
% TARGET_CHAR_BIT
;
107 fprintf_filtered (stream
, "/* XXX %2u-bit %-7s */\n", hole_bit
,
111 fprintf_filtered (stream
, "/* XXX %2u-byte %-7s */\n", hole_byte
,
116 /* See typeprint.h. */
119 print_offset_data::update (struct type
*type
, unsigned int field_idx
,
120 struct ui_file
*stream
)
122 if (field_is_static (&type
->field (field_idx
)))
124 print_spaces_filtered (indentation
, stream
);
128 struct type
*ftype
= check_typedef (type
->field (field_idx
).type ());
129 if (type
->code () == TYPE_CODE_UNION
)
131 /* Since union fields don't have the concept of offsets, we just
132 print their sizes. */
133 fprintf_filtered (stream
, "/* %6s */",
135 hex_string_custom (TYPE_LENGTH (ftype
), 4) :
136 pulongest (TYPE_LENGTH (ftype
))));
140 unsigned int bitpos
= TYPE_FIELD_BITPOS (type
, field_idx
);
141 unsigned int fieldsize_byte
= TYPE_LENGTH (ftype
);
142 unsigned int fieldsize_bit
= fieldsize_byte
* TARGET_CHAR_BIT
;
144 maybe_print_hole (stream
, bitpos
, "hole");
146 if (TYPE_FIELD_PACKED (type
, field_idx
)
147 || offset_bitpos
% TARGET_CHAR_BIT
!= 0)
149 /* We're dealing with a bitfield. Print the bit offset. */
150 fieldsize_bit
= TYPE_FIELD_BITSIZE (type
, field_idx
);
152 unsigned real_bitpos
= bitpos
+ offset_bitpos
;
154 fprintf_filtered (stream
,
155 (print_in_hex
? "/* 0x%04x: 0x%x" : "/* %6u:%2u "),
156 real_bitpos
/ TARGET_CHAR_BIT
,
157 real_bitpos
% TARGET_CHAR_BIT
);
161 /* The position of the field, relative to the beginning of the
163 fprintf_filtered (stream
, (print_in_hex
? "/* 0x%04x" : "/* %6u"),
164 (bitpos
+ offset_bitpos
) / TARGET_CHAR_BIT
);
166 fprintf_filtered (stream
, " ");
169 fprintf_filtered (stream
, (print_in_hex
? " | 0x%04x */" : " | %6u */"),
172 end_bitpos
= bitpos
+ fieldsize_bit
;
175 /* See typeprint.h. */
178 print_offset_data::finish (struct type
*type
, int level
,
179 struct ui_file
*stream
)
181 unsigned int bitpos
= TYPE_LENGTH (type
) * TARGET_CHAR_BIT
;
182 maybe_print_hole (stream
, bitpos
, "padding");
184 fputs_filtered ("\n", stream
);
185 print_spaces_filtered (level
+ 4 + print_offset_data::indentation
, stream
);
186 fprintf_filtered (stream
, "/* total size (bytes): %4s */\n",
187 pulongest (TYPE_LENGTH (type
)));
192 /* A hash function for a typedef_field. */
195 hash_typedef_field (const void *p
)
197 const struct decl_field
*tf
= (const struct decl_field
*) p
;
198 struct type
*t
= check_typedef (tf
->type
);
200 return htab_hash_string (TYPE_SAFE_NAME (t
));
203 /* An equality function for a typedef field. */
206 eq_typedef_field (const void *a
, const void *b
)
208 const struct decl_field
*tfa
= (const struct decl_field
*) a
;
209 const struct decl_field
*tfb
= (const struct decl_field
*) b
;
211 return types_equal (tfa
->type
, tfb
->type
);
214 /* See typeprint.h. */
217 typedef_hash_table::recursively_update (struct type
*t
)
221 for (i
= 0; i
< TYPE_TYPEDEF_FIELD_COUNT (t
); ++i
)
223 struct decl_field
*tdef
= &TYPE_TYPEDEF_FIELD (t
, i
);
226 slot
= htab_find_slot (m_table
.get (), tdef
, INSERT
);
227 /* Only add a given typedef name once. Really this shouldn't
228 happen; but it is safe enough to do the updates breadth-first
229 and thus use the most specific typedef. */
234 /* Recurse into superclasses. */
235 for (i
= 0; i
< TYPE_N_BASECLASSES (t
); ++i
)
236 recursively_update (TYPE_BASECLASS (t
, i
));
239 /* See typeprint.h. */
242 typedef_hash_table::add_template_parameters (struct type
*t
)
246 for (i
= 0; i
< TYPE_N_TEMPLATE_ARGUMENTS (t
); ++i
)
248 struct decl_field
*tf
;
251 /* We only want type-valued template parameters in the hash. */
252 if (SYMBOL_CLASS (TYPE_TEMPLATE_ARGUMENT (t
, i
)) != LOC_TYPEDEF
)
255 tf
= XOBNEW (&m_storage
, struct decl_field
);
256 tf
->name
= TYPE_TEMPLATE_ARGUMENT (t
, i
)->linkage_name ();
257 tf
->type
= SYMBOL_TYPE (TYPE_TEMPLATE_ARGUMENT (t
, i
));
259 slot
= htab_find_slot (m_table
.get (), tf
, INSERT
);
265 /* See typeprint.h. */
267 typedef_hash_table::typedef_hash_table ()
268 : m_table (htab_create_alloc (10, hash_typedef_field
, eq_typedef_field
,
269 NULL
, xcalloc
, xfree
))
273 /* Helper function for typedef_hash_table::copy. */
276 copy_typedef_hash_element (void **slot
, void *nt
)
278 htab_t new_table
= (htab_t
) nt
;
281 new_slot
= htab_find_slot (new_table
, *slot
, INSERT
);
282 if (*new_slot
== NULL
)
288 /* See typeprint.h. */
290 typedef_hash_table::typedef_hash_table (const typedef_hash_table
&table
)
292 m_table
.reset (htab_create_alloc (10, hash_typedef_field
, eq_typedef_field
,
293 NULL
, xcalloc
, xfree
));
294 htab_traverse_noresize (table
.m_table
.get (), copy_typedef_hash_element
,
298 /* Look up the type T in the global typedef hash. If it is found,
299 return the typedef name. If it is not found, apply the
300 type-printers, if any, given by start_script_type_printers and return the
301 result. A NULL return means that the name was not found. */
304 typedef_hash_table::find_global_typedef (const struct type_print_options
*flags
,
309 struct decl_field tf
, *new_tf
;
311 if (flags
->global_typedefs
== NULL
)
317 slot
= htab_find_slot (flags
->global_typedefs
->m_table
.get (), &tf
, INSERT
);
320 new_tf
= (struct decl_field
*) *slot
;
324 /* Put an entry into the hash table now, in case
325 apply_ext_lang_type_printers recurses. */
326 new_tf
= XOBNEW (&flags
->global_typedefs
->m_storage
, struct decl_field
);
332 applied
= apply_ext_lang_type_printers (flags
->global_printers
, t
);
336 new_tf
->name
= obstack_strdup (&flags
->global_typedefs
->m_storage
,
344 /* See typeprint.h. */
347 typedef_hash_table::find_typedef (const struct type_print_options
*flags
,
350 if (flags
->local_typedefs
!= NULL
)
352 struct decl_field tf
, *found
;
356 htab_t table
= flags
->local_typedefs
->m_table
.get ();
357 found
= (struct decl_field
*) htab_find (table
, &tf
);
363 return find_global_typedef (flags
, t
);
368 /* Print a description of a type in the format of a
369 typedef for the current language.
370 NEW is the new name for a type TYPE. */
373 typedef_print (struct type
*type
, struct symbol
*newobj
, struct ui_file
*stream
)
375 current_language
->print_typedef (type
, newobj
, stream
);
378 /* Print a description of a type TYPE in the form of a declaration of a
379 variable named VARSTRING. (VARSTRING is demangled if necessary.)
380 Output goes to STREAM (via stdio).
381 If SHOW is positive, we show the contents of the outermost level
382 of structure even if there is a type name that could be used instead.
383 If SHOW is negative, we never show the details of elements' types. */
386 type_print (struct type
*type
, const char *varstring
, struct ui_file
*stream
,
389 LA_PRINT_TYPE (type
, varstring
, stream
, show
, 0, &default_ptype_flags
);
392 /* Print TYPE to a string, returning it. The caller is responsible for
393 freeing the string. */
396 type_to_string (struct type
*type
)
402 type_print (type
, "", &stb
, -1);
403 return std::move (stb
.string ());
405 catch (const gdb_exception
&except
)
412 /* See typeprint.h. */
415 type_print_unknown_return_type (struct ui_file
*stream
)
417 fprintf_styled (stream
, metadata_style
.style (),
418 _("<unknown return type>"));
421 /* See typeprint.h. */
424 error_unknown_type (const char *sym_print_name
)
426 error (_("'%s' has unknown type; cast it to its declared type"),
430 /* Print type of EXP, or last thing in value history if EXP == NULL.
431 show is passed to type_print. */
434 whatis_exp (const char *exp
, int show
)
437 struct type
*real_type
= NULL
;
442 struct value_print_options opts
;
443 struct type_print_options flags
= default_ptype_flags
;
451 for (++exp
; *exp
&& !isspace (*exp
); ++exp
)
459 flags
.print_methods
= 0;
462 flags
.print_methods
= 1;
465 flags
.print_typedefs
= 0;
468 flags
.print_typedefs
= 1;
472 /* Filter out languages which don't implement the
475 && (current_language
->la_language
== language_c
476 || current_language
->la_language
== language_cplus
477 || current_language
->la_language
== language_rust
))
479 flags
.print_offsets
= 1;
480 flags
.print_typedefs
= 0;
481 flags
.print_methods
= 0;
486 flags
.print_in_hex
= 1;
489 flags
.print_in_hex
= 0;
492 error (_("unrecognized flag '%c'"), *exp
);
497 if (!*exp
&& !seen_one
)
498 error (_("flag expected"));
500 error (_("expected space after format"));
501 exp
= skip_spaces (exp
);
504 expression_up expr
= parse_expression (exp
);
506 /* The behavior of "whatis" depends on whether the user
507 expression names a type directly, or a language expression
508 (including variable names). If the former, then "whatis"
509 strips one level of typedefs, only. If an expression,
510 "whatis" prints the type of the expression without stripping
511 any typedef level. "ptype" always strips all levels of
513 val
= evaluate_type (expr
.get ());
514 type
= value_type (val
);
516 if (show
== -1 && expr
->first_opcode () == OP_TYPE
)
518 /* The user expression names a type directly. */
520 /* If this is a typedef, then find its immediate target.
521 Use check_typedef to resolve stubs, but ignore its result
522 because we do not want to dig past all typedefs. */
523 check_typedef (type
);
524 if (type
->code () == TYPE_CODE_TYPEDEF
)
525 type
= TYPE_TARGET_TYPE (type
);
527 /* If the expression is actually a type, then there's no
528 value to fetch the dynamic type from. */
534 val
= access_value_history (0);
535 type
= value_type (val
);
538 get_user_print_options (&opts
);
539 if (val
!= NULL
&& opts
.objectprint
)
541 if (((type
->code () == TYPE_CODE_PTR
) || TYPE_IS_REFERENCE (type
))
542 && (TYPE_TARGET_TYPE (type
)->code () == TYPE_CODE_STRUCT
))
543 real_type
= value_rtti_indirect_type (val
, &full
, &top
, &using_enc
);
544 else if (type
->code () == TYPE_CODE_STRUCT
)
545 real_type
= value_rtti_type (val
, &full
, &top
, &using_enc
);
548 if (flags
.print_offsets
549 && (type
->code () == TYPE_CODE_STRUCT
550 || type
->code () == TYPE_CODE_UNION
))
551 fprintf_filtered (gdb_stdout
, "/* offset | size */ ");
553 printf_filtered ("type = ");
555 std::unique_ptr
<typedef_hash_table
> table_holder
;
556 std::unique_ptr
<ext_lang_type_printers
> printer_holder
;
559 table_holder
.reset (new typedef_hash_table
);
560 flags
.global_typedefs
= table_holder
.get ();
562 printer_holder
.reset (new ext_lang_type_printers
);
563 flags
.global_printers
= printer_holder
.get ();
568 printf_filtered ("/* real type = ");
569 type_print (real_type
, "", gdb_stdout
, -1);
571 printf_filtered (" (incomplete object)");
572 printf_filtered (" */\n");
575 LA_PRINT_TYPE (type
, "", gdb_stdout
, show
, 0, &flags
);
576 printf_filtered ("\n");
580 whatis_command (const char *exp
, int from_tty
)
582 /* Most of the time users do not want to see all the fields
583 in a structure. If they do they can use the "ptype" command.
584 Hence the "-1" below. */
585 whatis_exp (exp
, -1);
588 /* TYPENAME is either the name of a type, or an expression. */
591 ptype_command (const char *type_name
, int from_tty
)
593 whatis_exp (type_name
, 1);
596 /* Print integral scalar data VAL, of type TYPE, onto stdio stream STREAM.
597 Used to print data from type structures in a specified type. For example,
598 array bounds may be characters or booleans in some languages, and this
599 allows the ranges to be printed in their "natural" form rather than as
600 decimal integer values.
602 FIXME: This is here simply because only the type printing routines
603 currently use it, and it wasn't clear if it really belonged somewhere
604 else (like printcmd.c). There are a lot of other gdb routines that do
605 something similar, but they are generally concerned with printing values
606 that come from the inferior in target byte order and target size. */
609 print_type_scalar (struct type
*type
, LONGEST val
, struct ui_file
*stream
)
614 type
= check_typedef (type
);
616 switch (type
->code ())
620 len
= type
->num_fields ();
621 for (i
= 0; i
< len
; i
++)
623 if (TYPE_FIELD_ENUMVAL (type
, i
) == val
)
630 fputs_filtered (TYPE_FIELD_NAME (type
, i
), stream
);
634 print_longest (stream
, 'd', 0, val
);
639 print_longest (stream
, type
->is_unsigned () ? 'u' : 'd', 0, val
);
643 LA_PRINT_CHAR ((unsigned char) val
, type
, stream
);
647 fprintf_filtered (stream
, val
? "TRUE" : "FALSE");
650 case TYPE_CODE_RANGE
:
651 print_type_scalar (TYPE_TARGET_TYPE (type
), val
, stream
);
654 case TYPE_CODE_FIXED_POINT
:
655 print_type_fixed_point (type
, stream
);
658 case TYPE_CODE_UNDEF
:
660 case TYPE_CODE_ARRAY
:
661 case TYPE_CODE_STRUCT
:
662 case TYPE_CODE_UNION
:
667 case TYPE_CODE_STRING
:
668 case TYPE_CODE_ERROR
:
669 case TYPE_CODE_MEMBERPTR
:
670 case TYPE_CODE_METHODPTR
:
671 case TYPE_CODE_METHOD
:
673 case TYPE_CODE_RVALUE_REF
:
674 case TYPE_CODE_NAMESPACE
:
675 error (_("internal error: unhandled type in print_type_scalar"));
679 error (_("Invalid type code in symbol table."));
683 /* See typeprint.h. */
686 print_type_fixed_point (struct type
*type
, struct ui_file
*stream
)
688 std::string small_img
= type
->fixed_point_scaling_factor ().str ();
690 fprintf_filtered (stream
, "%s-byte fixed point (small = %s)",
691 pulongest (TYPE_LENGTH (type
)), small_img
.c_str ());
694 /* Dump details of a type specified either directly or indirectly.
695 Uses the same sort of type lookup mechanism as ptype_command()
696 and whatis_command(). */
699 maintenance_print_type (const char *type_name
, int from_tty
)
701 if (type_name
!= NULL
)
703 expression_up expr
= parse_expression (type_name
);
704 struct value
*val
= evaluate_type (expr
.get ());
705 struct type
*type
= value_type (val
);
708 recursive_dump_type (type
, 0);
713 struct cmd_list_element
*setprinttypelist
;
715 struct cmd_list_element
*showprinttypelist
;
717 static bool print_methods
= true;
720 set_print_type_methods (const char *args
,
721 int from_tty
, struct cmd_list_element
*c
)
723 default_ptype_flags
.print_methods
= print_methods
;
727 show_print_type_methods (struct ui_file
*file
, int from_tty
,
728 struct cmd_list_element
*c
, const char *value
)
730 fprintf_filtered (file
, _("Printing of methods defined in a class in %s\n"),
734 static bool print_typedefs
= true;
737 set_print_type_typedefs (const char *args
,
738 int from_tty
, struct cmd_list_element
*c
)
740 default_ptype_flags
.print_typedefs
= print_typedefs
;
744 show_print_type_typedefs (struct ui_file
*file
, int from_tty
,
745 struct cmd_list_element
*c
, const char *value
)
747 fprintf_filtered (file
, _("Printing of typedefs defined in a class in %s\n"),
751 /* Limit on the number of nested type definitions to print or -1 to print
752 all nested type definitions in a class. By default, we do not print
753 nested definitions. */
755 static int print_nested_type_limit
= 0;
757 /* Set how many nested type definitions should be printed by the type
761 set_print_type_nested_types (const char *args
, int from_tty
,
762 struct cmd_list_element
*c
)
764 default_ptype_flags
.print_nested_type_limit
= print_nested_type_limit
;
767 /* Show how many nested type definitions the type printer will print. */
770 show_print_type_nested_types (struct ui_file
*file
, int from_tty
,
771 struct cmd_list_element
*c
, const char *value
)
775 fprintf_filtered (file
,
776 _("Will not print nested types defined in a class\n"));
780 fprintf_filtered (file
,
781 _("Will print %s nested types defined in a class\n"),
786 /* When printing structs, offsets and sizes of members can be displayed using
787 decimal notation or hexadecimal notation. By default, Decimal notation is
790 static bool print_offsets_and_sizes_in_hex
= false;
792 /* Set the flags that instructs if sizes and offsets of struct members are
793 displayed in hexadecimal or decimal notation. */
796 set_print_offsets_and_sizes_in_hex (const char *args
,
797 int from_tty
, struct cmd_list_element
*c
)
799 default_ptype_flags
.print_in_hex
= print_offsets_and_sizes_in_hex
;
802 /* Display whether struct members sizes and offsets are printed
803 using decimal or hexadecimal notation. */
806 show_print_offsets_and_sizes_in_hex (struct ui_file
*file
, int from_tty
,
807 struct cmd_list_element
*c
,
810 fprintf_filtered (file
, _("\
811 Display of struct members offsets and sizes in hexadecimal is %s\n"),
815 void _initialize_typeprint ();
817 _initialize_typeprint ()
819 struct cmd_list_element
*c
;
821 c
= add_com ("ptype", class_vars
, ptype_command
, _("\
822 Print definition of type TYPE.\n\
823 Usage: ptype[/FLAGS] TYPE | EXPRESSION\n\
824 Argument may be any type (for example a type name defined by typedef,\n\
825 or \"struct STRUCT-TAG\" or \"class CLASS-NAME\" or \"union UNION-TAG\"\n\
826 or \"enum ENUM-TAG\") or an expression.\n\
827 The selected stack frame's lexical context is used to look up the name.\n\
828 Contrary to \"whatis\", \"ptype\" always unrolls any typedefs.\n\
830 Available FLAGS are:\n\
831 /r print in \"raw\" form; do not substitute typedefs\n\
832 /m do not print methods defined in a class\n\
833 /M print methods defined in a class\n\
834 /t do not print typedefs defined in a class\n\
835 /T print typedefs defined in a class\n\
836 /o print offsets and sizes of fields in a struct (like pahole)\n\
837 /x use hexadecimal notation when displaying sizes and offsets\n\
839 /d use decimal notation when displaying sizes and offsets\n\
840 of struct members "));
841 set_cmd_completer (c
, expression_completer
);
843 c
= add_com ("whatis", class_vars
, whatis_command
,
844 _("Print data type of expression EXP.\n\
845 Only one level of typedefs is unrolled. See also \"ptype\"."));
846 set_cmd_completer (c
, expression_completer
);
848 add_show_prefix_cmd ("type", no_class
,
849 _("Generic command for showing type-printing settings."),
850 &showprinttypelist
, 0, &showprintlist
);
851 add_basic_prefix_cmd ("type", no_class
,
852 _("Generic command for setting how types print."),
853 &setprinttypelist
, 0, &setprintlist
);
855 add_setshow_boolean_cmd ("methods", no_class
, &print_methods
,
857 Set printing of methods defined in classes."), _("\
858 Show printing of methods defined in classes."), NULL
,
859 set_print_type_methods
,
860 show_print_type_methods
,
861 &setprinttypelist
, &showprinttypelist
);
862 add_setshow_boolean_cmd ("typedefs", no_class
, &print_typedefs
,
864 Set printing of typedefs defined in classes."), _("\
865 Show printing of typedefs defined in classes."), NULL
,
866 set_print_type_typedefs
,
867 show_print_type_typedefs
,
868 &setprinttypelist
, &showprinttypelist
);
870 add_setshow_zuinteger_unlimited_cmd ("nested-type-limit", no_class
,
871 &print_nested_type_limit
,
873 Set the number of recursive nested type definitions to print \
874 (\"unlimited\" or -1 to show all)."), _("\
875 Show the number of recursive nested type definitions to print."), NULL
,
876 set_print_type_nested_types
,
877 show_print_type_nested_types
,
878 &setprinttypelist
, &showprinttypelist
);
880 add_setshow_boolean_cmd ("hex", no_class
, &print_offsets_and_sizes_in_hex
,
882 Set printing of struct members sizes and offsets using hex notation."), _("\
883 Show whether sizes and offsets of struct members are printed using hex \
884 notation."), nullptr, set_print_offsets_and_sizes_in_hex
,
885 show_print_offsets_and_sizes_in_hex
,
886 &setprinttypelist
, &showprinttypelist
);
889 /* Print <not allocated> status to stream STREAM. */
892 val_print_not_allocated (struct ui_file
*stream
)
894 fprintf_styled (stream
, metadata_style
.style (), _("<not allocated>"));
897 /* Print <not associated> status to stream STREAM. */
900 val_print_not_associated (struct ui_file
*stream
)
902 fprintf_styled (stream
, metadata_style
.style (), _("<not associated>"));