aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-02 11:46:15 -0700
committerTom Tromey <tom@tromey.com>2022-03-29 12:46:24 -0600
commit6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a (patch)
tree641a6a86240919fe4ba9219fbbbe15bc6331c22d /gdb/compile
parenta11ac3b3e8ff6769badcf0041894f6c5acc1b94f (diff)
downloadgdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.zip
gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.gz
gdb-6cb06a8cdaaf30f5d879f24d37100cf1d25c6a3a.tar.bz2
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.
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile-c-support.c50
-rw-r--r--gdb/compile/compile-c-symbols.c38
-rw-r--r--gdb/compile/compile-cplus-symbols.c58
-rw-r--r--gdb/compile/compile-cplus-types.c26
-rw-r--r--gdb/compile/compile-loc2c.c118
-rw-r--r--gdb/compile/compile-object-load.c76
-rw-r--r--gdb/compile/compile.c28
7 files changed, 197 insertions, 197 deletions
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index 52a7cc1..81356f0 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -161,7 +161,7 @@ print_one_macro (const char *name, const struct macro_definition *macro,
/* None of -Wno-builtin-macro-redefined, #undef first
or plain #define of the same value would avoid a warning. */
- fprintf_filtered (file, "#ifndef %s\n# define %s", name, name);
+ gdb_printf (file, "#ifndef %s\n# define %s", name, name);
if (macro->kind == macro_function_like)
{
@@ -177,7 +177,7 @@ print_one_macro (const char *name, const struct macro_definition *macro,
gdb_puts (")", file);
}
- fprintf_filtered (file, " %s\n#endif\n", macro->replacement);
+ gdb_printf (file, " %s\n#endif\n", macro->replacement);
}
/* Write macro definitions at PC to FILE. */
@@ -245,8 +245,8 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
switch (regtype->code ())
{
case TYPE_CODE_PTR:
- fprintf_filtered (stream, "__gdb_uintptr %s",
- regname.c_str ());
+ gdb_printf (stream, "__gdb_uintptr %s",
+ regname.c_str ());
break;
case TYPE_CODE_INT:
@@ -258,11 +258,11 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
{
if (regtype->is_unsigned ())
gdb_puts ("unsigned ", stream);
- fprintf_unfiltered (stream,
- "int %s"
- " __attribute__ ((__mode__(__%s__)))",
- regname.c_str (),
- mode);
+ gdb_printf (stream,
+ "int %s"
+ " __attribute__ ((__mode__(__%s__)))",
+ regname.c_str (),
+ mode);
break;
}
}
@@ -270,12 +270,12 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
/* Fall through. */
default:
- fprintf_unfiltered (stream,
- " unsigned char %s[%s]"
- " __attribute__((__aligned__("
- "__BIGGEST_ALIGNMENT__)))",
- regname.c_str (),
- pulongest (TYPE_LENGTH (regtype)));
+ gdb_printf (stream,
+ " unsigned char %s[%s]"
+ " __attribute__((__aligned__("
+ "__BIGGEST_ALIGNMENT__)))",
+ regname.c_str (),
+ pulongest (TYPE_LENGTH (regtype)));
}
gdb_puts (";\n", stream);
}
@@ -393,15 +393,15 @@ struct c_add_input
{
case COMPILE_I_PRINT_ADDRESS_SCOPE:
case COMPILE_I_PRINT_VALUE_SCOPE:
- fprintf_unfiltered (buf,
- "__auto_type " COMPILE_I_EXPR_VAL " = %s;\n"
- "typeof (%s) *" COMPILE_I_EXPR_PTR_TYPE ";\n"
- "memcpy (" COMPILE_I_PRINT_OUT_ARG ", %s"
- COMPILE_I_EXPR_VAL ",\n"
- "sizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n"
- , input, input,
- (type == COMPILE_I_PRINT_ADDRESS_SCOPE
- ? "&" : ""));
+ gdb_printf (buf,
+ "__auto_type " COMPILE_I_EXPR_VAL " = %s;\n"
+ "typeof (%s) *" COMPILE_I_EXPR_PTR_TYPE ";\n"
+ "memcpy (" COMPILE_I_PRINT_OUT_ARG ", %s"
+ COMPILE_I_EXPR_VAL ",\n"
+ "sizeof (*" COMPILE_I_EXPR_PTR_TYPE "));\n"
+ , input, input,
+ (type == COMPILE_I_PRINT_ADDRESS_SCOPE
+ ? "&" : ""));
break;
default:
@@ -494,7 +494,7 @@ struct cplus_add_input
{
case COMPILE_I_PRINT_VALUE_SCOPE:
case COMPILE_I_PRINT_ADDRESS_SCOPE:
- fprintf_unfiltered
+ gdb_printf
(buf,
/* "auto" strips ref- and cv- qualifiers, so we need to also strip
those from COMPILE_I_EXPR_PTR_TYPE. */
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index bb15602..d422c46 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -241,17 +241,17 @@ convert_symbol_sym (compile_c_instance *context, const char *identifier,
&& global_sym.block != block_static_block (global_sym.block))
{
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_convert_symbol \"%s\": global symbol\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_convert_symbol \"%s\": global symbol\n",
+ identifier);
convert_one_symbol (context, global_sym, 1, 0);
}
}
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_convert_symbol \"%s\": local symbol\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_convert_symbol \"%s\": local symbol\n",
+ identifier);
convert_one_symbol (context, sym, 0, is_local_symbol);
}
@@ -373,9 +373,9 @@ gcc_convert_symbol (void *datum,
}
if (compile_debug && !found)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_convert_symbol \"%s\": lookup_symbol failed\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_convert_symbol \"%s\": lookup_symbol failed\n",
+ identifier);
return;
}
@@ -401,9 +401,9 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
if (sym != NULL && sym->aclass () == LOC_BLOCK)
{
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_symbol_address \"%s\": full symbol\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_symbol_address \"%s\": full symbol\n",
+ identifier);
result = BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (sym));
if (sym->type ()->is_gnu_ifunc ())
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
@@ -417,10 +417,10 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
if (msym.minsym != NULL)
{
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_symbol_address \"%s\": minimal "
- "symbol\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_symbol_address \"%s\": minimal "
+ "symbol\n",
+ identifier);
result = BMSYMBOL_VALUE_ADDRESS (msym);
if (MSYMBOL_TYPE (msym.minsym) == mst_text_gnu_ifunc)
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
@@ -435,9 +435,9 @@ gcc_symbol_address (void *datum, struct gcc_c_context *gcc_context,
}
if (compile_debug && !found)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_symbol_address \"%s\": failed\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_symbol_address \"%s\": failed\n",
+ identifier);
return result;
}
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 33febac..3657c84 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -253,17 +253,17 @@ convert_symbol_sym (compile_cplus_instance *instance,
&& global_sym.block != block_static_block (global_sym.block))
{
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_convert_symbol \"%s\": global symbol\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_convert_symbol \"%s\": global symbol\n",
+ identifier);
convert_one_symbol (instance, global_sym, true, false);
}
}
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_convert_symbol \"%s\": local symbol\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_convert_symbol \"%s\": local symbol\n",
+ identifier);
convert_one_symbol (instance, sym, false, is_local_symbol);
}
@@ -337,8 +337,8 @@ gcc_cplus_convert_symbol (void *datum,
const char *identifier)
{
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "got oracle request for \"%s\"\n", identifier);
+ gdb_printf (gdb_stdlog,
+ "got oracle request for \"%s\"\n", identifier);
bool found = false;
compile_cplus_instance *instance = (compile_cplus_instance *) datum;
@@ -396,18 +396,18 @@ gcc_cplus_convert_symbol (void *datum,
}
if (compile_debug && !found)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_convert_symbol \"%s\": lookup_symbol failed\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_convert_symbol \"%s\": lookup_symbol failed\n",
+ identifier);
if (compile_debug)
{
if (found)
- fprintf_unfiltered (gdb_stdlog, "found type for %s\n", identifier);
+ gdb_printf (gdb_stdlog, "found type for %s\n", identifier);
else
{
- fprintf_unfiltered (gdb_stdlog, "did not find type for %s\n",
- identifier);
+ gdb_printf (gdb_stdlog, "did not find type for %s\n",
+ identifier);
}
}
@@ -425,8 +425,8 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
int found = 0;
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "got oracle request for address of %s\n", identifier);
+ gdb_printf (gdb_stdlog,
+ "got oracle request for address of %s\n", identifier);
/* We can't allow exceptions to escape out of this callback. Safest
is to simply emit a gcc error. */
@@ -438,9 +438,9 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
if (sym != nullptr && sym->aclass () == LOC_BLOCK)
{
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_symbol_address \"%s\": full symbol\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_symbol_address \"%s\": full symbol\n",
+ identifier);
result = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
if (sym->type ()->is_gnu_ifunc ())
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
@@ -454,10 +454,10 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
if (msym.minsym != nullptr)
{
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_symbol_address \"%s\": minimal "
- "symbol\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_symbol_address \"%s\": minimal "
+ "symbol\n",
+ identifier);
result = BMSYMBOL_VALUE_ADDRESS (msym);
if (MSYMBOL_TYPE (msym.minsym) == mst_text_gnu_ifunc)
result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
@@ -472,17 +472,17 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
}
if (compile_debug && !found)
- fprintf_unfiltered (gdb_stdlog,
- "gcc_symbol_address \"%s\": failed\n",
- identifier);
+ gdb_printf (gdb_stdlog,
+ "gcc_symbol_address \"%s\": failed\n",
+ identifier);
if (compile_debug)
{
if (found)
- fprintf_unfiltered (gdb_stdlog, "found address for %s!\n", identifier);
+ gdb_printf (gdb_stdlog, "found address for %s!\n", identifier);
else
- fprintf_unfiltered (gdb_stdlog,
- "did not find address for %s\n", identifier);
+ gdb_printf (gdb_stdlog,
+ "did not find address for %s\n", identifier);
}
return result;
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index 2b1b01e..616f2c2 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -258,8 +258,8 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope)
{
if (debug_compile_cplus_scopes)
{
- fprintf_unfiltered (gdb_stdlog, "entering new scope %s\n",
- host_address_to_string (&m_scopes.back ()));
+ gdb_printf (gdb_stdlog, "entering new scope %s\n",
+ host_address_to_string (&m_scopes.back ()));
}
/* Push the global namespace. */
@@ -284,8 +284,8 @@ compile_cplus_instance::enter_scope (compile_scope &&new_scope)
{
if (debug_compile_cplus_scopes)
{
- fprintf_unfiltered (gdb_stdlog, "staying in current scope -- "
- "scopes are identical\n");
+ gdb_printf (gdb_stdlog, "staying in current scope -- "
+ "scopes are identical\n");
}
}
}
@@ -305,8 +305,8 @@ compile_cplus_instance::leave_scope ()
{
if (debug_compile_cplus_scopes)
{
- fprintf_unfiltered (gdb_stdlog, "leaving scope %s\n",
- host_address_to_string (&current));
+ gdb_printf (gdb_stdlog, "leaving scope %s\n",
+ host_address_to_string (&current));
}
/* Pop namespaces. */
@@ -324,8 +324,8 @@ compile_cplus_instance::leave_scope ()
else
{
if (debug_compile_cplus_scopes)
- fprintf_unfiltered (gdb_stdlog,
- "identical scopes -- not leaving scope\n");
+ gdb_printf (gdb_stdlog,
+ "identical scopes -- not leaving scope\n");
}
}
@@ -1239,7 +1239,7 @@ compile_cplus_instance::gcc_cplus_leave_scope
static void
compile_cplus_debug_output_1 (ULONGEST arg)
{
- fprintf_unfiltered (gdb_stdlog, "%s", pulongest (arg));
+ gdb_printf (gdb_stdlog, "%s", pulongest (arg));
}
static void
@@ -1363,7 +1363,7 @@ gcc_cp_plugin::build_decl (const char *debug_decltype, const char *name,
const char *filename, unsigned int line_number)
{
if (debug_compile_cplus_types)
- fprintf_unfiltered (gdb_stdlog, "<%s> ", debug_decltype);
+ gdb_printf (gdb_stdlog, "<%s> ", debug_decltype);
return build_decl (name, sym_kind, sym_type, substitution_name,
address, filename, line_number);
@@ -1375,7 +1375,7 @@ gcc_cp_plugin::start_class_type (const char *debug_name, gcc_decl typedecl,
const char *filename, unsigned int line_number)
{
if (debug_compile_cplus_types)
- fprintf_unfiltered (gdb_stdlog, "<%s> ", debug_name);
+ gdb_printf (gdb_stdlog, "<%s> ", debug_name);
return start_class_type (typedecl, base_classes, filename, line_number);
}
@@ -1385,7 +1385,7 @@ gcc_cp_plugin::finish_class_type (const char *debug_name,
unsigned long size_in_bytes)
{
if (debug_compile_cplus_types)
- fprintf_unfiltered (gdb_stdlog, "<%s> ", debug_name);
+ gdb_printf (gdb_stdlog, "<%s> ", debug_name);
return finish_class_type (size_in_bytes);
}
@@ -1394,7 +1394,7 @@ int
gcc_cp_plugin::pop_binding_level (const char *debug_name)
{
if (debug_compile_cplus_types)
- fprintf_unfiltered (gdb_stdlog, "<%s> ", debug_name);
+ gdb_printf (gdb_stdlog, "<%s> ", debug_name);
return pop_binding_level ();
}
diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c
index ba29d02..3ce0bfa 100644
--- a/gdb/compile/compile-loc2c.c
+++ b/gdb/compile/compile-loc2c.c
@@ -435,9 +435,9 @@ compute_stack_depth (enum bfd_endian byte_order, unsigned int addr_size,
static void
push (int indent, string_file *stream, ULONGEST l)
{
- fprintf_filtered (stream,
- "%*s__gdb_stack[++__gdb_tos] = (" GCC_UINTPTR ") %s;\n",
- indent, "", hex_string (l));
+ gdb_printf (stream,
+ "%*s__gdb_stack[++__gdb_tos] = (" GCC_UINTPTR ") %s;\n",
+ indent, "", hex_string (l));
}
/* Emit code to push an arbitrary expression. This works like
@@ -451,13 +451,13 @@ pushf (int indent, string_file *stream, const char *format, ...)
{
va_list args;
- fprintf_filtered (stream, "%*s__gdb_stack[__gdb_tos + 1] = ", indent, "");
+ gdb_printf (stream, "%*s__gdb_stack[__gdb_tos + 1] = ", indent, "");
va_start (args, format);
stream->vprintf (format, args);
va_end (args);
stream->puts (";\n");
- fprintf_filtered (stream, "%*s++__gdb_tos;\n", indent, "");
+ gdb_printf (stream, "%*s++__gdb_tos;\n", indent, "");
}
/* Emit code for a unary expression -- one which operates in-place on
@@ -471,7 +471,7 @@ unary (int indent, string_file *stream, const char *format, ...)
{
va_list args;
- fprintf_filtered (stream, "%*s__gdb_stack[__gdb_tos] = ", indent, "");
+ gdb_printf (stream, "%*s__gdb_stack[__gdb_tos] = ", indent, "");
va_start (args, format);
stream->vprintf (format, args);
va_end (args);
@@ -488,12 +488,12 @@ binary (int indent, string_file *stream, const char *format, ...)
{
va_list args;
- fprintf_filtered (stream, "%*s__gdb_stack[__gdb_tos - 1] = ", indent, "");
+ gdb_printf (stream, "%*s__gdb_stack[__gdb_tos - 1] = ", indent, "");
va_start (args, format);
stream->vprintf (format, args);
va_end (args);
stream->puts (";\n");
- fprintf_filtered (stream, "%*s--__gdb_tos;\n", indent, "");
+ gdb_printf (stream, "%*s--__gdb_tos;\n", indent, "");
}
/* Print the name of a label given its "SCOPE", an arbitrary integer
@@ -614,9 +614,9 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
++scope;
- fprintf_filtered (stream, "%*s__attribute__ ((unused)) %s %s;\n",
- indent, "", type_name, result_name);
- fprintf_filtered (stream, "%*s{\n", indent, "");
+ gdb_printf (stream, "%*s__attribute__ ((unused)) %s %s;\n",
+ indent, "", type_name, result_name);
+ gdb_printf (stream, "%*s{\n", indent, "");
indent += 2;
stack_depth = compute_stack_depth (byte_order, addr_size,
@@ -652,19 +652,19 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
"compiled code."),
sym->print_name ());
- fprintf_filtered (stream, "%*s%s = %s;\n",
- indent, "", result_name,
- core_addr_to_string (value_address (val)));
- fprintf_filtered (stream, "%*s}\n", indent - 2, "");
+ gdb_printf (stream, "%*s%s = %s;\n",
+ indent, "", result_name,
+ core_addr_to_string (value_address (val)));
+ gdb_printf (stream, "%*s}\n", indent - 2, "");
return;
}
- fprintf_filtered (stream, "%*s" GCC_UINTPTR " __gdb_stack[%d];\n",
- indent, "", stack_depth);
+ gdb_printf (stream, "%*s" GCC_UINTPTR " __gdb_stack[%d];\n",
+ indent, "", stack_depth);
if (need_tempvar)
- fprintf_filtered (stream, "%*s" GCC_UINTPTR " __gdb_tmp;\n", indent, "");
- fprintf_filtered (stream, "%*sint __gdb_tos = -1;\n", indent, "");
+ gdb_printf (stream, "%*s" GCC_UINTPTR " __gdb_tmp;\n", indent, "");
+ gdb_printf (stream, "%*sint __gdb_tos = -1;\n", indent, "");
if (initial != NULL)
pushf (indent, stream, "%s", core_addr_to_string (*initial));
@@ -684,8 +684,8 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
stream->printf ("/* %s */\n", get_DW_OP_name (op));
/* This is handy for debugging the generated code:
- fprintf_filtered (stream, "if (__gdb_tos != %d) abort ();\n",
- (int) info[op_ptr - base].depth - 1);
+ gdb_printf (stream, "if (__gdb_tos != %d) abort ();\n",
+ (int) info[op_ptr - base].depth - 1);
*/
++op_ptr;
@@ -923,7 +923,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
break;
case DW_OP_drop:
- fprintf_filtered (stream, "%*s--__gdb_tos;\n", indent, "");
+ gdb_printf (stream, "%*s--__gdb_tos;\n", indent, "");
break;
case DW_OP_pick:
@@ -933,16 +933,16 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
break;
case DW_OP_swap:
- fprintf_filtered (stream,
- "%*s__gdb_tmp = __gdb_stack[__gdb_tos - 1];\n",
- indent, "");
- fprintf_filtered (stream,
- "%*s__gdb_stack[__gdb_tos - 1] = "
- "__gdb_stack[__gdb_tos];\n",
- indent, "");
- fprintf_filtered (stream, ("%*s__gdb_stack[__gdb_tos] = "
- "__gdb_tmp;\n"),
- indent, "");
+ gdb_printf (stream,
+ "%*s__gdb_tmp = __gdb_stack[__gdb_tos - 1];\n",
+ indent, "");
+ gdb_printf (stream,
+ "%*s__gdb_stack[__gdb_tos - 1] = "
+ "__gdb_stack[__gdb_tos];\n",
+ indent, "");
+ gdb_printf (stream, ("%*s__gdb_stack[__gdb_tos] = "
+ "__gdb_tmp;\n"),
+ indent, "");
break;
case DW_OP_over:
@@ -950,20 +950,20 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
break;
case DW_OP_rot:
- fprintf_filtered (stream, ("%*s__gdb_tmp = "
- "__gdb_stack[__gdb_tos];\n"),
- indent, "");
- fprintf_filtered (stream,
- "%*s__gdb_stack[__gdb_tos] = "
- "__gdb_stack[__gdb_tos - 1];\n",
- indent, "");
- fprintf_filtered (stream,
- "%*s__gdb_stack[__gdb_tos - 1] = "
- "__gdb_stack[__gdb_tos -2];\n",
- indent, "");
- fprintf_filtered (stream, "%*s__gdb_stack[__gdb_tos - 2] = "
- "__gdb_tmp;\n",
- indent, "");
+ gdb_printf (stream, ("%*s__gdb_tmp = "
+ "__gdb_stack[__gdb_tos];\n"),
+ indent, "");
+ gdb_printf (stream,
+ "%*s__gdb_stack[__gdb_tos] = "
+ "__gdb_stack[__gdb_tos - 1];\n",
+ indent, "");
+ gdb_printf (stream,
+ "%*s__gdb_stack[__gdb_tos - 1] = "
+ "__gdb_stack[__gdb_tos -2];\n",
+ indent, "");
+ gdb_printf (stream, "%*s__gdb_stack[__gdb_tos - 2] = "
+ "__gdb_tmp;\n",
+ indent, "");
break;
case DW_OP_deref:
@@ -984,11 +984,11 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
/* Cast to a pointer of the desired type, then
dereference. */
- fprintf_filtered (stream,
- "%*s__gdb_stack[__gdb_tos] = "
- "*((__gdb_int_%s *) "
- "__gdb_stack[__gdb_tos]);\n",
- indent, "", mode);
+ gdb_printf (stream,
+ "%*s__gdb_stack[__gdb_tos] = "
+ "*((__gdb_int_%s *) "
+ "__gdb_stack[__gdb_tos]);\n",
+ indent, "", mode);
}
break;
@@ -1110,7 +1110,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
case DW_OP_skip:
offset = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2;
- fprintf_filtered (stream, "%*sgoto ", indent, "");
+ gdb_printf (stream, "%*sgoto ", indent, "");
print_label (stream, scope, op_ptr + offset - base);
stream->puts (";\n");
break;
@@ -1118,10 +1118,10 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
case DW_OP_bra:
offset = extract_signed_integer (op_ptr, 2, byte_order);
op_ptr += 2;
- fprintf_filtered (stream,
- "%*sif ((( " GCC_INTPTR
- ") __gdb_stack[__gdb_tos--]) != 0) goto ",
- indent, "");
+ gdb_printf (stream,
+ "%*sif ((( " GCC_INTPTR
+ ") __gdb_stack[__gdb_tos--]) != 0) goto ",
+ indent, "");
print_label (stream, scope, op_ptr + offset - base);
stream->puts (";\n");
break;
@@ -1134,9 +1134,9 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream,
}
}
- fprintf_filtered (stream, "%*s%s = __gdb_stack[__gdb_tos];\n",
- indent, "", result_name);
- fprintf_filtered (stream, "%*s}\n", indent - 2, "");
+ gdb_printf (stream, "%*s%s = __gdb_stack[__gdb_tos];\n",
+ indent, "", result_name);
+ gdb_printf (stream, "%*s}\n", indent - 2, "");
}
/* See compile.h. */
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 073f2fe..b62a841 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -126,13 +126,13 @@ setup_sections_data::setup_one_section (asection *sect)
prot |= GDB_MMAP_PROT_EXEC;
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "module \"%s\" section \"%s\" size %s prot %u\n",
- bfd_get_filename (m_bfd),
- bfd_section_name (sect),
- paddress (target_gdbarch (),
- bfd_section_size (sect)),
- prot);
+ gdb_printf (gdb_stdlog,
+ "module \"%s\" section \"%s\" size %s prot %u\n",
+ bfd_get_filename (m_bfd),
+ bfd_section_name (sect),
+ paddress (target_gdbarch (),
+ bfd_section_size (sect)),
+ prot);
}
else
prot = -1;
@@ -149,11 +149,11 @@ setup_sections_data::setup_one_section (asection *sect)
m_last_prot);
munmap_list.add (addr, m_last_size);
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "allocated %s bytes at %s prot %u\n",
- paddress (target_gdbarch (), m_last_size),
- paddress (target_gdbarch (), addr),
- m_last_prot);
+ gdb_printf (gdb_stdlog,
+ "allocated %s bytes at %s prot %u\n",
+ paddress (target_gdbarch (), m_last_size),
+ paddress (target_gdbarch (), addr),
+ m_last_prot);
}
else
addr = 0;
@@ -713,9 +713,9 @@ compile_object_load (const compile_file_names &file_names,
if (strcmp (sym->name, "_GLOBAL_OFFSET_TABLE_") == 0)
{
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "ELF symbol \"%s\" relocated to zero\n",
- sym->name);
+ gdb_printf (gdb_stdlog,
+ "ELF symbol \"%s\" relocated to zero\n",
+ sym->name);
/* It seems to be a GCC bug, with -mcmodel=large there should be no
need for _GLOBAL_OFFSET_TABLE_. Together with -fPIE the data
@@ -757,10 +757,10 @@ compile_object_load (const compile_file_names &file_names,
sym->value = 0x8000;
bfd_set_gp_value(abfd.get(), toc_fallback->vma);
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "Connectiong ELF symbol \"%s\" to the .toc section (%s)\n",
- sym->name,
- paddress (target_gdbarch (), sym->value));
+ gdb_printf (gdb_stdlog,
+ "Connectiong ELF symbol \"%s\" to the .toc section (%s)\n",
+ sym->name,
+ paddress (target_gdbarch (), sym->value));
continue;
}
@@ -773,20 +773,20 @@ compile_object_load (const compile_file_names &file_names,
case mst_data:
sym->value = BMSYMBOL_VALUE_ADDRESS (bmsym);
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "ELF mst_text symbol \"%s\" relocated to %s\n",
- sym->name,
- paddress (target_gdbarch (), sym->value));
+ gdb_printf (gdb_stdlog,
+ "ELF mst_text symbol \"%s\" relocated to %s\n",
+ sym->name,
+ paddress (target_gdbarch (), sym->value));
break;
case mst_text_gnu_ifunc:
sym->value = gnu_ifunc_resolve_addr (target_gdbarch (),
BMSYMBOL_VALUE_ADDRESS (bmsym));
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "ELF mst_text_gnu_ifunc symbol \"%s\" "
- "relocated to %s\n",
- sym->name,
- paddress (target_gdbarch (), sym->value));
+ gdb_printf (gdb_stdlog,
+ "ELF mst_text_gnu_ifunc symbol \"%s\" "
+ "relocated to %s\n",
+ sym->name,
+ paddress (target_gdbarch (), sym->value));
break;
default:
warning (_("Could not find symbol \"%s\" "
@@ -812,11 +812,11 @@ compile_object_load (const compile_file_names &file_names,
gdb_assert (regs_addr != 0);
setup_sections_data.munmap_list.add (regs_addr, TYPE_LENGTH (regs_type));
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "allocated %s bytes at %s for registers\n",
- paddress (target_gdbarch (),
- TYPE_LENGTH (regs_type)),
- paddress (target_gdbarch (), regs_addr));
+ gdb_printf (gdb_stdlog,
+ "allocated %s bytes at %s for registers\n",
+ paddress (target_gdbarch (),
+ TYPE_LENGTH (regs_type)),
+ paddress (target_gdbarch (), regs_addr));
store_regs (regs_type, regs_addr);
}
@@ -835,11 +835,11 @@ compile_object_load (const compile_file_names &file_names,
setup_sections_data.munmap_list.add (out_value_addr,
TYPE_LENGTH (out_value_type));
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog,
- "allocated %s bytes at %s for printed value\n",
- paddress (target_gdbarch (),
- TYPE_LENGTH (out_value_type)),
- paddress (target_gdbarch (), out_value_addr));
+ gdb_printf (gdb_stdlog,
+ "allocated %s bytes at %s for printed value\n",
+ paddress (target_gdbarch (),
+ TYPE_LENGTH (out_value_type)),
+ paddress (target_gdbarch (), out_value_addr));
}
compile_module_up retval (new struct compile_module);
diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 42df80e..7983d1d 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -233,7 +233,7 @@ static void
show_compile_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("Compile debugging is %s.\n"), value);
+ gdb_printf (file, _("Compile debugging is %s.\n"), value);
}
@@ -530,9 +530,9 @@ static void
show_compile_args (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("Compile command command-line arguments "
- "are \"%s\".\n"),
- value);
+ gdb_printf (file, _("Compile command command-line arguments "
+ "are \"%s\".\n"),
+ value);
}
/* String for 'set compile-gcc' and 'show compile-gcc'. */
@@ -544,8 +544,8 @@ static void
show_compile_gcc (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("Compile command GCC driver filename is \"%s\".\n"),
- value);
+ gdb_printf (file, _("Compile command GCC driver filename is \"%s\".\n"),
+ value);
}
/* Return DW_AT_producer parsed for get_selected_frame () (if any).
@@ -708,7 +708,7 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
= current_language->compute_program (compiler.get (), input, gdbarch,
expr_block, expr_pc);
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog, "debug output:\n\n%s", code.c_str ());
+ gdb_printf (gdb_stdlog, "debug output:\n\n%s", code.c_str ());
compiler->set_verbose (compile_debug);
@@ -747,10 +747,10 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
{
int argi;
- fprintf_unfiltered (gdb_stdlog, "Passing %d compiler options:\n", argc);
+ gdb_printf (gdb_stdlog, "Passing %d compiler options:\n", argc);
for (argi = 0; argi < argc; argi++)
- fprintf_unfiltered (gdb_stdlog, "Compiler option %d: <%s>\n",
- argi, argv[argi]);
+ gdb_printf (gdb_stdlog, "Compiler option %d: <%s>\n",
+ argi, argv[argi]);
}
compile_file_names fnames = get_new_file_names ();
@@ -769,8 +769,8 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
}
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog, "source file produced: %s\n\n",
- fnames.source_file ());
+ gdb_printf (gdb_stdlog, "source file produced: %s\n\n",
+ fnames.source_file ());
/* If we don't do this, then GDB simply exits
when the compiler dies. */
@@ -783,8 +783,8 @@ compile_to_object (struct command_line *cmd, const char *cmd_string,
error (_("Compilation failed."));
if (compile_debug)
- fprintf_unfiltered (gdb_stdlog, "object file produced: %s\n\n",
- fnames.object_file ());
+ gdb_printf (gdb_stdlog, "object file produced: %s\n\n",
+ fnames.object_file ());
/* Keep the source file. */
source_remover->keep ();