aboutsummaryrefslogtreecommitdiff
path: root/gdb/varobj.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2009-02-05 17:28:21 +0000
committerPedro Alves <palves@redhat.com>2009-02-05 17:28:21 +0000
commit9d49bdc28ad672f6e23e9f33759f73968d6885ff (patch)
tree6bdaf0312e8701db011376578e7b6022e72231e4 /gdb/varobj.c
parent12453b93bd8de559235835300eac68118c4ade70 (diff)
downloadgdb-9d49bdc28ad672f6e23e9f33759f73968d6885ff.zip
gdb-9d49bdc28ad672f6e23e9f33759f73968d6885ff.tar.gz
gdb-9d49bdc28ad672f6e23e9f33759f73968d6885ff.tar.bz2
* frame.c (has_stack_frames): Make public.
(get_prev_frame): Don't allow a NULL this_frame anymore. * frame.h (has_stack_frames): Declare. * varobj.c (find_frame_addr_in_frame_chain): Don't ever pass NULL to get_prev_frame, instead start at get_current_frame. (varobj_create): Check has_stack_frames before getting any frame; eliminate one usage of deprecated_safe_get_selected_frame.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r--gdb/varobj.c39
1 files changed, 23 insertions, 16 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c
index 5b2ed9c..2ec6d90 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -431,14 +431,15 @@ find_frame_addr_in_frame_chain (CORE_ADDR frame_addr)
if (frame_addr == (CORE_ADDR) 0)
return NULL;
- while (1)
+ for (frame = get_current_frame ();
+ frame != NULL;
+ frame = get_prev_frame (frame))
{
- frame = get_prev_frame (frame);
- if (frame == NULL)
- return NULL;
if (get_frame_base_address (frame) == frame_addr)
return frame;
}
+
+ return NULL;
}
struct varobj *
@@ -462,20 +463,26 @@ varobj_create (char *objname,
struct value *value = NULL;
int expr_len;
- /* Parse and evaluate the expression, filling in as much
- of the variable's data as possible */
+ /* Parse and evaluate the expression, filling in as much of the
+ variable's data as possible. */
- /* Allow creator to specify context of variable */
- if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME))
- fi = deprecated_safe_get_selected_frame ();
+ if (has_stack_frames ())
+ {
+ /* Allow creator to specify context of variable */
+ if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME))
+ fi = get_selected_frame (NULL);
+ else
+ /* FIXME: cagney/2002-11-23: This code should be doing a
+ lookup using the frame ID and not just the frame's
+ ``address''. This, of course, means an interface
+ change. However, with out that interface change ISAs,
+ such as the ia64 with its two stacks, won't work.
+ Similar goes for the case where there is a frameless
+ function. */
+ fi = find_frame_addr_in_frame_chain (frame);
+ }
else
- /* FIXME: cagney/2002-11-23: This code should be doing a
- lookup using the frame ID and not just the frame's
- ``address''. This, of course, means an interface change.
- However, with out that interface change ISAs, such as the
- ia64 with its two stacks, won't work. Similar goes for the
- case where there is a frameless function. */
- fi = find_frame_addr_in_frame_chain (frame);
+ fi = NULL;
/* frame = -2 means always use selected frame */
if (type == USE_SELECTED_FRAME)