aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c270
1 files changed, 152 insertions, 118 deletions
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;