aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/amd64-windows-tdep.c75
-rw-r--r--gdb/frame.c270
-rw-r--r--gdb/frame.h5
-rw-r--r--gdb/value.c28
4 files changed, 201 insertions, 177 deletions
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 4d719d2..56559be 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -756,14 +756,10 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame,
(gdb_byte *) &ex_ui, sizeof (ex_ui)) != 0)
return;
- if (frame_debug)
- fprintf_unfiltered
- (gdb_stdlog,
- "amd64_windows_frame_decodes_insn: "
- "%s: ver: %02x, plgsz: %02x, cnt: %02x, frame: %02x\n",
- paddress (gdbarch, unwind_info),
- ex_ui.Version_Flags, ex_ui.SizeOfPrologue,
- ex_ui.CountOfCodes, ex_ui.FrameRegisterOffset);
+ frame_debug_printf ("%s: ver: %02x, plgsz: %02x, cnt: %02x, frame: %02x",
+ paddress (gdbarch, unwind_info),
+ ex_ui.Version_Flags, ex_ui.SizeOfPrologue,
+ ex_ui.CountOfCodes, ex_ui.FrameRegisterOffset);
/* Check version. */
if (PEX64_UWI_VERSION (ex_ui.Version_Flags) != 1
@@ -801,10 +797,9 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame,
get_frame_register (this_frame, frreg, buf);
save_addr = extract_unsigned_integer (buf, 8, byte_order);
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog, " frame_reg=%s, val=%s\n",
- gdbarch_register_name (gdbarch, frreg),
- paddress (gdbarch, save_addr));
+ frame_debug_printf (" frame_reg=%s, val=%s",
+ gdbarch_register_name (gdbarch, frreg),
+ paddress (gdbarch, save_addr));
}
/* Read opcodes. */
@@ -835,10 +830,8 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame,
prologue has been fully executed. */
if (cache->pc >= start + p[0] || cache->pc < start)
{
- if (frame_debug)
- fprintf_unfiltered
- (gdb_stdlog, " op #%u: off=0x%02x, insn=0x%02x\n",
- (unsigned) (p - insns), p[0], p[1]);
+ frame_debug_printf (" op #%u: off=0x%02x, insn=0x%02x",
+ (unsigned) (p - insns), p[0], p[1]);
/* If there is no frame registers defined, the current value of
rsp is used instead. */
@@ -912,11 +905,11 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame,
}
/* Display address where the register was saved. */
- if (frame_debug && reg >= 0)
- fprintf_unfiltered
- (gdb_stdlog, " [reg %s at %s]\n",
- gdbarch_register_name (gdbarch, reg),
- paddress (gdbarch, cache->prev_reg_addr[reg]));
+ if (reg >= 0)
+ frame_debug_printf (" [reg %s at %s]",
+ gdbarch_register_name (gdbarch, reg),
+ paddress (gdbarch,
+ cache->prev_reg_addr[reg]));
}
/* Adjust with the length of the opcode. */
@@ -978,14 +971,11 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame,
unwind_info =
extract_unsigned_integer (d.rva_UnwindData, 4, byte_order);
- if (frame_debug)
- fprintf_unfiltered
- (gdb_stdlog,
- "amd64_windows_frame_decodes_insn (next in chain):"
- " unwind_data=%s, start_rva=%s, end_rva=%s\n",
- paddress (gdbarch, unwind_info),
- paddress (gdbarch, cache->start_rva),
- paddress (gdbarch, cache->end_rva));
+ frame_debug_printf ("next in chain: unwind_data=%s, start_rva=%s, "
+ "end_rva=%s",
+ paddress (gdbarch, unwind_info),
+ paddress (gdbarch, cache->start_rva),
+ paddress (gdbarch, cache->end_rva));
}
/* Allow the user to break this loop. */
@@ -996,10 +986,9 @@ amd64_windows_frame_decode_insns (struct frame_info *this_frame,
cache->prev_rip_addr = cur_sp;
cache->prev_sp = cur_sp + 8;
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog, " prev_sp: %s, prev_pc @%s\n",
- paddress (gdbarch, cache->prev_sp),
- paddress (gdbarch, cache->prev_rip_addr));
+ frame_debug_printf (" prev_sp: %s, prev_pc @%s",
+ paddress (gdbarch, cache->prev_sp),
+ paddress (gdbarch, cache->prev_rip_addr));
}
/* Find SEH unwind info for PC, returning 0 on success.
@@ -1073,11 +1062,9 @@ amd64_windows_find_unwind_info (struct gdbarch *gdbarch, CORE_ADDR pc,
break;
}
- if (frame_debug)
- fprintf_unfiltered
- (gdb_stdlog,
- "amd64_windows_find_unwind_data: image_base=%s, unwind_data=%s\n",
- paddress (gdbarch, base), paddress (gdbarch, *unwind_info));
+ frame_debug_printf ("image_base=%s, unwind_data=%s",
+ paddress (gdbarch, base),
+ paddress (gdbarch, *unwind_info));
return 0;
}
@@ -1139,11 +1126,9 @@ amd64_windows_frame_prev_register (struct frame_info *this_frame,
amd64_windows_frame_cache (this_frame, this_cache);
CORE_ADDR prev;
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "amd64_windows_frame_prev_register %s for sp=%s\n",
- gdbarch_register_name (gdbarch, regnum),
- paddress (gdbarch, cache->prev_sp));
+ frame_debug_printf ("%s for sp=%s",
+ gdbarch_register_name (gdbarch, regnum),
+ paddress (gdbarch, cache->prev_sp));
if (regnum >= AMD64_XMM0_REGNUM && regnum <= AMD64_XMM0_REGNUM + 15)
prev = cache->prev_xmm_addr[regnum - AMD64_XMM0_REGNUM];
@@ -1160,8 +1145,8 @@ amd64_windows_frame_prev_register (struct frame_info *this_frame,
else
prev = 0;
- if (prev && frame_debug)
- fprintf_unfiltered (gdb_stdlog, " -> at %s\n", paddress (gdbarch, prev));
+ if (prev != 0)
+ frame_debug_printf (" -> at %s", paddress (gdbarch, prev));
if (prev)
{
diff --git a/gdb/frame.c b/gdb/frame.c
index dc9fdd4..4258c5e 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -399,10 +399,10 @@ fprint_frame_id (struct ui_file *file, struct frame_id id)
else
fprintf_unfiltered (file, "stack=%s", hex_string (id.stack_addr));
- fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, ", ");
fprint_field (file, "code", id.code_addr_p, id.code_addr);
- fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, ", ");
fprint_field (file, "special", id.special_addr_p, id.special_addr);
@@ -455,21 +455,21 @@ fprint_frame (struct ui_file *file, struct frame_info *fi)
fprintf_unfiltered (file, "{");
fprintf_unfiltered (file, "level=%d", fi->level);
- fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, ", ");
fprintf_unfiltered (file, "type=");
if (fi->unwind != NULL)
fprint_frame_type (file, fi->unwind->type);
else
fprintf_unfiltered (file, "<unknown>");
- fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, ", ");
fprintf_unfiltered (file, "unwind=");
if (fi->unwind != NULL)
gdb_print_host_address (fi->unwind, file);
else
fprintf_unfiltered (file, "<unknown>");
- fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, ", ");
fprintf_unfiltered (file, "pc=");
if (fi->next == NULL || fi->next->prev_pc.status == CC_UNKNOWN)
@@ -484,7 +484,7 @@ fprint_frame (struct ui_file *file, struct frame_info *fi)
val_print_not_saved (file);
else if (fi->next->prev_pc.status == CC_UNAVAILABLE)
val_print_unavailable (file);
- fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, ", ");
fprintf_unfiltered (file, "id=");
if (fi->this_id.p == frame_id_status::NOT_COMPUTED)
@@ -493,7 +493,7 @@ fprint_frame (struct ui_file *file, struct frame_info *fi)
fprintf_unfiltered (file, "<computing>");
else
fprint_frame_id (file, fi->this_id.value);
- fprintf_unfiltered (file, ",");
+ fprintf_unfiltered (file, ", ");
fprintf_unfiltered (file, "func=");
if (fi->next != NULL && fi->next->prev_func.status == CC_VALUE)
@@ -574,9 +574,7 @@ compute_frame_id (struct frame_info *fi)
/* Mark this frame's id as "being computed. */
fi->this_id.p = frame_id_status::COMPUTING;
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog, "{ compute_frame_id (fi=%d) ",
- fi->level);
+ frame_debug_printf ("fi=%d", fi->level);
/* Find the unwinder. */
if (fi->unwind == NULL)
@@ -593,9 +591,12 @@ compute_frame_id (struct frame_info *fi)
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame_id (gdb_stdlog, fi->this_id.value);
- fprintf_unfiltered (gdb_stdlog, " }\n");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " -> ");
+ fprint_frame_id (&debug_file, fi->this_id.value);
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
}
catch (const gdb_exception &ex)
@@ -749,9 +750,13 @@ frame_id_p (frame_id l)
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "{ frame_id_p (l=");
- fprint_frame_id (gdb_stdlog, l);
- fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", p);
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, "l=");
+ fprint_frame_id (&debug_file, l);
+ fprintf_unfiltered (&debug_file, " -> %d", p);
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
return p;
@@ -797,11 +802,15 @@ frame_id_eq (frame_id l, frame_id r)
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "{ frame_id_eq (l=");
- fprint_frame_id (gdb_stdlog, l);
- fprintf_unfiltered (gdb_stdlog, ",r=");
- fprint_frame_id (gdb_stdlog, r);
- fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", eq);
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, "l=");
+ fprint_frame_id (&debug_file, l);
+ fprintf_unfiltered (&debug_file, ", r=");
+ fprint_frame_id (&debug_file, r);
+ fprintf_unfiltered (&debug_file, " -> %d", eq);
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
return eq;
@@ -880,11 +889,15 @@ frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "{ frame_id_inner (l=");
- fprint_frame_id (gdb_stdlog, l);
- fprintf_unfiltered (gdb_stdlog, ",r=");
- fprint_frame_id (gdb_stdlog, r);
- fprintf_unfiltered (gdb_stdlog, ") -> %d }\n", inner);
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, "l=");
+ fprint_frame_id (&debug_file, l);
+ fprintf_unfiltered (&debug_file, ", r=");
+ fprint_frame_id (&debug_file, r);
+ fprintf_unfiltered (&debug_file, " -> %d", inner);
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
return inner;
@@ -980,21 +993,15 @@ frame_unwind_pc (struct frame_info *this_frame)
{
this_frame->prev_pc.status = CC_UNAVAILABLE;
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "{ frame_unwind_pc (this_frame=%d)"
- " -> <unavailable> }\n",
- this_frame->level);
+ frame_debug_printf ("this_frame=%d -> <unavailable>",
+ this_frame->level);
}
else if (ex.error == OPTIMIZED_OUT_ERROR)
{
this_frame->prev_pc.status = CC_NOT_SAVED;
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "{ frame_unwind_pc (this_frame=%d)"
- " -> <not saved> }\n",
- this_frame->level);
+ frame_debug_printf ("this_frame=%d -> <not saved>",
+ this_frame->level);
}
else
throw;
@@ -1004,12 +1011,10 @@ frame_unwind_pc (struct frame_info *this_frame)
{
this_frame->prev_pc.value = pc;
this_frame->prev_pc.status = CC_VALUE;
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "{ frame_unwind_pc (this_frame=%d) "
- "-> %s }\n",
- this_frame->level,
- hex_string (this_frame->prev_pc.value));
+
+ frame_debug_printf ("this_frame=%d -> %s",
+ this_frame->level,
+ hex_string (this_frame->prev_pc.value));
}
}
@@ -1052,21 +1057,18 @@ get_frame_func_if_available (frame_info *this_frame, CORE_ADDR *pc)
if (!get_frame_address_in_block_if_available (this_frame, &addr_in_block))
{
next_frame->prev_func.status = CC_UNAVAILABLE;
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "{ get_frame_func (this_frame=%d)"
- " -> unavailable }\n",
- this_frame->level);
+
+ frame_debug_printf ("this_frame=%d -> unavailable",
+ this_frame->level);
}
else
{
next_frame->prev_func.status = CC_VALUE;
next_frame->prev_func.addr = get_pc_function_start (addr_in_block);
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "{ get_frame_func (this_frame=%d) -> %s }\n",
- this_frame->level,
- hex_string (next_frame->prev_func.addr));
+
+ frame_debug_printf ("this_frame=%d -> %s",
+ this_frame->level,
+ hex_string (next_frame->prev_func.addr));
}
}
@@ -1260,14 +1262,9 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
gdb_assert (next_frame != NULL);
gdbarch = frame_unwind_arch (next_frame);
- if (frame_debug)
- {
- fprintf_unfiltered (gdb_stdlog,
- "{ frame_unwind_register_value "
- "(frame=%d,regnum=%d(%s),...) ",
- next_frame->level, regnum,
- user_reg_map_regnum_to_name (gdbarch, regnum));
- }
+ frame_debug_printf ("frame=%d, regnum=%d(%s)",
+ next_frame->level, regnum,
+ user_reg_map_regnum_to_name (gdbarch, regnum));
/* Find the unwinder. */
if (next_frame->unwind == NULL)
@@ -1280,40 +1277,42 @@ frame_unwind_register_value (frame_info *next_frame, int regnum)
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "->");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " ->");
if (value_optimized_out (value))
{
- fprintf_unfiltered (gdb_stdlog, " ");
- val_print_not_saved (gdb_stdlog);
+ fprintf_unfiltered (&debug_file, " ");
+ val_print_not_saved (&debug_file);
}
else
{
if (VALUE_LVAL (value) == lval_register)
- fprintf_unfiltered (gdb_stdlog, " register=%d",
+ fprintf_unfiltered (&debug_file, " register=%d",
VALUE_REGNUM (value));
else if (VALUE_LVAL (value) == lval_memory)
- fprintf_unfiltered (gdb_stdlog, " address=%s",
+ fprintf_unfiltered (&debug_file, " address=%s",
paddress (gdbarch,
value_address (value)));
else
- fprintf_unfiltered (gdb_stdlog, " computed");
+ fprintf_unfiltered (&debug_file, " computed");
if (value_lazy (value))
- fprintf_unfiltered (gdb_stdlog, " lazy");
+ fprintf_unfiltered (&debug_file, " lazy");
else
{
int i;
const gdb_byte *buf = value_contents (value);
- fprintf_unfiltered (gdb_stdlog, " bytes=");
- fprintf_unfiltered (gdb_stdlog, "[");
+ fprintf_unfiltered (&debug_file, " bytes=");
+ fprintf_unfiltered (&debug_file, "[");
for (i = 0; i < register_size (gdbarch, regnum); i++)
- fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
- fprintf_unfiltered (gdb_stdlog, "]");
+ fprintf_unfiltered (&debug_file, "%02x", buf[i]);
+ fprintf_unfiltered (&debug_file, "]");
}
}
- fprintf_unfiltered (gdb_stdlog, " }\n");
+ frame_debug_printf ("%s", debug_file.c_str ());
}
return value;
@@ -1623,12 +1622,17 @@ create_sentinel_frame (struct program_space *pspace, struct regcache *regcache)
/* The sentinel frame has a special ID. */
frame->this_id.p = frame_id_status::COMPUTED;
frame->this_id.value = sentinel_frame_id;
+
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "{ create_sentinel_frame (...) -> ");
- fprint_frame (gdb_stdlog, frame);
- fprintf_unfiltered (gdb_stdlog, " }\n");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " -> ");
+ fprint_frame (&debug_file, frame);
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
+
return frame;
}
@@ -1952,12 +1956,8 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
{
struct frame_info *fi;
- if (frame_debug)
- {
- fprintf_unfiltered (gdb_stdlog,
- "{ create_new_frame (addr=%s, pc=%s) ",
- hex_string (addr), hex_string (pc));
- }
+ frame_debug_printf ("addr=%s, pc=%s",
+ hex_string (addr), hex_string (pc));
fi = FRAME_OBSTACK_ZALLOC (struct frame_info);
@@ -1984,9 +1984,12 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, fi);
- fprintf_unfiltered (gdb_stdlog, " }\n");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " -> ");
+ fprint_frame (&debug_file, fi);
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
return fi;
@@ -2060,8 +2063,8 @@ reinit_frame_cache (void)
sentinel_frame = NULL; /* Invalidate cache */
select_frame (NULL);
frame_stash_invalidate ();
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog, "{ reinit_frame_cache () }\n");
+
+ frame_debug_printf ("called, generation=%d", frame_cache_generation);
}
/* Find where a register is saved (in memory or another register).
@@ -2131,9 +2134,13 @@ get_prev_frame_if_no_cycle (struct frame_info *this_frame)
detected a cycle. */
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, NULL);
- fprintf_unfiltered (gdb_stdlog, " // this frame has same ID }\n");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " -> ");
+ fprint_frame (&debug_file, NULL);
+ fprintf_unfiltered (&debug_file, " // this frame has same ID");
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
this_frame->stop_reason = UNWIND_SAME_ID;
/* Unlink. */
@@ -2170,12 +2177,16 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "{ get_prev_frame_always (this_frame=");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, "this_frame=");
+
if (this_frame != NULL)
- fprintf_unfiltered (gdb_stdlog, "%d", this_frame->level);
+ fprintf_unfiltered (&debug_file, "%d", this_frame->level);
else
- fprintf_unfiltered (gdb_stdlog, "<NULL>");
- fprintf_unfiltered (gdb_stdlog, ") ");
+ fprintf_unfiltered (&debug_file, "<NULL>");
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
/* Only try to do the unwind once. */
@@ -2183,9 +2194,13 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
{
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, this_frame->prev);
- fprintf_unfiltered (gdb_stdlog, " // cached \n");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " -> ");
+ fprint_frame (&debug_file, this_frame->prev);
+ fprintf_unfiltered (&debug_file, " // cached");
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
return this_frame->prev;
}
@@ -2235,12 +2250,15 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
{
if (frame_debug)
{
+ string_file debug_file;
enum unwind_stop_reason reason = this_frame->stop_reason;
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, NULL);
- fprintf_unfiltered (gdb_stdlog, " // %s }\n",
+ fprintf_unfiltered (&debug_file, "-> ");
+ fprint_frame (&debug_file, NULL);
+ fprintf_unfiltered (&debug_file, " // %s",
frame_stop_reason_symbol_string (reason));
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
return NULL;
}
@@ -2268,10 +2286,14 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
{
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, NULL);
- fprintf_unfiltered (gdb_stdlog,
- " // this frame ID is inner }\n");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " -> ");
+ fprint_frame (&debug_file, NULL);
+ fprintf_unfiltered (&debug_file,
+ " // this frame ID is inner");
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
this_frame->stop_reason = UNWIND_INNER_ID;
return NULL;
@@ -2314,9 +2336,13 @@ get_prev_frame_always_1 (struct frame_info *this_frame)
{
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, NULL);
- fprintf_unfiltered (gdb_stdlog, " // no saved PC }\n");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " -> ");
+ fprint_frame (&debug_file, NULL);
+ fprintf_unfiltered (&debug_file, " // no saved PC");
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
this_frame->stop_reason = UNWIND_NO_SAVED_PC;
@@ -2422,9 +2448,12 @@ get_prev_frame_raw (struct frame_info *this_frame)
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "-> ");
- fprint_frame (gdb_stdlog, prev_frame);
- fprintf_unfiltered (gdb_stdlog, " }\n");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, " -> ");
+ fprint_frame (&debug_file, prev_frame);
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
return prev_frame;
@@ -2438,12 +2467,18 @@ frame_debug_got_null_frame (struct frame_info *this_frame,
{
if (frame_debug)
{
- fprintf_unfiltered (gdb_stdlog, "{ get_prev_frame (this_frame=");
+ string_file debug_file;
+
+ fprintf_unfiltered (&debug_file, "this_frame=");
+
if (this_frame != NULL)
- fprintf_unfiltered (gdb_stdlog, "%d", this_frame->level);
+ fprintf_unfiltered (&debug_file, "%d", this_frame->level);
else
- fprintf_unfiltered (gdb_stdlog, "<NULL>");
- fprintf_unfiltered (gdb_stdlog, ") -> // %s}\n", reason);
+ fprintf_unfiltered (&debug_file, "<NULL>");
+
+ fprintf_unfiltered (&debug_file, " -> %s", reason);
+
+ frame_debug_printf ("%s", debug_file.c_str ());
}
}
@@ -2957,11 +2992,10 @@ frame_unwind_arch (struct frame_info *next_frame)
next_frame->prev_arch.arch = arch;
next_frame->prev_arch.p = true;
- if (frame_debug)
- fprintf_unfiltered (gdb_stdlog,
- "{ frame_unwind_arch (next_frame=%d) -> %s }\n",
- next_frame->level,
- gdbarch_bfd_arch_info (arch)->printable_name);
+
+ frame_debug_printf ("next_frame=%d -> %s",
+ next_frame->level,
+ gdbarch_bfd_arch_info (arch)->printable_name);
}
return next_frame->prev_arch.arch;
diff --git a/gdb/frame.h b/gdb/frame.h
index 597a459..7a23126 100644
--- a/gdb/frame.h
+++ b/gdb/frame.h
@@ -213,6 +213,11 @@ extern const struct frame_id outer_frame_id;
extern unsigned int frame_debug;
+/* Print a "frame" debug statement. */
+
+#define frame_debug_printf(fmt, ...) \
+ debug_prefixed_printf_cond (frame_debug, "frame", fmt, ##__VA_ARGS__)
+
/* Construct a frame ID. The first parameter is the frame's constant
stack address (typically the outer-bound), and the second the
frame's constant code address (typically the entry point).
diff --git a/gdb/value.c b/gdb/value.c
index 3bd81e7..73e46af 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3955,18 +3955,18 @@ value_fetch_lazy_register (struct value *val)
frame = frame_find_by_id (VALUE_FRAME_ID (val));
regnum = VALUE_REGNUM (val);
gdbarch = get_frame_arch (frame);
+ string_file debug_file;
- fprintf_unfiltered (gdb_stdlog,
- "{ value_fetch_lazy "
- "(frame=%d,regnum=%d(%s),...) ",
+ fprintf_unfiltered (&debug_file,
+ "(frame=%d, regnum=%d(%s),...) ",
frame_relative_level (frame), regnum,
user_reg_map_regnum_to_name (gdbarch, regnum));
- fprintf_unfiltered (gdb_stdlog, "->");
+ fprintf_unfiltered (&debug_file, "->");
if (value_optimized_out (new_val))
{
- fprintf_unfiltered (gdb_stdlog, " ");
- val_print_optimized_out (new_val, gdb_stdlog);
+ fprintf_unfiltered (&debug_file, " ");
+ val_print_optimized_out (new_val, &debug_file);
}
else
{
@@ -3974,23 +3974,23 @@ value_fetch_lazy_register (struct value *val)
const gdb_byte *buf = value_contents (new_val);
if (VALUE_LVAL (new_val) == lval_register)
- fprintf_unfiltered (gdb_stdlog, " register=%d",
+ fprintf_unfiltered (&debug_file, " register=%d",
VALUE_REGNUM (new_val));
else if (VALUE_LVAL (new_val) == lval_memory)
- fprintf_unfiltered (gdb_stdlog, " address=%s",
+ fprintf_unfiltered (&debug_file, " address=%s",
paddress (gdbarch,
value_address (new_val)));
else
- fprintf_unfiltered (gdb_stdlog, " computed");
+ fprintf_unfiltered (&debug_file, " computed");
- fprintf_unfiltered (gdb_stdlog, " bytes=");
- fprintf_unfiltered (gdb_stdlog, "[");
+ fprintf_unfiltered (&debug_file, " bytes=");
+ fprintf_unfiltered (&debug_file, "[");
for (i = 0; i < register_size (gdbarch, regnum); i++)
- fprintf_unfiltered (gdb_stdlog, "%02x", buf[i]);
- fprintf_unfiltered (gdb_stdlog, "]");
+ fprintf_unfiltered (&debug_file, "%02x", buf[i]);
+ fprintf_unfiltered (&debug_file, "]");
}
- fprintf_unfiltered (gdb_stdlog, " }\n");
+ frame_debug_printf ("%s", debug_file.c_str ());
}
/* Dispose of the intermediate values. This prevents