/* Cache and manage frames for GDB, the GNU debugger.
- Copyright (C) 1986-2014 Free Software Foundation, Inc.
+ Copyright (C) 1986-2015 Free Software Foundation, Inc.
This file is part of GDB.
#include "value.h"
#include "inferior.h" /* for inferior_ptid */
#include "regcache.h"
-#include "gdb_assert.h"
-#include <string.h>
#include "user-regs.h"
#include "gdb_obstack.h"
#include "dummy-frame.h"
#include "gdbcmd.h"
#include "observer.h"
#include "objfiles.h"
-#include "exceptions.h"
#include "gdbthread.h"
#include "block.h"
#include "inline-frame.h"
return null_frame_id;
}
-const struct frame_id null_frame_id; /* All zeros. */
+const struct frame_id null_frame_id = { 0 }; /* All zeros. */
const struct frame_id outer_frame_id = { 0, 0, 0, FID_STACK_INVALID, 0, 1, 0 };
struct frame_id
outer_frame_id. */
eq = 1;
else if (l.stack_status == FID_STACK_INVALID
- || l.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 = 0;
for (frame = get_current_frame (); ; frame = prev_frame)
{
- struct frame_id this = get_frame_id (frame);
+ struct frame_id self = get_frame_id (frame);
- if (frame_id_eq (id, this))
+ if (frame_id_eq (id, self))
/* An exact match. */
return frame;
frame in the current frame chain can have this ID. See the
comment at frame_id_inner for details. */
if (get_frame_type (frame) == NORMAL_FRAME
- && !frame_id_inner (get_frame_arch (frame), id, this)
+ && !frame_id_inner (get_frame_arch (frame), id, self)
&& frame_id_inner (get_frame_arch (prev_frame), id,
get_frame_id (prev_frame)))
return NULL;
{
if (gdbarch_unwind_pc_p (frame_unwind_arch (this_frame)))
{
- volatile struct gdb_exception ex;
struct gdbarch *prev_gdbarch;
CORE_ADDR pc = 0;
+ int pc_p = 0;
/* The right way. The `pure' way. The one true way. This
method depends solely on the register-unwind code to
different ways that a PC could be unwound. */
prev_gdbarch = frame_unwind_arch (this_frame);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
pc = gdbarch_unwind_pc (prev_gdbarch, this_frame);
+ pc_p = 1;
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
{
else
throw_exception (ex);
}
- else
+ END_CATCH
+
+ if (pc_p)
{
this_frame->prev_pc.value = pc;
this_frame->prev_pc.status = CC_VALUE;
{
/* Popping a dummy frame involves restoring more than just registers.
dummy_frame_pop does all the work. */
- dummy_frame_pop (get_frame_id (this_frame));
+ dummy_frame_pop (get_frame_id (this_frame), inferior_ptid);
return;
}
selected_frame = fi;
/* NOTE: cagney/2002-05-04: FI can be NULL. This occurs when the
frame is being invalidated. */
- if (deprecated_selected_frame_level_changed_hook)
- deprecated_selected_frame_level_changed_hook (frame_relative_level (fi));
/* FIXME: kseitz/2002-08-28: It would be nice to call
selected_frame_level_changed_event() right here, but due to limitations
block. */
if (get_frame_address_in_block_if_available (fi, &pc))
{
- struct symtab *s = find_pc_symtab (pc);
+ struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
- if (s
- && s->language != current_language->la_language
- && s->language != language_unknown
+ if (cust != NULL
+ && compunit_language (cust) != current_language->la_language
+ && compunit_language (cust) != language_unknown
&& language_mode == language_mode_auto)
- set_language (s->language);
+ set_language (compunit_language (cust));
}
}
}
struct frame_info *
get_prev_frame_always (struct frame_info *this_frame)
{
- volatile struct gdb_exception ex;
struct frame_info *prev_frame = NULL;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
prev_frame = get_prev_frame_always_1 (this_frame);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == MEMORY_ERROR)
{
else
throw_exception (ex);
}
+ END_CATCH
return prev_frame;
}
int
get_frame_pc_if_available (struct frame_info *frame, CORE_ADDR *pc)
{
- volatile struct gdb_exception ex;
gdb_assert (frame->next != NULL);
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
*pc = frame_unwind_pc (frame->next);
}
- if (ex.reason < 0)
+ CATCH (ex, RETURN_MASK_ERROR)
{
if (ex.error == NOT_AVAILABLE_ERROR)
return 0;
else
throw_exception (ex);
}
+ END_CATCH
return 1;
}
get_frame_address_in_block_if_available (struct frame_info *this_frame,
CORE_ADDR *pc)
{
- volatile struct gdb_exception ex;
- TRY_CATCH (ex, RETURN_MASK_ERROR)
+ TRY
{
*pc = get_frame_address_in_block (this_frame);
}
- if (ex.reason < 0 && ex.error == NOT_AVAILABLE_ERROR)
- return 0;
- else if (ex.reason < 0)
- throw_exception (ex);
- else
- return 1;
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ if (ex.error == NOT_AVAILABLE_ERROR)
+ return 0;
+ throw_exception (ex);
+ }
+ END_CATCH
+
+ return 1;
}
void
init_sal (sal);
if (SYMBOL_LINE (sym) != 0)
{
- sal->symtab = SYMBOL_SYMTAB (sym);
+ sal->symtab = symbol_symtab (sym);
sal->line = SYMBOL_LINE (sym);
}
else
return frame_unwind_arch (skip_artificial_frames (next_frame));
}
+/* Gets the language of FRAME. */
+
+enum language
+get_frame_language (struct frame_info *frame)
+{
+ CORE_ADDR pc = 0;
+ int pc_p = 0;
+
+ gdb_assert (frame!= NULL);
+
+ /* 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
+ is sometimes the first instruction of another function. So
+ we rely on get_frame_address_in_block(), it provides us with
+ a PC that is guaranteed to be inside the frame's code
+ block. */
+
+ TRY
+ {
+ pc = get_frame_address_in_block (frame);
+ pc_p = 1;
+ }
+ CATCH (ex, RETURN_MASK_ERROR)
+ {
+ if (ex.error != NOT_AVAILABLE_ERROR)
+ throw_exception (ex);
+ }
+ END_CATCH
+
+ if (pc_p)
+ {
+ struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
+
+ if (cust != NULL)
+ return compunit_language (cust);
+ }
+
+ return language_unknown;
+}
+
/* Stack pointer methods. */
CORE_ADDR