summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-03-12 23:55:36 +0000
committerAndrew Cagney <cagney@redhat.com>2003-03-12 23:55:36 +0000
commit1f23d24b3806d8abd783b8c3093e2627215f91d6 (patch)
tree8ed5793aa1b518014a5e8a4367bfb3425fd5314b
parented433d72fa631b05dde94e668e8977ea1a5879f3 (diff)
downloadgdb-1f23d24b3806d8abd783b8c3093e2627215f91d6.tar.gz
2003-03-12 Andrew Cagney <cagney@redhat.com>
* frame.c (get_prev_frame): Rename the frame parameter to "this_frame". (get_next_frame, legacy_get_prev_frame): Ditto.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/frame.c98
2 files changed, 55 insertions, 49 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 764c0d5f937..1495f98729d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2003-03-12 Andrew Cagney <cagney@redhat.com>
+ * frame.c (get_prev_frame): Rename the frame parameter to
+ "this_frame".
+ (get_next_frame, legacy_get_prev_frame): Ditto.
+
+2003-03-12 Andrew Cagney <cagney@redhat.com>
+
* frame.c (get_current_frame): Check target_has_registers before
checking target_has_stack.
* eval.c (evaluate_subexp_standard): Use get_selected_frame,
diff --git a/gdb/frame.c b/gdb/frame.c
index 7975090c664..267d484b606 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -960,15 +960,15 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
return fi;
}
-/* Return the frame that FRAME calls (NULL if FRAME is the innermost
- frame). Be careful to not fall off the bottom of the frame chain
- and onto the sentinel frame. */
+/* Return the frame that THIS_FRAME calls (NULL if THIS_FRAME is the
+ innermost frame). Be careful to not fall off the bottom of the
+ frame chain and onto the sentinel frame. */
struct frame_info *
-get_next_frame (struct frame_info *frame)
+get_next_frame (struct frame_info *this_frame)
{
- if (frame->level > 0)
- return frame->next;
+ if (this_frame->level > 0)
+ return this_frame->next;
else
return NULL;
}
@@ -1005,7 +1005,7 @@ reinit_frame_cache (void)
INIT_EXTRA_INFO, INIT_FRAME_PC and INIT_FRAME_PC_FIRST. */
static struct frame_info *
-legacy_get_prev_frame (struct frame_info *next_frame)
+legacy_get_prev_frame (struct frame_info *this_frame)
{
CORE_ADDR address = 0;
struct frame_info *prev;
@@ -1013,7 +1013,7 @@ legacy_get_prev_frame (struct frame_info *next_frame)
/* This code only works on normal frames. A sentinel frame, where
the level is -1, should never reach this code. */
- gdb_assert (next_frame->level >= 0);
+ gdb_assert (this_frame->level >= 0);
/* On some machines it is possible to call a function without
setting up a stack frame for it. On these machines, we
@@ -1022,14 +1022,14 @@ legacy_get_prev_frame (struct frame_info *next_frame)
or isn't leafless. */
/* Still don't want to worry about this except on the innermost
- frame. This macro will set FROMLEAF if NEXT_FRAME is a frameless
+ frame. This macro will set FROMLEAF if THIS_FRAME is a frameless
function invocation. */
- if (next_frame->level == 0)
+ if (this_frame->level == 0)
/* FIXME: 2002-11-09: Frameless functions can occure anywhere in
the frame chain, not just the inner most frame! The generic,
per-architecture, frame code should handle this and the below
should simply be removed. */
- fromleaf = FRAMELESS_FUNCTION_INVOCATION (next_frame);
+ fromleaf = FRAMELESS_FUNCTION_INVOCATION (this_frame);
else
fromleaf = 0;
@@ -1040,7 +1040,7 @@ legacy_get_prev_frame (struct frame_info *next_frame)
/* FIXME: 2002-11-09: There isn't any reason to special case this
edge condition. Instead the per-architecture code should hande
it locally. */
- address = get_frame_base (next_frame);
+ address = get_frame_base (this_frame);
else
{
/* Two macros defined in tm.h specify the machine-dependent
@@ -1059,9 +1059,9 @@ legacy_get_prev_frame (struct frame_info *next_frame)
start go curfluy than have an abort called from main not show
main. */
gdb_assert (FRAME_CHAIN_P ());
- address = FRAME_CHAIN (next_frame);
+ address = FRAME_CHAIN (this_frame);
- if (!frame_chain_valid (address, next_frame))
+ if (!frame_chain_valid (address, this_frame))
return 0;
}
if (address == 0)
@@ -1071,10 +1071,10 @@ legacy_get_prev_frame (struct frame_info *next_frame)
prev = frame_obstack_zalloc (sizeof (struct frame_info));
/* Link it in. */
- next_frame->prev = prev;
- prev->next = next_frame;
+ this_frame->prev = prev;
+ prev->next = this_frame;
prev->frame = address;
- prev->level = next_frame->level + 1;
+ prev->level = this_frame->level + 1;
/* FIXME: cagney/2002-11-18: Should be setting the frame's type
here, before anything else, and not last. Various INIT functions
are full of work-arounds for the frames type not being set
@@ -1139,7 +1139,7 @@ legacy_get_prev_frame (struct frame_info *next_frame)
inner most and any other case.
Since there is always a frame to unwind from, there is always
- somewhere (NEXT_FRAME) to store all the info needed to construct
+ somewhere (THIS_FRAME) to store all the info needed to construct
a new (previous) frame without having to first create it. This
means that the convolution below - needing to carefully order a
frame's initialization - isn't needed.
@@ -1168,10 +1168,10 @@ legacy_get_prev_frame (struct frame_info *next_frame)
getting ourselves into an infinite backtrace. Some architectures
check this in FRAME_CHAIN or thereabouts, but it seems like there
is no reason this can't be an architecture-independent check. */
- if (prev->frame == next_frame->frame
- && prev->pc == next_frame->pc)
+ if (prev->frame == this_frame->frame
+ && prev->pc == this_frame->pc)
{
- next_frame->prev = NULL;
+ this_frame->prev = NULL;
obstack_free (&frame_cache_obstack, prev);
return NULL;
}
@@ -1219,11 +1219,11 @@ legacy_get_prev_frame (struct frame_info *next_frame)
}
/* Return a structure containing various interesting information
- about the frame that called NEXT_FRAME. Returns NULL
+ about the frame that called THIS_FRAME. Returns NULL
if there is no such frame. */
struct frame_info *
-get_prev_frame (struct frame_info *next_frame)
+get_prev_frame (struct frame_info *this_frame)
{
struct frame_info *prev_frame;
@@ -1245,7 +1245,7 @@ get_prev_frame (struct frame_info *next_frame)
that a frame isn't possible, rather than checking that the target
has state and then calling get_current_frame() and
get_prev_frame(). This is a guess mind. */
- if (next_frame == NULL)
+ if (this_frame == NULL)
{
/* NOTE: cagney/2002-11-09: There was a code segment here that
would error out when CURRENT_FRAME was NULL. The comment
@@ -1258,18 +1258,18 @@ get_prev_frame (struct frame_info *next_frame)
thing to do.''
Per the above, this code shouldn't even be called with a NULL
- NEXT_FRAME. */
+ THIS_FRAME. */
return current_frame;
}
/* There is always a frame. If this assertion fails, suspect that
something should be calling get_selected_frame() or
get_current_frame(). */
- gdb_assert (next_frame != NULL);
+ gdb_assert (this_frame != NULL);
- if (next_frame->level >= 0
+ if (this_frame->level >= 0
&& !backtrace_below_main
- && inside_main_func (get_frame_pc (next_frame)))
+ && inside_main_func (get_frame_pc (this_frame)))
/* Don't unwind past main(), bug always unwind the sentinel frame.
Note, this is done _before_ the frame has been marked as
previously unwound. That way if the user later decides to
@@ -1282,9 +1282,9 @@ get_prev_frame (struct frame_info *next_frame)
}
/* Only try to do the unwind once. */
- if (next_frame->prev_p)
- return next_frame->prev;
- next_frame->prev_p = 1;
+ if (this_frame->prev_p)
+ return this_frame->prev;
+ this_frame->prev_p = 1;
/* If we're inside the entry file, it isn't valid. Don't apply this
test to a dummy frame - dummy frame PC's typically land in the
@@ -1297,8 +1297,8 @@ get_prev_frame (struct frame_info *next_frame)
/* NOTE: cagney/2003-01-10: If there is a way of disabling this test
then it should probably be moved to before the ->prev_p test,
above. */
- if (next_frame->type != DUMMY_FRAME && next_frame->level >= 0
- && inside_entry_file (get_frame_pc (next_frame)))
+ if (this_frame->type != DUMMY_FRAME && this_frame->level >= 0
+ && inside_entry_file (get_frame_pc (this_frame)))
{
if (frame_debug)
fprintf_unfiltered (gdb_stdlog,
@@ -1314,8 +1314,8 @@ get_prev_frame (struct frame_info *next_frame)
/* NOTE: cagney/2003-02-25: Don't enable until someone has found
hard evidence that this is needed. */
if (0
- && next_frame->type != DUMMY_FRAME && next_frame->level >= 0
- && inside_entry_func (get_frame_pc (next_frame)))
+ && this_frame->type != DUMMY_FRAME && this_frame->level >= 0
+ && inside_entry_func (get_frame_pc (this_frame)))
{
if (frame_debug)
fprintf_unfiltered (gdb_stdlog,
@@ -1331,9 +1331,9 @@ get_prev_frame (struct frame_info *next_frame)
|| DEPRECATED_INIT_FRAME_PC_FIRST_P ()
|| DEPRECATED_INIT_EXTRA_FRAME_INFO_P ()
|| FRAME_CHAIN_P ())
- && next_frame->level >= 0)
+ && this_frame->level >= 0)
{
- prev_frame = legacy_get_prev_frame (next_frame);
+ prev_frame = legacy_get_prev_frame (this_frame);
if (frame_debug && prev_frame == NULL)
fprintf_unfiltered (gdb_stdlog,
"Outermost frame - legacy_get_prev_frame NULL.\n");
@@ -1351,7 +1351,7 @@ get_prev_frame (struct frame_info *next_frame)
been here before' check above will stop repeated memory
allocation calls. */
prev_frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
- prev_frame->level = next_frame->level + 1;
+ prev_frame->level = this_frame->level + 1;
/* Try to unwind the PC. If that doesn't work, assume we've reached
the oldest frame and simply return. Is there a better sentinal
@@ -1361,16 +1361,16 @@ get_prev_frame (struct frame_info *next_frame)
Note that the pc-unwind is intentionally performed before the
frame chain. This is ok since, for old targets, both
frame_pc_unwind (nee, FRAME_SAVED_PC) and FRAME_CHAIN()) assume
- NEXT_FRAME's data structures have already been initialized (using
+ THIS_FRAME's data structures have already been initialized (using
DEPRECATED_INIT_EXTRA_FRAME_INFO) and hence the call order
doesn't matter.
By unwinding the PC first, it becomes possible to, in the case of
a dummy frame, avoid also unwinding the frame ID. This is
because (well ignoring the PPC) a dummy frame can be located
- using NEXT_FRAME's frame ID. */
+ using THIS_FRAME's frame ID. */
- prev_frame->pc = frame_pc_unwind (next_frame);
+ prev_frame->pc = frame_pc_unwind (this_frame);
if (prev_frame->pc == 0)
{
/* The allocated PREV_FRAME will be reclaimed when the frame
@@ -1409,9 +1409,9 @@ get_prev_frame (struct frame_info *next_frame)
frame_register_unwind to obtain the register values
needed to determine the dummy frame's ID. */
prev_frame->id = gdbarch_unwind_dummy_id (current_gdbarch,
- next_frame);
+ this_frame);
}
- else if (next_frame->level < 0)
+ else if (this_frame->level < 0)
{
/* We're unwinding a sentinel frame, the PC of which is
pointing at a stack dummy. Fake up the dummy frame's ID
@@ -1436,9 +1436,9 @@ get_prev_frame (struct frame_info *next_frame)
case SIGTRAMP_FRAME:
/* FIXME: cagney/2003-03-04: The below call isn't right. It
should instead be doing something like "prev_frame -> unwind
- -> id (next_frame, & prev_frame -> unwind_cache, & prev_frame
+ -> id (this_frame, & prev_frame -> unwind_cache, & prev_frame
-> id)" but that requires more extensive (pending) changes. */
- next_frame->unwind->id (next_frame, &next_frame->unwind_cache,
+ this_frame->unwind->id (this_frame, &this_frame->unwind_cache,
&prev_frame->id);
/* Check that the unwound ID is valid. */
if (!frame_id_p (prev_frame->id))
@@ -1456,8 +1456,8 @@ get_prev_frame (struct frame_info *next_frame)
sentinel frame's frame ID to a `sentinel'. Leave it until
after the switch to storing the frame ID, instead of the
frame base, in the frame object. */
- if (next_frame->level >= 0
- && frame_id_inner (prev_frame->id, get_frame_id (next_frame)))
+ if (this_frame->level >= 0
+ && frame_id_inner (prev_frame->id, get_frame_id (this_frame)))
error ("Unwound frame inner-to selected frame (corrupt stack?)");
/* Note that, due to frameless functions, the stronger test of
the new frame being outer to the old frame can't be used -
@@ -1474,8 +1474,8 @@ get_prev_frame (struct frame_info *next_frame)
prev_frame->frame = prev_frame->id.base;
/* Link it in. */
- next_frame->prev = prev_frame;
- prev_frame->next = next_frame;
+ this_frame->prev = prev_frame;
+ prev_frame->next = this_frame;
/* FIXME: cagney/2002-01-19: This call will go away. Instead of
initializing extra info, all frames will use the frame_cache