aboutsummaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c368
1 files changed, 173 insertions, 195 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index a08a8f4..05a8501 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -21,7 +21,7 @@
#include "frame.h"
#include "target.h"
#include "value.h"
-#include "inferior.h" /* for inferior_ptid */
+#include "inferior.h" /* for inferior_ptid */
#include "regcache.h"
#include "user-regs.h"
#include "gdbsupport/gdb_obstack.h"
@@ -68,7 +68,8 @@ get_frame_cache_generation ()
set_backtrace_options user_set_backtrace_options;
static frame_info_ptr get_prev_frame_raw (frame_info_ptr this_frame);
-static const char *frame_stop_reason_symbol_string (enum unwind_stop_reason reason);
+static const char *
+frame_stop_reason_symbol_string (enum unwind_stop_reason reason);
static frame_info_ptr create_new_frame (frame_id id);
/* Status of some values cached in the frame_info object. */
@@ -148,7 +149,8 @@ struct frame_info
} prev_arch;
/* Cached copy of the previous frame's resume address. */
- struct {
+ struct
+ {
cached_copy_status status;
/* Did VALUE require unmasking when being read. */
bool masked;
@@ -227,19 +229,16 @@ frame_addr_hash (const void *ap)
const struct frame_id f_id = frame->this_id.value;
hashval_t hash = 0;
- gdb_assert (f_id.stack_status != FID_STACK_INVALID
- || f_id.code_addr_p
+ gdb_assert (f_id.stack_status != FID_STACK_INVALID || f_id.code_addr_p
|| f_id.special_addr_p);
if (f_id.stack_status == FID_STACK_VALID)
- hash = iterative_hash (&f_id.stack_addr,
- sizeof (f_id.stack_addr), hash);
+ hash = iterative_hash (&f_id.stack_addr, sizeof (f_id.stack_addr), hash);
if (f_id.code_addr_p)
- hash = iterative_hash (&f_id.code_addr,
- sizeof (f_id.code_addr), hash);
+ hash = iterative_hash (&f_id.code_addr, sizeof (f_id.code_addr), hash);
if (f_id.special_addr_p)
- hash = iterative_hash (&f_id.special_addr,
- sizeof (f_id.special_addr), hash);
+ hash
+ = iterative_hash (&f_id.special_addr, sizeof (f_id.special_addr), hash);
char user_created_p = f_id.user_created_p;
hash = iterative_hash (&user_created_p, sizeof (user_created_p), hash);
@@ -265,10 +264,7 @@ frame_addr_hash_eq (const void *a, const void *b)
static void
frame_stash_create (void)
{
- frame_stash = htab_create (100,
- frame_addr_hash,
- frame_addr_hash_eq,
- NULL);
+ frame_stash = htab_create (100, frame_addr_hash, frame_addr_hash_eq, NULL);
}
/* Internal function to add a frame to the frame_stash hash table.
@@ -281,8 +277,8 @@ frame_stash_add (frame_info *frame)
/* Do not try to stash the sentinel frame. */
gdb_assert (frame->level >= 0);
- frame_info **slot = (frame_info **) htab_find_slot (frame_stash,
- frame, INSERT);
+ frame_info **slot
+ = (frame_info **) htab_find_slot (frame_stash, frame, INSERT);
/* If we already have a frame in the stack with the same id, we
either have a stack cycle (corrupted stack?), or some bug
@@ -342,7 +338,7 @@ static void
show_frame_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Frame debugging is %s.\n"), value);
+ gdb_printf (file, _ ("Frame debugging is %s.\n"), value);
}
/* Implementation of "show backtrace past-main". */
@@ -352,8 +348,8 @@ show_backtrace_past_main (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("Whether backtraces should "
- "continue past \"main\" is %s.\n"),
+ _ ("Whether backtraces should "
+ "continue past \"main\" is %s.\n"),
value);
}
@@ -363,8 +359,9 @@ static void
show_backtrace_past_entry (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- gdb_printf (file, _("Whether backtraces should continue past the "
- "entry point of a program is %s.\n"),
+ gdb_printf (file,
+ _ ("Whether backtraces should continue past the "
+ "entry point of a program is %s.\n"),
value);
}
@@ -375,8 +372,8 @@ show_backtrace_limit (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
gdb_printf (file,
- _("An upper bound on the number "
- "of backtrace levels is %s.\n"),
+ _ ("An upper bound on the number "
+ "of backtrace levels is %s.\n"),
value);
}
@@ -401,8 +398,8 @@ frame_id::to_string () const
res += std::string ("stack=") + hex_string (id.stack_addr);
/* Helper function to format 'N=A' if P is true, otherwise '!N'. */
- auto field_to_string = [] (const char *n, bool p, CORE_ADDR a) -> std::string
- {
+ auto field_to_string
+ = [] (const char *n, bool p, CORE_ADDR a) -> std::string {
if (p)
return std::string (n) + "=" + core_addr_to_string (a);
else
@@ -453,7 +450,7 @@ frame_type_str (frame_type type)
};
}
- /* See struct frame_info. */
+/* See struct frame_info. */
std::string
frame_info::to_string () const
@@ -665,7 +662,8 @@ frame_unwind_caller_id (frame_info_ptr next_frame)
}
const struct frame_id null_frame_id = { 0 }; /* All zeros. */
-const struct frame_id sentinel_frame_id = { 0, 0, 0, FID_STACK_SENTINEL, 0, 1, 0 };
+const struct frame_id sentinel_frame_id
+ = { 0, 0, 0, FID_STACK_SENTINEL, 0, 1, 0 };
const struct frame_id outer_frame_id = { 0, 0, 0, FID_STACK_OUTER, 0, 1, 0 };
struct frame_id
@@ -759,8 +757,7 @@ frame_id::operator== (const frame_id &r) const
{
bool eq;
- if (stack_status == FID_STACK_INVALID
- || r.stack_status == FID_STACK_INVALID)
+ if (stack_status == FID_STACK_INVALID || r.stack_status == FID_STACK_INVALID)
/* Like a NaN, if either ID is invalid, the result is false.
Note that a frame ID is invalid iff it is the null frame ID. */
eq = false;
@@ -785,8 +782,8 @@ frame_id::operator== (const frame_id &r) const
/* Frames are equal. */
eq = true;
- frame_debug_printf ("l=%s, r=%s -> %d",
- to_string ().c_str (), r.to_string ().c_str (), eq);
+ frame_debug_printf ("l=%s, r=%s -> %d", to_string ().c_str (),
+ r.to_string ().c_str (), eq);
return eq;
}
@@ -833,8 +830,7 @@ frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
Likewise if either ID has an unavailable stack address. */
inner = false;
else if (l.artificial_depth > r.artificial_depth
- && l.stack_addr == r.stack_addr
- && l.code_addr_p == r.code_addr_p
+ && l.stack_addr == r.stack_addr && l.code_addr_p == r.code_addr_p
&& l.special_addr_p == r.special_addr_p
&& l.special_addr == r.special_addr)
{
@@ -862,9 +858,8 @@ frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
different .code and/or .special address). */
inner = gdbarch_inner_than (gdbarch, l.stack_addr, r.stack_addr);
- frame_debug_printf ("is l=%s inner than r=%s? %d",
- l.to_string ().c_str (), r.to_string ().c_str (),
- inner);
+ frame_debug_printf ("is l=%s inner than r=%s? %d", l.to_string ().c_str (),
+ r.to_string ().c_str (), inner);
return inner;
}
@@ -895,7 +890,7 @@ frame_find_by_id (struct frame_id id)
if (frame)
return frame;
- for (frame = get_current_frame (); ; frame = prev_frame)
+ for (frame = get_current_frame ();; frame = prev_frame)
{
struct frame_id self = get_frame_id (frame);
@@ -978,8 +973,7 @@ frame_unwind_pc (frame_info_ptr this_frame)
this_frame->prev_pc.value = pc;
this_frame->prev_pc.status = CC_VALUE;
- frame_debug_printf ("this_frame=%d -> %s",
- this_frame->level,
+ frame_debug_printf ("this_frame=%d -> %s", this_frame->level,
hex_string (this_frame->prev_pc.value));
}
}
@@ -987,9 +981,9 @@ frame_unwind_pc (frame_info_ptr this_frame)
if (this_frame->prev_pc.status == CC_VALUE)
return this_frame->prev_pc.value;
else if (this_frame->prev_pc.status == CC_UNAVAILABLE)
- throw_error (NOT_AVAILABLE_ERROR, _("PC not available"));
+ throw_error (NOT_AVAILABLE_ERROR, _ ("PC not available"));
else if (this_frame->prev_pc.status == CC_NOT_SAVED)
- throw_error (OPTIMIZED_OUT_ERROR, _("PC not saved"));
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("PC not saved"));
else
internal_error ("unexpected prev_pc status: %d",
(int) this_frame->prev_pc.status);
@@ -1019,7 +1013,8 @@ get_frame_func_if_available (frame_info_ptr this_frame, CORE_ADDR *pc)
/* Make certain that this, and not the adjacent, function is
found. */
- if (!get_frame_address_in_block_if_available (this_frame, &addr_in_block))
+ if (!get_frame_address_in_block_if_available (this_frame,
+ &addr_in_block))
{
next_frame->prev_func.status = CC_UNAVAILABLE;
@@ -1031,8 +1026,7 @@ get_frame_func_if_available (frame_info_ptr this_frame, CORE_ADDR *pc)
next_frame->prev_func.status = CC_VALUE;
next_frame->prev_func.addr = get_pc_function_start (addr_in_block);
- frame_debug_printf ("this_frame=%d -> %s",
- this_frame->level,
+ frame_debug_printf ("this_frame=%d -> %s", this_frame->level,
hex_string (next_frame->prev_func.addr));
}
}
@@ -1057,7 +1051,7 @@ get_frame_func (frame_info_ptr this_frame)
CORE_ADDR pc;
if (!get_frame_func_if_available (this_frame, &pc))
- throw_error (NOT_AVAILABLE_ERROR, _("PC not available"));
+ throw_error (NOT_AVAILABLE_ERROR, _ ("PC not available"));
return pc;
}
@@ -1065,16 +1059,15 @@ get_frame_func (frame_info_ptr this_frame)
std::unique_ptr<readonly_detached_regcache>
frame_save_as_regcache (frame_info_ptr this_frame)
{
- auto cooked_read = [this_frame] (int regnum, gdb_byte *buf)
- {
- if (!deprecated_frame_register_read (this_frame, regnum, buf))
- return REG_UNAVAILABLE;
- else
- return REG_VALID;
- };
+ auto cooked_read = [this_frame] (int regnum, gdb_byte *buf) {
+ if (!deprecated_frame_register_read (this_frame, regnum, buf))
+ return REG_UNAVAILABLE;
+ else
+ return REG_VALID;
+ };
- std::unique_ptr<readonly_detached_regcache> regcache
- (new readonly_detached_regcache (get_frame_arch (this_frame), cooked_read));
+ std::unique_ptr<readonly_detached_regcache> regcache (
+ new readonly_detached_regcache (get_frame_arch (this_frame), cooked_read));
return regcache;
}
@@ -1096,14 +1089,14 @@ frame_pop (frame_info_ptr this_frame)
prev_frame = get_prev_frame_always (this_frame);
if (!prev_frame)
- error (_("Cannot pop the initial frame."));
+ error (_ ("Cannot pop the initial frame."));
/* Ignore TAILCALL_FRAME type frames, they were executed already before
entering THISFRAME. */
prev_frame = skip_tailcall_frames (prev_frame);
if (prev_frame == NULL)
- error (_("Cannot find the caller frame."));
+ error (_ ("Cannot find the caller frame."));
/* Make a copy of all the register values unwound from this frame.
Save them in a scratch buffer so that there isn't a race between
@@ -1129,10 +1122,9 @@ frame_pop (frame_info_ptr this_frame)
}
void
-frame_register_unwind (frame_info_ptr next_frame, int regnum,
- int *optimizedp, int *unavailablep,
- enum lval_type *lvalp, CORE_ADDR *addrp,
- int *realnump, gdb_byte *bufferp)
+frame_register_unwind (frame_info_ptr next_frame, int regnum, int *optimizedp,
+ int *unavailablep, enum lval_type *lvalp,
+ CORE_ADDR *addrp, int *realnump, gdb_byte *bufferp)
{
struct value *value;
@@ -1177,9 +1169,9 @@ frame_register_unwind (frame_info_ptr next_frame, int regnum,
VALUEP is NULL, the registers value is not fetched/computed. */
static void
-frame_register (frame_info_ptr frame, int regnum,
- int *optimizedp, int *unavailablep, enum lval_type *lvalp,
- CORE_ADDR *addrp, int *realnump, gdb_byte *bufferp)
+frame_register (frame_info_ptr frame, int regnum, int *optimizedp,
+ int *unavailablep, enum lval_type *lvalp, CORE_ADDR *addrp,
+ int *realnump, gdb_byte *bufferp)
{
/* Require all but BUFFERP to be valid. A NULL BUFFERP indicates
that the value proper does not need to be fetched. */
@@ -1205,20 +1197,18 @@ frame_unwind_register (frame_info_ptr next_frame, int regnum, gdb_byte *buf)
int realnum;
enum lval_type lval;
- frame_register_unwind (next_frame, regnum, &optimized, &unavailable,
- &lval, &addr, &realnum, buf);
+ frame_register_unwind (next_frame, regnum, &optimized, &unavailable, &lval,
+ &addr, &realnum, buf);
if (optimized)
- throw_error (OPTIMIZED_OUT_ERROR,
- _("Register %d was not saved"), regnum);
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("Register %d was not saved"), regnum);
if (unavailable)
- throw_error (NOT_AVAILABLE_ERROR,
- _("Register %d is not available"), regnum);
+ throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"),
+ regnum);
}
void
-get_frame_register (frame_info_ptr frame,
- int regnum, gdb_byte *buf)
+get_frame_register (frame_info_ptr frame, int regnum, gdb_byte *buf)
{
frame_unwind_register (frame_info_ptr (frame->next), regnum, buf);
}
@@ -1230,8 +1220,7 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
gdb_assert (next_frame != NULL);
gdbarch *gdbarch = frame_unwind_arch (next_frame);
- frame_debug_printf ("frame=%d, regnum=%d(%s)",
- next_frame->level, regnum,
+ frame_debug_printf ("frame=%d, regnum=%d(%s)", next_frame->level, regnum,
user_reg_map_regnum_to_name (gdbarch, regnum));
/* Find the unwinder. */
@@ -1239,9 +1228,9 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
frame_unwind_find_by_frame (next_frame, &next_frame->prologue_cache);
/* Ask this frame to unwind its register. */
- value *value = next_frame->unwind->prev_register (next_frame,
- &next_frame->prologue_cache,
- regnum);
+ value *value
+ = next_frame->unwind->prev_register (next_frame,
+ &next_frame->prologue_cache, regnum);
if (frame_debug)
{
@@ -1256,12 +1245,10 @@ frame_unwind_register_value (frame_info_ptr next_frame, int regnum)
else
{
if (VALUE_LVAL (value) == lval_register)
- gdb_printf (&debug_file, " register=%d",
- VALUE_REGNUM (value));
+ gdb_printf (&debug_file, " register=%d", VALUE_REGNUM (value));
else if (VALUE_LVAL (value) == lval_memory)
gdb_printf (&debug_file, " address=%s",
- paddress (gdbarch,
- value_address (value)));
+ paddress (gdbarch, value_address (value)));
else
gdb_printf (&debug_file, " computed");
@@ -1303,13 +1290,13 @@ frame_unwind_register_signed (frame_info_ptr next_frame, int regnum)
if (value_optimized_out (value))
{
- throw_error (OPTIMIZED_OUT_ERROR,
- _("Register %d was not saved"), regnum);
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("Register %d was not saved"),
+ regnum);
}
if (!value_entirely_available (value))
{
- throw_error (NOT_AVAILABLE_ERROR,
- _("Register %d is not available"), regnum);
+ throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"),
+ regnum);
}
LONGEST r = extract_signed_integer (value_contents_all (value), byte_order);
@@ -1336,13 +1323,13 @@ frame_unwind_register_unsigned (frame_info_ptr next_frame, int regnum)
if (value_optimized_out (value))
{
- throw_error (OPTIMIZED_OUT_ERROR,
- _("Register %d was not saved"), regnum);
+ throw_error (OPTIMIZED_OUT_ERROR, _ ("Register %d was not saved"),
+ regnum);
}
if (!value_entirely_available (value))
{
- throw_error (NOT_AVAILABLE_ERROR,
- _("Register %d is not available"), regnum);
+ throw_error (NOT_AVAILABLE_ERROR, _ ("Register %d is not available"),
+ regnum);
}
ULONGEST r = extract_unsigned_integer (value_contents_all (value).data (),
@@ -1359,13 +1346,11 @@ get_frame_register_unsigned (frame_info_ptr frame, int regnum)
}
bool
-read_frame_register_unsigned (frame_info_ptr frame, int regnum,
- ULONGEST *val)
+read_frame_register_unsigned (frame_info_ptr frame, int regnum, ULONGEST *val)
{
struct value *regval = get_frame_register_value (frame, regnum);
- if (!value_optimized_out (regval)
- && value_entirely_available (regval))
+ if (!value_optimized_out (regval) && value_entirely_available (regval))
{
struct gdbarch *gdbarch = get_frame_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -1380,8 +1365,7 @@ read_frame_register_unsigned (frame_info_ptr frame, int regnum,
}
void
-put_frame_register (frame_info_ptr frame, int regnum,
- const gdb_byte *buf)
+put_frame_register (frame_info_ptr frame, int regnum, const gdb_byte *buf)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int realnum;
@@ -1390,10 +1374,10 @@ put_frame_register (frame_info_ptr frame, int regnum,
enum lval_type lval;
CORE_ADDR addr;
- frame_register (frame, regnum, &optim, &unavail,
- &lval, &addr, &realnum, NULL);
+ frame_register (frame, regnum, &optim, &unavail, &lval, &addr, &realnum,
+ NULL);
if (optim)
- error (_("Attempt to assign to a register that was not saved."));
+ error (_ ("Attempt to assign to a register that was not saved."));
switch (lval)
{
case lval_memory:
@@ -1405,7 +1389,7 @@ put_frame_register (frame_info_ptr frame, int regnum,
get_current_regcache ()->cooked_write (realnum, buf);
break;
default:
- error (_("Attempt to assign to an unmodifiable value."));
+ error (_ ("Attempt to assign to an unmodifiable value."));
}
}
@@ -1427,17 +1411,16 @@ deprecated_frame_register_read (frame_info_ptr frame, int regnum,
CORE_ADDR addr;
int realnum;
- frame_register (frame, regnum, &optimized, &unavailable,
- &lval, &addr, &realnum, myaddr);
+ frame_register (frame, regnum, &optimized, &unavailable, &lval, &addr,
+ &realnum, myaddr);
return !optimized && !unavailable;
}
bool
-get_frame_register_bytes (frame_info_ptr frame, int regnum,
- CORE_ADDR offset,
- gdb::array_view<gdb_byte> buffer,
- int *optimizedp, int *unavailablep)
+get_frame_register_bytes (frame_info_ptr frame, int regnum, CORE_ADDR offset,
+ gdb::array_view<gdb_byte> buffer, int *optimizedp,
+ int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
int i;
@@ -1460,14 +1443,15 @@ get_frame_register_bytes (frame_info_ptr frame, int regnum,
int thissize = register_size (gdbarch, i);
if (thissize == 0)
- break; /* This register is not available on this architecture. */
+ break; /* This register is not available on this architecture. */
maxsize += thissize;
}
int len = buffer.size ();
if (len > maxsize)
- error (_("Bad debug information detected: "
- "Attempt to read %d bytes from registers."), len);
+ error (_ ("Bad debug information detected: "
+ "Attempt to read %d bytes from registers."),
+ len);
/* Copy the data. */
while (len > 0)
@@ -1485,8 +1469,8 @@ get_frame_register_bytes (frame_info_ptr frame, int regnum,
CORE_ADDR addr;
int realnum;
- frame_register (frame, regnum, optimizedp, unavailablep,
- &lval, &addr, &realnum, myaddr);
+ frame_register (frame, regnum, optimizedp, unavailablep, &lval,
+ &addr, &realnum, myaddr);
if (*optimizedp || *unavailablep)
return false;
}
@@ -1523,8 +1507,7 @@ get_frame_register_bytes (frame_info_ptr frame, int regnum,
}
void
-put_frame_register_bytes (frame_info_ptr frame, int regnum,
- CORE_ADDR offset,
+put_frame_register_bytes (frame_info_ptr frame, int regnum, CORE_ADDR offset,
gdb::array_view<const gdb_byte> buffer)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1627,18 +1610,18 @@ get_current_frame (void)
explicitly checks that ``print $pc'' with no registers prints "No
registers". */
if (!target_has_registers ())
- error (_("No registers."));
+ error (_ ("No registers."));
if (!target_has_stack ())
- error (_("No stack."));
+ error (_ ("No stack."));
if (!target_has_memory ())
- error (_("No memory."));
+ error (_ ("No memory."));
/* Traceframes are effectively a substitute for the live inferior. */
if (get_traceframe_number () < 0)
validate_registers_access ();
if (sentinel_frame == NULL)
- sentinel_frame =
- create_sentinel_frame (current_program_space, get_current_regcache ());
+ sentinel_frame
+ = create_sentinel_frame (current_program_space, get_current_regcache ());
/* Set the current frame before computing the frame id, to avoid
recursion inside compute_frame_id, in case the frame's
@@ -1690,8 +1673,7 @@ static frame_info_ptr selected_frame;
/* See frame.h. */
void
-save_selected_frame (frame_id *frame_id, int *frame_level)
- noexcept
+save_selected_frame (frame_id *frame_id, int *frame_level) noexcept
{
*frame_id = selected_frame_id;
*frame_level = selected_frame_level;
@@ -1700,8 +1682,7 @@ save_selected_frame (frame_id *frame_id, int *frame_level)
/* See frame.h. */
void
-restore_selected_frame (frame_id frame_id, int frame_level)
- noexcept
+restore_selected_frame (frame_id frame_id, int frame_level) noexcept
{
/* Unless it is a user-created frame, save_selected_frame never returns
level == 0, so we shouldn't see it here either. */
@@ -1787,8 +1768,8 @@ lookup_selected_frame (struct frame_id a_frame_id, int frame_level)
/* Warn the user. */
if (frame_level > 0 && !current_uiout->is_mi_like_p ())
{
- warning (_("Couldn't restore frame #%d in "
- "current thread. Bottom (innermost) frame selected:"),
+ warning (_ ("Couldn't restore frame #%d in "
+ "current thread. Bottom (innermost) frame selected:"),
frame_level);
/* For MI, we should probably have a notification about current
frame change. But this error is not very likely, so don't
@@ -1963,8 +1944,8 @@ create_new_frame (frame_id id)
frame_info *fi = FRAME_OBSTACK_ZALLOC (struct frame_info);
- fi->next = create_sentinel_frame (current_program_space,
- get_current_regcache ());
+ fi->next
+ = create_sentinel_frame (current_program_space, get_current_regcache ());
/* Set/update this frame's cached PC value, found in the next frame.
Do this before looking for this frame's unwinder. A sniffer is
@@ -2064,7 +2045,7 @@ reinit_frame_cache (void)
if (sentinel_frame != NULL)
annotate_frames_invalid ();
- sentinel_frame = NULL; /* Invalidate cache */
+ sentinel_frame = NULL; /* Invalidate cache */
invalidate_selected_frame ();
frame_stash_invalidate ();
@@ -2169,8 +2150,7 @@ get_prev_frame_maybe_check_cycle (frame_info_ptr this_frame)
COMPUTING. */
gdb_assert (cycle_detection_p
|| (this_frame->level > 0
- && (this_frame->this_id.p
- == frame_id_status::COMPUTING))
+ && (this_frame->this_id.p == frame_id_status::COMPUTING))
|| (this_frame->level == 0
&& (this_frame->this_id.p
!= frame_id_status::COMPUTED)));
@@ -2234,9 +2214,9 @@ get_prev_frame_always_1 (frame_info_ptr this_frame)
frame_debug_printf (" -> %s // cached",
this_frame->prev->to_string ().c_str ());
else
- frame_debug_printf
- (" -> nullptr // %s // cached",
- frame_stop_reason_symbol_string (this_frame->stop_reason));
+ frame_debug_printf (
+ " -> nullptr // %s // cached",
+ frame_stop_reason_symbol_string (this_frame->stop_reason));
return frame_info_ptr (this_frame->prev);
}
@@ -2283,9 +2263,9 @@ get_prev_frame_always_1 (frame_info_ptr this_frame)
if (this_frame->stop_reason != UNWIND_NO_REASON)
{
- frame_debug_printf
- (" -> nullptr // %s",
- frame_stop_reason_symbol_string (this_frame->stop_reason));
+ frame_debug_printf (
+ " -> nullptr // %s",
+ frame_stop_reason_symbol_string (this_frame->stop_reason));
return NULL;
}
@@ -2330,22 +2310,21 @@ get_prev_frame_always_1 (frame_info_ptr this_frame)
to have the frame prev_pc method and the gdbarch unwind_pc
method set the same lval and location information as
frame_register_unwind. */
- if (this_frame->level > 0
- && gdbarch_pc_regnum (gdbarch) >= 0
+ if (this_frame->level > 0 && gdbarch_pc_regnum (gdbarch) >= 0
&& get_frame_type (this_frame) == NORMAL_FRAME
&& (get_frame_type (frame_info_ptr (this_frame->next)) == NORMAL_FRAME
- || get_frame_type (frame_info_ptr (this_frame->next)) == INLINE_FRAME))
+ || get_frame_type (frame_info_ptr (this_frame->next))
+ == INLINE_FRAME))
{
int optimized, realnum, nrealnum;
enum lval_type lval, nlval;
CORE_ADDR addr, naddr;
- frame_register_unwind_location (this_frame,
- gdbarch_pc_regnum (gdbarch),
+ frame_register_unwind_location (this_frame, gdbarch_pc_regnum (gdbarch),
&optimized, &lval, &addr, &realnum);
frame_register_unwind_location (get_next_frame (this_frame),
- gdbarch_pc_regnum (gdbarch),
- &optimized, &nlval, &naddr, &nrealnum);
+ gdbarch_pc_regnum (gdbarch), &optimized,
+ &nlval, &naddr, &nrealnum);
if ((lval == lval_memory && lval == nlval && addr == naddr)
|| (lval == lval_register && lval == nlval && realnum == nrealnum))
@@ -2460,8 +2439,7 @@ get_prev_frame_raw (frame_info_ptr this_frame)
/* Debug routine to print a NULL frame being returned. */
static void
-frame_debug_got_null_frame (frame_info_ptr this_frame,
- const char *reason)
+frame_debug_got_null_frame (frame_info_ptr this_frame, const char *reason)
{
if (frame_debug)
{
@@ -2503,8 +2481,10 @@ inside_main_func (frame_info_ptr this_frame)
/* Convert any function descriptor addresses into the actual function
code address. */
- sym_addr = gdbarch_convert_from_func_ptr_addr
- (get_frame_arch (this_frame), sym_addr, current_inferior ()->top_target ());
+ sym_addr
+ = gdbarch_convert_from_func_ptr_addr (get_frame_arch (this_frame),
+ sym_addr,
+ current_inferior ()->top_target ());
return sym_addr == get_frame_func (this_frame);
}
@@ -2556,10 +2536,8 @@ get_prev_frame (frame_info_ptr this_frame)
the inferior was when the user function was called. If gdb was inside
the main function when we created the dummy frame, the dummy frame will
point inside the main function. */
- if (this_frame->level >= 0
- && get_frame_type (this_frame) == NORMAL_FRAME
- && !user_set_backtrace_options.backtrace_past_main
- && frame_pc_p
+ if (this_frame->level >= 0 && get_frame_type (this_frame) == NORMAL_FRAME
+ && !user_set_backtrace_options.backtrace_past_main && frame_pc_p
&& inside_main_func (this_frame))
/* Don't unwind past main(). Note, this is done _before_ the
frame has been marked as previously unwound. That way if the
@@ -2603,10 +2581,8 @@ get_prev_frame (frame_info_ptr this_frame)
from main returns directly to the caller of main. Since we don't
stop at main, we should at least stop at the entry point of the
application. */
- if (this_frame->level >= 0
- && get_frame_type (this_frame) == NORMAL_FRAME
- && !user_set_backtrace_options.backtrace_past_entry
- && frame_pc_p
+ if (this_frame->level >= 0 && get_frame_type (this_frame) == NORMAL_FRAME
+ && !user_set_backtrace_options.backtrace_past_entry && frame_pc_p
&& inside_entry_func (this_frame))
{
frame_debug_got_null_frame (this_frame, "inside entry func");
@@ -2639,7 +2615,6 @@ get_frame_pc (frame_info_ptr frame)
bool
get_frame_pc_if_available (frame_info_ptr frame, CORE_ADDR *pc)
{
-
gdb_assert (frame->next != NULL);
try
@@ -2723,7 +2698,6 @@ bool
get_frame_address_in_block_if_available (frame_info_ptr this_frame,
CORE_ADDR *pc)
{
-
try
{
*pc = get_frame_address_in_block (this_frame);
@@ -2915,8 +2889,7 @@ get_frame_memory (frame_info_ptr this_frame, CORE_ADDR addr,
}
LONGEST
-get_frame_memory_signed (frame_info_ptr this_frame, CORE_ADDR addr,
- int len)
+get_frame_memory_signed (frame_info_ptr this_frame, CORE_ADDR addr, int len)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2925,8 +2898,7 @@ get_frame_memory_signed (frame_info_ptr this_frame, CORE_ADDR addr,
}
ULONGEST
-get_frame_memory_unsigned (frame_info_ptr this_frame, CORE_ADDR addr,
- int len)
+get_frame_memory_unsigned (frame_info_ptr this_frame, CORE_ADDR addr, int len)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
@@ -2935,8 +2907,8 @@ get_frame_memory_unsigned (frame_info_ptr this_frame, CORE_ADDR addr,
}
bool
-safe_frame_unwind_memory (frame_info_ptr this_frame,
- CORE_ADDR addr, gdb::array_view<gdb_byte> buffer)
+safe_frame_unwind_memory (frame_info_ptr this_frame, CORE_ADDR addr,
+ gdb::array_view<gdb_byte> buffer)
{
/* NOTE: target_read_memory returns zero on success! */
return target_read_memory (addr, buffer.data (), buffer.size ()) == 0;
@@ -2968,8 +2940,7 @@ frame_unwind_arch (frame_info_ptr next_frame)
next_frame->prev_arch.arch = arch;
next_frame->prev_arch.p = true;
- frame_debug_printf ("next_frame=%d -> %s",
- next_frame->level,
+ frame_debug_printf ("next_frame=%d -> %s", next_frame->level,
gdbarch_bfd_arch_info (arch)->printable_name);
}
@@ -2997,9 +2968,9 @@ get_frame_language (frame_info_ptr frame)
CORE_ADDR pc = 0;
bool pc_p = false;
- gdb_assert (frame!= NULL);
+ gdb_assert (frame != NULL);
- /* We determine the current frame language by looking up its
+ /* We determine the current frame language by looking up its
associated symtab. To retrieve this symtab, we use the frame
PC. However we cannot use the frame PC as is, because it
usually points to the instruction following the "call", which
@@ -3062,7 +3033,8 @@ unwind_stop_reason_to_string (enum unwind_stop_reason reason)
switch (reason)
{
#define SET(name, description) \
- case name: return _(description);
+ case name: \
+ return _ (description);
#include "unwind_stop_reasons.def"
#undef SET
@@ -3094,7 +3066,8 @@ frame_stop_reason_symbol_string (enum unwind_stop_reason reason)
switch (reason)
{
#define SET(name, description) \
- case name: return #name;
+ case name: \
+ return #name;
#include "unwind_stop_reasons.def"
#undef SET
@@ -3159,9 +3132,10 @@ const gdb::option::option_def set_backtrace_option_defs[] = {
"past-main",
[] (set_backtrace_options *opt) { return &opt->backtrace_past_main; },
show_backtrace_past_main, /* show_cmd_cb */
- N_("Set whether backtraces should continue past \"main\"."),
- N_("Show whether backtraces should continue past \"main\"."),
- N_("Normally the caller of \"main\" is not of interest, so GDB will terminate\n\
+ N_ ("Set whether backtraces should continue past \"main\"."),
+ N_ ("Show whether backtraces should continue past \"main\"."),
+ N_ (
+ "Normally the caller of \"main\" is not of interest, so GDB will terminate\n\
the backtrace at \"main\". Set this if you need to see the rest\n\
of the stack trace."),
},
@@ -3170,9 +3144,12 @@ of the stack trace."),
"past-entry",
[] (set_backtrace_options *opt) { return &opt->backtrace_past_entry; },
show_backtrace_past_entry, /* show_cmd_cb */
- N_("Set whether backtraces should continue past the entry point of a program."),
- N_("Show whether backtraces should continue past the entry point of a program."),
- N_("Normally there are no callers beyond the entry point of a program, so GDB\n\
+ N_ ("Set whether backtraces should continue past the entry point of a "
+ "program."),
+ N_ ("Show whether backtraces should continue past the entry point of a "
+ "program."),
+ N_ (
+ "Normally there are no callers beyond the entry point of a program, so GDB\n\
will terminate the backtrace there. Set this if you need to see\n\
the rest of the stack trace."),
},
@@ -3197,8 +3174,7 @@ maintenance_print_frame_id (const char *args, int from_tty)
/* Print the frame-id. */
gdb_assert (frame != nullptr);
- gdb_printf ("frame-id for frame #%d: %s\n",
- frame_relative_level (frame),
+ gdb_printf ("frame-id for frame #%d: %s\n", frame_relative_level (frame),
get_frame_id (frame).to_string ().c_str ());
}
@@ -3259,6 +3235,7 @@ frame_info_ptr::reinflate () const
}
void _initialize_frame ();
+
void
_initialize_frame ()
{
@@ -3269,41 +3246,42 @@ _initialize_frame ()
gdb::observers::target_changed.attach (frame_observer_target_changed,
"frame");
- add_setshow_prefix_cmd ("backtrace", class_maintenance,
- _("\
+ add_setshow_prefix_cmd ("backtrace", class_maintenance, _ ("\
Set backtrace specific variables.\n\
Configure backtrace variables such as the backtrace limit"),
- _("\
+ _ ("\
Show backtrace specific variables.\n\
Show backtrace variables such as the backtrace limit."),
&set_backtrace_cmdlist, &show_backtrace_cmdlist,
&setlist, &showlist);
add_setshow_uinteger_cmd ("limit", class_obscure,
- &user_set_backtrace_options.backtrace_limit, _("\
-Set an upper bound on the number of backtrace levels."), _("\
-Show the upper bound on the number of backtrace levels."), _("\
+ &user_set_backtrace_options.backtrace_limit, _ ("\
+Set an upper bound on the number of backtrace levels."),
+ _ ("\
+Show the upper bound on the number of backtrace levels."),
+ _ ("\
No more than the specified number of frames can be displayed or examined.\n\
Literal \"unlimited\" or zero means no limit."),
- NULL,
- show_backtrace_limit,
- &set_backtrace_cmdlist,
+ NULL, show_backtrace_limit, &set_backtrace_cmdlist,
&show_backtrace_cmdlist);
- gdb::option::add_setshow_cmds_for_options
- (class_stack, &user_set_backtrace_options,
- set_backtrace_option_defs, &set_backtrace_cmdlist, &show_backtrace_cmdlist);
+ gdb::option::add_setshow_cmds_for_options (class_stack,
+ &user_set_backtrace_options,
+ set_backtrace_option_defs,
+ &set_backtrace_cmdlist,
+ &show_backtrace_cmdlist);
/* Debug this files internals. */
- add_setshow_boolean_cmd ("frame", class_maintenance, &frame_debug, _("\
-Set frame debugging."), _("\
-Show frame debugging."), _("\
+ add_setshow_boolean_cmd ("frame", class_maintenance, &frame_debug, _ ("\
+Set frame debugging."),
+ _ ("\
+Show frame debugging."),
+ _ ("\
When non-zero, frame specific internal debugging is enabled."),
- NULL,
- show_frame_debug,
- &setdebuglist, &showdebuglist);
+ NULL, show_frame_debug, &setdebuglist,
+ &showdebuglist);
add_cmd ("frame-id", class_maintenance, maintenance_print_frame_id,
- _("Print the current frame-id."),
- &maintenanceprintlist);
+ _ ("Print the current frame-id."), &maintenanceprintlist);
}